Jump to content
Eric Grange

Touchpad two fingers pan in a VCL app ?

Recommended Posts

Hi,

I have been trying to get a VCL application to react to touchpad two fingers pan, with absolutely no success 😕
But two finger pan does not seem to trigger anything AFAICT.

Simple scrolling (tap and hold) and touchpad pinch-to-zoom get translated (by Windows) into scroll events just fine.

Though it's not a screen touch, I tried OnGesture as well, with or with a touch manager, no success there.

The two finger pan works just fine on other applications on the same laptop (Chrome, image editors, etc.), so it's a bit like the VCL application is missing a flag or something is eating/disabling the pan functionality.

Am I missing something obvious and Anyone got it working ? This is a Delphi 10.3 app.

Share this post


Link to post

Have you dropped a TGestureManager onto the form and wire it to the forms Touch.GestureManager property?

In addition, the Touch.InteractiveGestures.igPan musst be active (which is by default).

Share this post


Link to post

Yes, I tried with or without the TGestureManager though the doc (https://docwiki.embarcadero.com/RADStudio/Sydney/en/Gesturing_Overview) says it shouldn't be there for interactive gestures, if there is no TGestureManager, I get zero OnGesture events (I only get windows conversions to scroll or mouse wheel events)

The Microsoft doc (https://learn.microsoft.com/en-us/windows/win32/wintouch/windows-touch-gestures-overview) states that WM_HSCROLL & WM_VSCROLL should be received for pan, but I do not seem to get them.

Edited by Eric Grange

Share this post


Link to post

Ok solved it! For reference the relevant Microsoft is actually this one Windows 8 touchpad gesture implementation guide

While the MS doc mentions Windows 8 and says it's obsolete, it is still very much what happens in Windows 10.

The touchpad pan gets mapped to WM_MOUSEWHEEL (vertical) and WM_MOUSEHWHEEL (horizontal), that last one is not exposed in the VCL as of Delphi 10.3
The pan translations come in the WheelDelta field, so they can be easily mapped to whatever you need.
 

  • Thanks 1

Share this post


Link to post

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

×