Mouse messages while down
Ken Ray
kray at sonsothunder.com
Sun Mar 18 20:50:00 EDT 2007
On Sat, 17 Mar 2007 19:50:40 -0700, Jim Ault wrote:
>> The problem is that no other messages seem to be sent while the mouse
>> is down (mouseEnter, mouseLeave, mouseStillDown etc). I can detect
>> mouseRelease but "the target" is my original button so it doesn't tell
>> me where the mouse is now. Checking "the mouseControl" in the
>> mouseRelease handler also gives the original target.
>>
>> It's looking as if I may have to do some continuous polling, but I
>> know that is generally frowned upon, so I would be grateful for any
>> other suggestions.
Here's what worked for me (put this in the card script):
global gDragging
on mouseDown
if word 1 of the name of the target is "button" then
put true into gDragging
else
pass mouseDown
end if
end mouseDown
on mouseMove
if gDragging and the mouse is up then
send "GetTarget" to me in 20 milliseconds
put false into gDragging
end if
pass mouseMove
end mouseMove
on GetTarget
try
put the short name of the mouseControl -- or anything else you
want to do with it
catch tError
-- it would get here if you released over the card itself
end try
end GetTarget
Hope this works for you...
Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
More information about the use-livecode
mailing list