Jump to content

Button down event?


Guest Frank

Recommended Posts

Guest Frank

Is there a way to trigger a button down event?   I get a button event when the button is released but not when pressed.  I looked at the gwin_button code and found that the button will only trigger an event when ButtonMouseUp() is called.  I would like to have a button event when ButtonMouseDown() is called.  I looked at using gwinButtonIsPressed() but since geventEventWait() is blocking it is not practical.  Any suggestions short of making a custom button widget?

Thanks

 

Link to comment
Share on other sites

The current design to only send an event on button up is intentional. Particularly on touch screens pressing can be inaccurate. One way of handling that is to only send the button event if the button is pressed and released while the touch is over the button. Even desktop environments often to the same.

To demonstrate this press over the button and while holding the touch/mouse down slide off the area of the button. You will see that the button remains in the depressed state. When you lift off the touch (release the mouse click) you will get one of two responses; if you were over the button on the release you will get a button event indicating the button was triggered. If you release outside the button area the button returns to its unpressed state and no event is sent ie the button press is effectively cancelled. 

If you add the extra event send on the button down you will need to either turn off the button cancelling feature or be able to handle sometimes not recieving the release event.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...