We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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 05:08 PM

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 10:10 AM

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.
Live Chat Icon For mobile
Up arrow icon