Mouse messages while down

Sarah Reichelt sarah.reichelt at gmail.com
Sun Mar 18 21:03:33 EDT 2007


> 400 individual buttons is bad design. Draw a grid and use a mouseDown
> handler if you want to store the clicked location. Use the
> mouseRelease handler to get the new location. Calculate in which
> rectangle the new mouseLoc is, without a repeat loop. I am sure you
> can do this.

It's not something I would normally do, but in this particular case,
it works very well and allows great flexibility in selection and
display. However the buttons are all non-overlapping and in a
rectangular grid - not completely regular but nearly so. While
checking each rect against the mouse loc works fine on my computer, to
allow for slower ones I should put the effort into an algorithm to
calculate the correct button instead.

Since I originally asked my question, I have progressed to needing to
track the button underneath the mouse at all times while the mouse is
down, so Jacque's technique is working really well for that. Unlike
Jerry's Galaxy scripts, I only need to do this checking while the
mouse is down, so it doesn't have to be able to operate while other
things are happening.

Cheers,
Sarah



More information about the use-livecode mailing list