Page 1 of 1

Double-click Button on Android Touch Screen

Posted: Thu Aug 09, 2018 4:38 pm
by marra
Hi,

I have a single button when pressed should add or subtract from a score.
When the button is clicked, it Add 1 to the total, if the user makes a mistake, the user must have the option to double-click or long-click the button to Subtract 1 from the Total.
I have the below code that works in the IDE (Windows), however on Android (touch Screen) the "mouseClick" is not registered.

I also looked at touchStart/End etc, with no success. How can I solve this?

on mouseUp
wait 20 ticks
if the mouseClick then
subtract 1 from fld "TotalScore"
else
add 1 to fld "TotalScore"
end if
end mouseUp


Regards
Marra

Re: Double-click Button on Android Touch Screen

Posted: Thu Aug 09, 2018 6:41 pm
by jmburnod
Hi Marra,
the user must have the option to double-click or long-click the button to Subtract 1 from the Total.
This should work:

Code: Select all

local sStartTime
on mousedown
   put the milliseconds into sStartTime
end mousedown

on mouseUp
   if  the milliseconds > (sStartTime + 200) then
      subtract 1 from fld "TotalScore"
      exit mouseUp
   else
      add 1 to fld "TotalScore"
   end if
end mouseUp
Best regards
Jean-Marc

Re: Double-click Button on Android Touch Screen

Posted: Thu Aug 09, 2018 6:55 pm
by marra
Hi Jean-Marc,

Works perfectly, thank you so much! :D

BR
Marra