Disabling the mouse

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
ac11ca
Posts: 41
Joined: Sun Mar 16, 2008 2:22 am

Disabling the mouse

Post by ac11ca » Wed Feb 11, 2009 8:05 am

Hi, I cant find the correct code to disable the mouse, or more accurately, the users ability to click the mouse. My code is something like:

Code: Select all

on mouseDown
doSomething
add 1 to gCount
if gCount = 10 then
doSomethingElse
go to next card
else
--pass
end if
The problem here is that users often click very fast and the last click carries over to the next card and is causing problems. Ideally I would like to add something like:

Code: Select all

on mouseDown
doSomething
add 1 to gCount
if gCount = 10 then
DISABLE MOUSE
doSomethingElse
go to next card
else
--pass
end if
Thanks for any help,
Adrian

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Feb 11, 2009 8:54 am

I don't know if this will help, but this thread starts to get onto the subject in my post http://forums.runrev.com/phpBB2/viewtop ... =9573#9573 (partway down the thread) in which I commented about trying to prevent "legacy" clicks from a previous card affecting the next one.
There's a link in that thread to some other button clicking behaviour, perhaps related.

Basically - it seems to me - there's fundamental difference in the way the engine processes mouseDown and mouseUp. If you change your handlers to use mouseUp instead of mouseDown, are the results more consistent?

gmccarthy
Posts: 62
Joined: Sat Feb 17, 2007 4:56 am

RE: Disabling the mouse

Post by gmccarthy » Wed Feb 11, 2009 11:52 am

Have you tried using flushevents? Check it out in the dictionary.
I'm sure this will do what you want.

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Feb 11, 2009 12:30 pm

Important hint, since I have seen this often on this forum lately:
a mouseclick = MouseUp
a mouseclick <> MouseDown

Ever made your mind up while the mousebutton was still pressed (down)
and moved the pressed mouse off from a button? I bet you did!
(Are you sure you want to erase your harddisk? ;-))

And now imagine the developer had implemented a "mousedown" to trigger
the action(s) instead of a "mouseup", you'd be extremely pi..ed off :-D

Spread the word, thanks!

Paul D
Posts: 116
Joined: Mon May 21, 2007 6:58 pm

Post by Paul D » Thu Feb 12, 2009 4:59 pm

could also try to disable the object that triggers the script until you are done with whatever then enable it when its ready for another mouseup.

ac11ca
Posts: 41
Joined: Sun Mar 16, 2008 2:22 am

Post by ac11ca » Thu Feb 12, 2009 10:19 pm

Thanks guys - good tips and thoughts all round. In this case Ive made use of the flushevents command.

Cheers,
Adrian

Post Reply