How do I get the object under the mouse when mouseRelease?
J. Landman Gay
jacque at hyperactivesw.com
Mon Apr 30 14:30:53 EDT 2007
Tiemo Hollmann TB wrote:
> Hello again,
>
> sorry, another newbee question
>
> I want to realize my own drag and drop handlers with mouseDown,
> mouseRelease, etc. On mouseDown I get the underneath lying object with
> mousecontrol. How do I get the name of an object (image) under the mouse
> when releasing it, because mousecontrol is still the mouseDown object when
> releasing? I created a workaround with a repeat loop on mouseRelease to test
> for every image on my card, if the mouseloc is in the rectangle of image x.
> But I think there must be a more sophisticated and perfomant way in
> revolution?
Is there a reason you can't use the built-in drag and drop functions?
Those will tell you what you want to know.
If you do have to use your own handlers, then you could scan all the
objects when the mouse goes up:
on mouseUp
put the mouseloc into tXY
repeat with x = 1 to the number of controls
if tXY is within the rect of control x then
-- do what you need
exit repeat
end if
end repeat
end mouseUp
But this way can be time-consuming if you have many controls. The
built-in commands and functions are much better.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list