0

In my application I have used the OnMouseDown and OnMouseUp to create a windows desktop style selection box. OnMouseDown I create a semi transparent blue window and get rid of it in the OnMouseUp.

The result is a nice transparent box to indicate the selection area in a grid control.

The problem is that on a touch screen the mouse down and up events do not get called when you press and drag like you would with a mouse. The up/down events are called if you simply press in one spot but not if you touch and drag.

My current thinking is to use WM_TOUCH messages and capture the touch and drag myself but I am hoping there is a better way or something I have missed. Any suggestions?

(This is a VCL app under XE5)

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
Martin
  • 815
  • 8
  • 21
  • I cannot reproduce this. Can you please elaborate on which Windows version you're using and if it's a multitouch or "mouse emulation" driver you're using. *"The problem is that on a touch screen the mouse down and up events do not get called when you press and drag like you would with a mouse"* It's not that they're not triggered at all, they're just triggered differently: If you just tap somewhere then they're both not triggered until you lift your finger. If you tap, hold and then start dragging somewhere, they're triggered like on a normal mouse. Could you please provide a minimal example? – Günther the Beautiful Jan 06 '14 at 10:03
  • I have tried with 2 different (generation) DELL touch screens with the same result. The main monitor I am testing with is the S2340T mutlitouch. Interestingly touch and drag works on the windows desktop but not in my app. – Martin Jan 06 '14 at 20:51
  • That surely is interesting but not quite helpful. I can do a "Touch and drag to paint rectangles" perfectly fine on a VCL app with XE5. You need to show some code or at least elaborate on in which order you expect the `onMouseXXX` events to come in and in which order they're actually triggered. What kind of grid control is it? If it's a descendant `TScrollingWinControl` then "Touch and drag" might actually try to scroll it. – Günther the Beautiful Jan 06 '14 at 22:17
  • I thin you are correct. I just tried a different control and it appears to work. Im using the TMS Grid component so it must be intercepting the event. – Martin Jan 06 '14 at 23:08
  • Confirmed. The TMS grid control was intercepting the touch event. – Martin Jan 07 '14 at 00:05

0 Answers0