Jump to content
AlanScottAgain

Long Tap triggers tap

Recommended Posts

Hi,

I couldn't find any information this.

When I capture a long tap  -  I get the tap event fired as well.

 

Is this right?

 

I want to set a value on tap and clear it on long tap.  Its messy at the moment with the events being called in sequence.

 

Thanks

Alan

 

 

 

Share this post


Link to post

Many thanks

I was aware of the demos 😉
And am doing similar.

It seems that if I use ShowMessage to display the event action, something must happen with the message queue as I get multiple showmesage popups.

if I just update a label - all works fine.

this simple code generates multiple popups for me?

 


procedure TForm1.FormGesture(Sender: TObject; const EventInfo: TGestureEventInfo; var Handled: Boolean);
begin
if EventInfo.GestureID = igiLongTap  then
begin
Label1.Text:= 'Long Tap';

TDialogService.MessageDialog('Did you mean to long press',TMsgDlgType.mtInformation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], TMsgDlgBtn.mbYes,0,
      procedure(const AResult: TModalResult)
      begin
        if AResult = mrYes then
           ShowMessage('YES')
        else
          ShowMessage('you have cancel the operation');
      end
    );
end;
end;

procedure TForm1.FormTap(Sender: TObject; const Point: TPointF);
begin
Label1.Text:= 'Tap';
end;

 

 

 

Share this post


Link to post

@AlanScottAgain   you can test "how many time a "event" is called, then, you can know why this behaviour...

 

Quote

var

   MyCounter:integer;

...

now just increment it while showing your label with new value in "MyCounter", and see how many time this event is called!

 

Edited by programmerdelphi2k

Share this post


Link to post

Thanks,

I tried the counter but it says its only being called once.

 

However the dialogs still pop up more than once.

 

There is no other code in the Test project, Just the onTap and onGesture.

 

If I had hair I'd be pulling it out 😞

I have attached  a small video.

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

×