Stopping Repeated clicks

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Stopping Repeated clicks

Post by maxs » Sat Mar 23, 2013 10:47 pm

Hi All,

OK if a user accidentally clicks on a button 3 or 4 times, I want the script to execute only once. Once the scripts has been executed, then the user can click again.

OK I tried using this script at the beginning and end of a mouseup command, but it did not work.

if the pendingmessages is not empty
then
exit to top
end if

Any ideas? I've had this problem for years. I feel like I'm the only person in the history of programming who sees this as a problem.

Max

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Stopping Repeated clicks

Post by bn » Sat Mar 23, 2013 11:24 pm

Hi Max,

try

Code: Select all

 get flushevents("mouseUp")
look at flushEvents in the dictionary.

Kind regards
Bernd

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Stopping Repeated clicks

Post by Dixie » Sat Mar 23, 2013 11:26 pm

maxs...

put a button and a fld on a card... put the followinf script into the button..

Code: Select all

local ImBusy

on mouseUp
   if ImBusy = 1 then exit mouseUp
   put empty into fld 1
   DoTheStuff
end mouseUp

on DoTheStuff
   put 1 into ImBusy
   repeat with count = 1 to 4
      wait 2 seconds
      put count & space after fld 1
   end repeat
   get flushEvents("mouseUp")
   put 0 into ImBusy
   beep
end DoTheStuff
Does that do what you wish ?

Dixie

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Stopping Repeated clicks

Post by maxs » Sun Mar 24, 2013 2:35 am

Thanks Dixie, and Bernd,

This really does the trick. Thank you so much.

Max

Post Reply