Mouse messages while down

Dick Kriesel dick.kriesel at mail.com
Sun Mar 18 04:08:41 EDT 2007


On 3/18/07 12:12 AM, "Sarah Reichelt" <sarah.reichelt at gmail.com> wrote:

<snip>
> But it still leaves me having to check the
> location all the time to see whether it is inside one of my 400
> buttons.
<snip/>

Hi, Sarah.  You could build an array using points as keys, so that when you
look up any x,y pair you get the control id.  If that would use too much
memory, you could build two arrays, one for x and one for y.  If the x array
identifies for each value of x the controls that share that value of x, any
the y array is analogous, then intersecting of the values for the current x
with the values for the current y would yield the current control id. For
buttons in a simple arrangement, you could probably use even less memory.
Whichever design you choose, you could store the arrays as custom property
sets of the card, so your user could never perceive the delay even for a
huge number of buttons.  Of course you'd need to rebuild the arrays if you
move a button.  Do you feel the need the speed enough to write the code?

-- Dick





More information about the use-livecode mailing list