messages to buttons when the mouse is already down

David Vaughan drvaughan55 at mac.com
Tue Jan 22 01:40:00 EST 2002


Ken wrote: "I posted what should be the right solution. Check it out." 
referring to
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

Er...no it isn't Ken. I tested it. I think this is what you meant (card 
scripts)

on mouseEnter
   if word 1 of the target = "button" then
     set the hilite of the target to true
   end if
end mouseEnter

on mouseLeave
   if word 1 of the target = "button" then
     set the hilite of the target to false
   end if
end mouseLeave

Note the button test because mouseEnter/Leave messages will also be sent 
for fields and for the card. No repeat loop is needed.  Action handlers 
would presumably be button-specific, on mouseUp, or relatively generic 
in the card script with "the target" again able to identify exactly 
which button was clicked.

cheers
David

On Tuesday, January 22, 2002, at 05:04 , Ken Norris (dialup) wrote:

> on 1/21/02 4:40 PM, Philip Usher at usher at iqcisp.com wrote:
>
>> on 1/21/02 5:34 PM, "Michael J. Lew" <michaell at unimelb.edu.au> wrote:
>>
>>> How can I get the other buttons to hilight without requiring the user
>>> to click each individually?
>>
>> Michael, try this in the card script
>>
>> on mouseDown
>> repeat while the mouse is down
>> get the mouseLoc
>> repeat with n = 1 to the number of btns
>> if it is within the rect of btn n then
>> set the hilite of btn n to true
>> else
>> set the hilite of btn n to false
>> end if
>> end repeat
>> end repeat
>> end mouseDown
>>
>> Cheers,  Philip
> ------------
> When Michael says he has an 'array' of buttons, I assume he means a LOT 
> of
> buttons. Your handler will work, uh, sort of, but if there are, say, 100
> buttons, it'll have to go through them all to check for a hit before it
> makes its decision, so the thing'll react way slow.
>
> He doesn't need an idle handler to poll the mouseloc, either.
>
> I posted what should be the right solution. Check it out.
>
> Best regards,
> Ken N.
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2514 bytes
Desc: not available
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20020122/96af6303/attachment.bin>


More information about the use-livecode mailing list