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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cell Double Click

Thread ID:





3795 Apr 9,2003 10:28 AM UTC Apr 11,2003 06:09 AM UTC WinForms 2
Tags: GridControl
Robert Hughes
Asked On April 9, 2003 10:28 AM UTC

I am trying to handle the double click event on a cell in a bound data grid. I'm doing this using the following as directed in other forum posts. grd.Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell; grd.DoubleClick += new System.EventHandler(MyHandler); grd.CellDoubleClick += new Syncfusion.Windows.Forms.Grid.GridCellClickEventHandler(MyHandler); My problem occurs due to MyHandler opening a dialog form which on closing returns focus to the original form on which the grid resides. When, on this original form, I click on another cell in the grid, the double click event is fired. How can I prevent this happening ? Also, I'd like to be able to have access to the contents of the cell, say to highlight and copy some text. With the code above controlling the current cell behaviour I can only achieve this after a double click, which in this instance fires the double click event and takes me through the handling routine. Any thoughts as to how I might achieve this functionality whilst retaining my double click handling ? Essentially I'd like to be able highlight the cell details as though the ActivateCurrentCellBehavior value were not set to GridCellActivateAction.DblClickOnCell whilst being able to capture a double click within the cell. Is this possible ? Many thanks, Rob Hughes

Administrator [Syncfusion]
Replied On April 9, 2003 09:00 PM UTC

Here is one way I think you can display a dialog on a double click and then have an active cell afterwards (without getting a Double event when you click the next cell) is to: 1) this.gridControl1.Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.None; 2) Move your dialog from CellDoubleClick to DoubleClick, and begin edit on the currentcell afterwards.
private void gridControl1_DoubleClick(object sender, System.EventArgs e)
Default grid behavior lets you activate a cell for editing by pressing F2, so you can have an editing cell without double-clicking. But this may not be intuitive enough for your user. If you allow a single click to activate a cell, then it is tough to catch a double click. You can mark the time in of the single-click, and then if the embedded control gets another click within the DoubleClick time, then you could call it a double click, and perform your double click functions. This would take some work, but I expect it is doable.

Robert Hughes
Replied On April 11, 2003 06:09 AM UTC

Thanks Clay.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon