Page 1 of 1

No "GestureDown" event -- how do I detect one finger down?

Posted: Sat Oct 26, 2024 5:19 pm
by Rav
I'm starting to work with the "Gesture" events when accessing my apps from a touchscreen device such as an iPhone or iPad. These devices don't normally have a mouse attached, and I need things to work without a mouse. I'm finding the Gesture events extremely useful in this case, but there is one thing that I think is missing, unless I just haven't figured out how to access it. I want to detect when a user touches ONE finger on an object but HAS NOT YET started to drag that finger. The GesturePan event works great once the user starts to drag their finger, but it does not generate any event until they start that dragging. I thought that perhaps I could accomplish what I need by intercepting an onMouseDown event, which when using an actual mouse fires when the mouse button is clicked DOWN. Unfortunately, from my testing, I do get a MouseDown event when the user is using their finger but it only fires when they left their finger UP off the screen, not when they press it down.

None of the other Gesture events will give me what I want. GesturePressAndTap only fires when a second finger is tapped. GestureRotate requires two fingers, and in any event is used to detect rotation, not pressing. GestureTwoFingerTap obviously requires two fingers. GestureZoom also requires two fingers.

So: Is there any way I can detect when a user presses one finger down on a touchscreen before they start dragging it? Thanks for any thoughts. / Rav

Re: No "GestureDown" event -- how do I detect one finger dow

Posted: Thu Oct 31, 2024 11:58 am
by Vince|Dyalog
Hi Rav,

I have asked my colleagues about this.

We do not think this is currently possible. If I hear otherwise, I will let you know.

I have logged this as an RFE.

Regards,

Vince

Re: No "GestureDown" event -- how do I detect one finger dow

Posted: Thu Oct 31, 2024 4:14 pm
by Rav
Vince|Dyalog wrote:We do not think this is currently possible. If I hear otherwise, I will let you know.
I have logged this as an RFE.

Regards,
Vince
Thanks, Vince. I wrote a test program that, in a round-about and CPU-intensive way, gives me what I need. First, I used the Win32 PeekMessage function to find out what Windows messages were being queued up when pressing one finger down, dragging it, and lifting it up. Among the many messages I found three in particular:

WM_POINTERENTER - The user has just pressed one finger down.

WM_POINTERUPDATE - The user is continuing to hold their finger down or they are dragging it.

WM_POINTERUP - The user raised their finger.

Next, I wrote the test program that looks for these messages. Since Dyalog doesn't have Events for them, I had to continue to use PeekMessage to look for them. Unfortunately, that's polling, since I never know when one of those messages will come into the message queue. Worse, since of course Dyalog is processing ALL queued messages (even though it may ignore them and even though it doesn't inform me about all of them, including these three), these messages only remain in the queue for a very small fraction of a second before they are dispatched to their destination window, in fact milliseconds. So I have a Timer that is firing every 1 millisecond, and then within that Timer callback I loop for 20 milliseconds looking for any one of those messages. If I get one of those messages I return immediately from the Timer callback and inform the calling program. If I don't get one I return after 20 milliseconds of polling. That's why I said above that this is very CPU-intensive. But it's just a proof of concept. The point is, if someday Dyalog provides events for use by APL apps for those three messages, then I wouldn't have to poll for them and would get them as callbacks like any other event. There are also other WM_POINTER___ messages which may be useful to have events exposed for.

Perhaps my findings will be of use to Dyalog. At any rate, thanks for logging this as an RFE.

/ Rav