messages to buttons when the mouse is already down

Ken Norris (dialup) pixelbird at interisland.net
Tue Jan 22 00:41:00 EST 2002


on 1/21/02 2:50 PM, Michael J. Lew at michaell at unimelb.edu.au 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.
> 
> How can I get the other buttons to hilight without requiring the user
> to click each individually?
----------
Hi Michael,

You can replace 'the target' with 'me' if you want each button to have its
own script, or leave it like it is.

on mouseEnter -- you can put the rest of this in an offscreen handler
  repeat until the mouseClick
    if the mouseLoc is within the rect of the target then
      set the hilite of the target to true
  else
      set the hilite of the target to false
  end if
  -- do your thing here when the mouse is released
end mouseEnter

...should work.

HTH and best regards,
Ken N.





More information about the use-livecode mailing list