messages to buttons when the mouse is already down
Scott Rossi
scott at tactilemedia.com
Mon Jan 21 18:29:00 EST 2002
On Monday, January 21, 2002, at 02:50 PM, Michael J. Lew wrote:
> I would like to track the movement of the mouse through an array of
> buttons by hilighting each button that the mouse (button already down)
> passes over. However, the mouseEnter, mouseMove, mouseWithin messages
> are only sent to the first button because that button receives the
> mouseDown event and is the target. Similarly the mouseControl function
> (yes, it took me a couple of tries to notice that it was a function and
> not a message!) only returns the target.
Not sure exactly what your difficulty is here. The mouseEnter and
mouseLeave messages should be enough to do what you want. If you know
the names of all the buttons you want to respond and they're unique, you
could do something like the following:
First, establish a custom property stack to store the names of all your
buttons:
set the uTrackButtonNames of this stack to "buttonName1, buttonName2,
buttonName3" etc.
Then place the following in the stack script:
on mouseEnter
if word 1 of the name of the target is not "button" then exit
mouseEnter
if short name of the target is in the uTrackButtonNames of this stack
then \
set the hilite of the target to true
end mouseEnter
on mouseLeave
if word 1 of the name of the target is not "button" then exit
mouseLeave
if short name of the target is in the uTrackButtonNames of this stack
then \
set the hilite of the target to false
end mouseLeave
These handlers will only respond to button mouse events and even then
only when the button names are part of the master name list stored in
the custom property. Also, if you want to update which buttons respond
and which don't, simply update the master list.
Regards,
Scott Rossi
Creative Director, Tactile Media
More information about the use-livecode
mailing list