excel-like cell activation

I am trying to get an excel-like cell activation behavior for cell with textbox editing--single click lt mouse button activates cell, but no insert caret, dbl-click activates cell and puts insert caret at mouse position. Setting Grid.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell gets close, but when user Dbl clicks, the insert caret is not positioned where the mouse is.

2 Replies

AD Administrator Syncfusion Team August 3, 2005 10:08 PM UTC

There is no property setting for this. I think you can get this behavior using an event and a timer.
//in form.load
this.gridControl1.CellDoubleClick += new GridCellClickEventHandler(gridControl1_CellDoubleClick);
this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell;


private Timer t = null; 
private void gridControl1_CellDoubleClick(object sender, GridCellClickEventArgs e)
{
	if(this.t == null)
	{
		this.t = new Timer();
		this.t.Interval = 10;
		this.t.Tick += new EventHandler(t_Tick);
	}
	this.t.Start();			
}

private void t_Tick(object sender, EventArgs e)
{
	this.t.Stop();
	GridTextBoxCellRenderer cr = this.gridControl1.CurrentCell.Renderer as GridTextBoxCellRenderer;
	if(cr.TextBox != null)
	{
		Point pt = cr.TextBox.PointToClient(Control.MousePosition);
		Syncfusion.Drawing.ActiveXSnapshot.FakeLeftMouseClick(cr.TextBox, pt);
	}
}


CT Craig Timmerman August 4, 2005 03:10 PM UTC

Works great. Many thanks. >There is no property setting for this. > >I think you can get this behavior using an event and a timer.

Loader.
Up arrow icon