When a the user presses a button with the mouse, I get the Pt_CB_ARM callback. When the user releases the mouse, one of two possibilities happens:
The mouse pointer is still within the bounds of the button, in which case I get two callbacks: Pt_CB_DISARM and Pt_CB_ACTIVATE.
The mouse pointer has left the button (the user moved the mouse away with the mouse button still pressed down), and I get only Pt_CB_DISARM.
Question: Within the Pt_CB_DISARM callback, can I find out which of the two possibilities has actually occured?
Reason is that in Pt_CB_ARM, I load some value into a helper variable. When the user helds down the mouse pointer for a while, I get Pt_CB_REPEAT and increment the value and display it. In Pt_CB_ACTIVATE, I save it away. However, the user can cancel the operation by simply moving the mouse pointer away from the button and then releasing it - in that case, I could restore the original value in the Pt_CB_DISARM, if I new if Pt_CB_ACTIVATE followed or not.
Wow, I didn’t realize Pt_CB_DISARM was being called in addition to Pt_CB_ACTIVATE. I guess I misunderstood the documentation. But I tested it and you are correct.
My guess would be the answer lies somewhere in the PtCallbackInfo_t structure. From there you can access a PhEvent_t structure which has information about the event. I don’t know what you’d be looking for or if that would be the preferred method.
The way you described the problem there is an obvious logical solution. I’m assuming your goal is for the helper variable to have the new value (possibly incremented by repeats) only ACTIVATE occurs. Well put the value in a temp variable, and only transfer it to the helper variable in the ACTIVATE callback. If you have some logic that asks whether you are in an intermediate state, (button pushed but not releated yet) that logic will now have to look at the temp variable as well as the helper variable.