Button down and button up event handlers execute while user keeps finger on a button.

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Everyone,

I have 2 event handlers for a particular button. One handler is for the button down event and one for the button up event.

Both event handlers execute even if the user taps the button and keeps a finger on the button without lifting up on the finger.

I'm assuming this can be stopped by a setting but I don't know which one to set because I only want the button down to execute when the button is held down and the button up event to execute only when the user releases the button by lifting up on the finger.

Thanks.
 

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Erel,

Do you have a link to a sample project using the technique you are describing so I can learn how to do it?

Thanks.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Attached you find a small example with some special features.
- The button image changes when the button is touched and released.
- Displays tooltips.

Best regards.
 

Attachments

  • ButtonDownUpWithPanel.zip
    8.7 KB · Views: 611
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Attached you find a small example with some special features.
- The button image changes when the button is touched and released.
- Displays tooltips.

Best regards.

Nice example for me too.
 
Upvote 0

aleung

Member
Licensed User
Longtime User
I recommend you to use a Panel instead and handle its Touch event. On some devices the Button Up / Down events keep firing even if the user doesn't move his finger.
If so , any draw back if I use small panels to replace using buttons (e.g. 20 buttons) on the same layout?
 
Upvote 0

rleiman

Well-Known Member
Licensed User
Longtime User
If so , any draw back if I use small panels to replace using buttons (e.g. 20 buttons) on the same layout?

Hi aleung,

My app used to have 2 buttons. I replaced those with 2 panels the same size. I just used the images for each panel background where were the ones I used on each button.

The sample klaus posted was really helpful in showing me how to handle the needed events. I use start a timer when the button is down and stop it when the button is up.
 
Upvote 0
Top