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

cellclick & celldoubleclick event fired when double clicking

Thread ID:

Created:

Updated:

Platform:

Replies:

10200 Jan 26,2004 09:00 AM Jan 27,2004 08:23 AM Windows Forms 6
loading
Tags: GridControl
Tommy Norman
Asked On January 26, 2004 09:00 AM

Hi, I''m using the celldoubleclick event handler to perform a column/row collaps/Expand function and the cellclick event handler to run code for setting the propertygrid. However, when I perform a double click to collaps the column I get both a cellclick and a celldoubleclick events raised. This degrades the performance of the collaps/expand feature because it runs unneccessary through the code in the cellclick eventhandler before it runs the code in the celldoubleclick eventhandler. How can I prevent this from happening? Best Regards /Tommy

Administrator [Syncfusion]
Replied On January 26, 2004 09:32 AM

The problem, of course, is the grid does not know if the first click is just a singleclick or is part of a double click. One way around this is to enable a timer in the singleclick event and set it for SystemInformation.DoubleClickTime. If the timer event fires before the doubleclick event is hit, then you know the click really was a single click. So, move the code you currently have in CellClick to the timer event. In CellClick, enable the timer. In the timer event, disable the timer and do your code. Also, in the doubleclick event, disable the timer before doing your work there.

Tommy Norman
Replied On January 27, 2004 01:26 AM

Thanks clay it works! How do I pass the (object sender, GridCellClickEventArgs e) from the cellclick event to the timer event handler in the best way? /Tommy >The problem, of course, is the grid does not know if the first click is just a singleclick or is part of a double click. > >One way around this is to enable a timer in the singleclick event and set it for SystemInformation.DoubleClickTime. If the timer event fires before the doubleclick event is hit, then you know the click really was a single click. > >So, move the code you currently have in CellClick to the timer event. In CellClick, enable the timer. In the timer event, disable the timer and do your code. Also, in the doubleclick event, disable the timer before doing your work there.

Administrator [Syncfusion]
Replied On January 27, 2004 03:59 AM

Probably the most staight-forward way would be to just add a private member to your class (if the timer evenhandler and the cellclick event handler are in the same class). If you need to access things from different classes you could use a Static (Shared in VB) member. Another option, depending upon what you need (like grid row and column index), you might be able to calcualte that if you know the grid.

Tommy Norman
Replied On January 27, 2004 04:26 AM

Hi again clay I needed to know the current row & column index inside the timer event handler but I could get it out from the grid so know it works but by using a timer like this I just move the performance problem from the double click to the single click event handler because the code waits till the double click timer ticks. Any other ideas? /Tommy

Administrator [Syncfusion]
Replied On January 27, 2004 07:30 AM

No I don''t. I do not know how to distinguish a single click from the first click of a double click unless you wait a moment to see if there is another click. I thought the efficiency problem had to do with avoiding the code in the single click event by making sure you only executed if it was in fact a single click. This timer will make sure you only do the single click code if the click was in fact a single click.

Tommy Norman
Replied On January 27, 2004 08:23 AM

Yes you are right, the efficiency problem is solved for the double click event, but the code I want to execute when I make "just" a single click is now delayed with the DoubleClickTime and this doesn''t give that instant respons I''m looking for. I skipped the timer and went back to the original solution and have now tuned the code in the cellclick event handler till it''s limits. The respons time for both single and double click looks a bit better and I hope it will be accepted by the users. Thanks Clay for your support Best Regards Tommy

CONFIRMATION

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.

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.

;