Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
I can't distinguish between a CLICK and a DBLCLK event in an edit table
The title says it all...
My desired behavior for the form is:
* When I click on a row, I will put some explanatory text in a TEXT box, but remain in the form context, i.e. I don't leave.
* When I double-click on that same row, I want it to act like clicking and , i.e. I want to take the row information, do some processing, and leave the form.
First I check for the edit table control being activated, then I check for the event being fired, CLICK vs DBLCLK.
My problem is: I can't capture a double-click event, no matter how fast or slow I double-click or what I do.
Whenever and however I double-click the row, the event in the debugger shows CLICK, not DBLCLK.
Is there a trick to capturing a double-click?
My desired behavior for the form is:
* When I click on a row, I will put some explanatory text in a TEXT box, but remain in the form context, i.e. I don't leave.
* When I double-click on that same row, I want it to act like clicking and , i.e. I want to take the row information, do some processing, and leave the form.
First I check for the edit table control being activated, then I check for the event being fired, CLICK vs DBLCLK.
My problem is: I can't capture a double-click event, no matter how fast or slow I double-click or what I do.
Whenever and however I double-click the row, the event in the debugger shows CLICK, not DBLCLK.
Is there a trick to capturing a double-click?
Comments
The EVENT variable is never equal to 'DBLCLK', regardless of how fast or slow I double-click the edit table row. The EVENT variable always has 'CLICK'.
Case Control = "TABLE_VALUES" Begin Case Case EVENT = 'CLICK' debug * IF USER ONLY CLICKS, DISPLAY FIELD INFO IN THE INFO WINDOW. TMP = Get_Property(EDITTABLE,"SELPOS") TH = TMP<2> ; * TMP<1> IS THE COLUMN; WE DONT CARE WHICH COLUMN WAS CLICKED. VDESC = GET_PROPERTY(@WINDOW,"@VDESC") TH_VDESC = TRIM( VDESC<TH> ) ; * GET THE TH VALUE OF THE DESCRIPTIONS. VPRCE = GET_PROPERTY(@WINDOW,"@VPRCE") TH_VPRCE = VPRCE<TH> TH_VDESC_TAG = '' IF TH_VPRCE = 'P' Then TH_VDESC_TAG = "**PROTECTED** " TH_VDESC = TH_VDESC_TAG : TH_VDESC CALL Set_Property(MESSAGES,"TEXT",TH_VDESC) Case EVENT = 'DBLCLK' debug
That was going to be my next question. I've seen situations like this before, but they are almost always related to some type of interference occurring in the CLICK event. Once the CLICK event executes it practically interrupts the DBLCLK event. Does this problem occur if you keep the CLICK event in the commuter but rem out all of the other lines related to the CLICK event? My expectation is that both events can work as long as the CLICK event doesn't do much.
So only an empty CLICK event allows a DBLCLK event to happen. Even the presence of a single debug statement for the "CLICK" event makes it fire, ignoring any possible DBLCLK event generation.
I can work with this, but for the UI it would feel more intuitive if double-clicking would be just like clicking and pressing OK - that's what I'm trying to implement as the form's behavior.
Basically, OI doesn't give me the dblclk event ever. The moment I click or double click a row, OI is off to the races, and the commuter module shows the event as click.
So I'm not sure how changing the order in which I check what a variable is in the subroutine would affect the value OI presents me.
Only by commenting out the click handler in the commuter module do I ever see a dblclk event generated.
This is is the point I was trying to make. Having a debug statement is itself a (if not the) problem. It is interrupting the engine long enough to lose track of the DBLCLK event. You confirmed that if you rem out everything (including the debug) then the DBLCLK fires. What happens if you allow just one command to run in the CLICK event, such as one of the Get_Property calls? Will that stop the DBLCLK event?
Interestingly, I've had to deal with the opposite issue. Some of my controls don't use WM_LBUTTONDBLCLK, but Windows doesn't care. It fires it anyway. If I were only to handle WM_LBUTTONDOWN, then my control would feel unresponsive because every other click (if done fast enough) would be a WM_LBUTTONDBLCLK instead. So, I have to make sure WM_LBUTTONDBLCLK calls the same code as WM_LBUTTONDOWN to make sure every click behaves the same.
Some events are just a pain to debug because the debugging process triggers the events differently. Put a debug in GOTFOCUS, LOSTFOCUS, or ACTIVATED and enjoy the rest of your hair getting pulled out. :)