Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Using gesture in VCL, prevent OnClick


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Jul 5, 2017 12:38 PM Last Post By: Remy Lebeau (Te...
Mikael Lenfors

Posts: 99
Registered: 3/6/01
Using gesture in VCL, prevent OnClick  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 4, 2017 5:43 AM
Hello!

We started using Gestures in one of our Windows VCL Projects. We started with a very simple function where you can swipe left right in a PageControl.
We implemented this with a GuestureManager assigned to the Form and some Guesture events for swipe left/right,
This works just fine except for one anoying thing. Whereever you start the swipe on the form the swipe actions are triggered, works just fine,
But if you accidently start the swipe on a Control placed on the form there is also a OnClick event fired for that Control!
Can this be prevented? If you just click on a Control.of cource the OnClick should fire, but if the click turns out to be a swipe the OnClick should be prevented...
I searched the problem and one solution was to use the Tap event instead of the OnClick, but this only applies to Firemonkey I suppose?

Any ideas?

Best regards, Mikael
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Using gesture in VCL, prevent OnClick  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 5, 2017 12:38 PM   in response to: Mikael Lenfors in response to: Mikael Lenfors
Mikael Lenfors wrote:

Whereever you start the swipe on the form the swipe actions are
triggered, works just fine, But if you accidently start the swipe
on a Control placed on the form there is also a OnClick event fired
for that Control! Can this be prevented? If you just click on a
Control.of cource the OnClick should fire, but if the click turns out
to be a swipe the OnClick should be prevented...

You will likely have to use a short timer to differentiate. In the
OnClick event, start a timer. If the swipe is detected, stop the timer
and perform the swipe action. If the timer elapses, perform the click
action instead.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02