|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Offer Har
|
Sep 2, 2008 - 9:57 AM
|
Hi, I have a tree grid that if a cell is clicked I do operation X, and if the cell is double-clicked, I do operation Y. The problem is that if I double click the cell, I first get a call to the function OnGbwAnalyzeCellMouseClickEvent with nRepCnt==1 and then another call with nRepCnt==2 , so there is no way for me to handle this simple task. Is there another way to distniguish between single & double click in grids? Thanks, Ron.
|
|
Technical Support
|
Sep 4, 2008 - 12:55 PM
|
This is a common task. You should handle double-clicking as is. I.e. you should invoke your default double-clicking handling code directly from the OnGbwAnalyzeCellMouseClickEvent() method. The single click notification received by this method should be handled with a delay. So, if your method has received the single click event, then it should invoke the SetTimer( SOME_TIMER_ID, ::GetDoubleClickTime() + 1 , NULL ); code. Of course, you should handle the SOME_TIMER_ID timer event for handling single click event. Please do not forget to invoke the KillTimer( SOME_TIMER_ID ); code in the very beginning of both single and double click handling code.
|
|
Offer Har
|
Sep 4, 2008 - 1:04 PM
|
Why is this so complicated? When you do the same for a normal control, you have two separate function that do not cross ON_WM_LBUTTONDBLCLK and ON_WM_LBUTTONDOWN/UP.
|
|
Technical Support
|
Sep 6, 2008 - 8:59 AM
|
We do not agree with you:
1) Any window which has a window class registered using the CS_DBLCLICKS class style receives a WM_LBUTTONDOWN message first and only then receives a WM_LBUTTONDBLCLK message. So, the solution we described should be used in any window which supports double clicking events.
2) The solution we described is not complicated. It’s simplest possible.
|
|