Jump to content

Recommended Posts

  • Moderators

I needed to catch mobile double-tap events. 

There is no such thing as a double-tap event, therefore I used the code below to translate double taps (rapid consecutive touchstarts) into double-clicks. Which works fine.

var window external 'window': variant;
var Twice : boolean := false;
procedure tapHandler(e: variant);

implementation

procedure tapHandler(e: variant);
begin
  //replaces double taps (consecutive touchstart events) into dblclicks
  if not Twice then begin
    Twice := true;
    Window.setTimeout( procedure() begin Twice := false; end, 300 );
  end else begin
    e.preventDefault();
    var event: variant;
    asm @event = new Event('dblclick'); end;
    e.target.dispatchEvent(event);
  end;
end;

//usage: replace double taps (consecutive touchstart events) into dblclicks
<element>.handle.addEventListener('touchstart', procedure(e:variant) begin tapHandler(e); end);

 

Question : does the regular rtl event manager cover double-taps ?

 

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...