Mouse down hold so as to repeat handler...

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
gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Mouse down hold so as to repeat handler...

Post by gyroscope » Thu Sep 04, 2008 12:15 pm

Hi, I've a problemette I can't solve:

Group of images + a button. Script for button:

Code: Select all

on mouseDown
    put the location of group id 1009 into tMoo
    put item 1 of tMoo into tMoveLR
    put item 2 of tMoo into tFix
    move group id 1009 to (tMoveLR + 88), tFix in 5 ticks  
end mouseDown
That's works fine but I would also want it that if the user holds down the mouse button for half a second or more, for it to continually move (with a very slight pause in between, each time, then stop nicely with a mouseUp). I would think that the mouse needs to be polled (is that the correct term?) and if it's being held down for more than half a second, the above code is run as a repeat loop, I guess.

But how to script that the user is holding the mouse down for half a second or more and so for the repeat loop to run?

Any answers to this appreciated, thanks.

:)

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Thu Sep 04, 2008 4:10 pm

Hi, just worked it out; seems to behave as I want.

I've used

Code: Select all

repeat while the mouse is down
before the code above, and

Code: Select all

wait 5 ticks
after.

If anyone knows any refinements I'd really like to read them, thanks!

:)

Post Reply