Different behaviour touch mouse vs Touchscreen - simple canvas control


I have created an very simple container control that works as an button, it contains an rounded rectangle and a label. Nothing more.
The control has 2 events - to ‘simulate the on click behaviour’

  • MouseDown - return True
  • MouseUp - = Onclick behaviour

This works perfect on :

  • Osx
  • Windows if I’m using a mouse

But when I try this on my Surface Pro with fingers - touchscreen, this doesn’t work. It only works when I double click on the control with my fingers… (when I’m using a mouse or the touchpad, then is works ok…)
Any idea’s ?

Regards !

Do you have the same issue using an actual button?

Using a container control as button is probably overcomplex.

I have been using a Canvas subclass as button for a while, and it works flawlessly with Windows touch.

What you need is the Action event handler that will capture a Click (Touch) event.

Tnx for the info…
The normal ‘native’ buttons works ok… I’ll try some scenario’s out.

On most of my Windows apps, I found that the BevelButton conforms to Windows Design Guidelines and it works perfectly with touch. Sometimes reinventing the wheel is not a good idea…

BTW it would be a good idea to post in the Windows channel, next time…

Hi, my fault PEBKAC :slight_smile: … the button I have created had some logic to block fast clicking… and with touch the interval is much slower than with the mouse… Problem solved

You can block fast clicking as well on a standard button by playing with KeyDown and return True. Something like the Web auto-disable seems fairly easy to do with a timer to re enable the button.