Hi,
I had some troubles with a cSigCjPushbutton to not reliably send the onclick.
This was because the button was used to invoke a modal panel.
As a result the push button worked like:
0. Click -> invoke popup
1. Click -> invoke popup
2. Click .... nothing
3. Click -> invoke popup
4. Click .... nothing
5. Click -> invoke popup
It turns out that the codejock layer had some bugfixing going on that depended on the "mouse up" event being send to work around a problem with codejock somehow not triggering the onComClick the first time it was clicked.
With a modal popup the "mouse up" event only triggers after the modal popup was finished and I think in my case it did not even trigger for whatever reason. Anyways..
Basically it was using a property to maintain state and then juggling with that state.
I initially tried to patch that, reset the state from within onComClick.. and somehow I ended up with onClick sometimes being send two times (when not invoking popups)
Ugh..
So... I now have patched it in a subclass in the following way. The "mouse down" event is send reliably every time.
Which defeats the whole juggling with trying to maintain the correct state in the Private_pbClicked property.
My subclass now has this:
Code:
Procedure OnClick
End_Procedure
// Don't use this, it's unreliable (override existing behavior)
Procedure OnComClick
End_Procedure
// (override existing behavior)
Procedure OnComMouseDown Short iButton Short iShift OLE_XPOS_PIXELS iX OLE_YPOS_PIXELS iY
Send MouseDown iButton iShift iX iY
Send OnClick
End_Procedure // OnComMouseDown
// (override existing behavior)
Procedure OnComMouseUp Short iButton Short iShift OLE_XPOS_PIXELS iX OLE_YPOS_PIXELS iY
Send MouseUp iButton iShift iX iY
End_Procedure
Enjoy!
--
Wil