graphic radio buttons

Ken Norris (dialup) pixelbird at interisland.net
Sun Feb 10 18:48:01 EST 2002


on 2/10/02 12:11 AM, Mark Mitchell at mark_mitchell at kmug.org wrote:

> use-revolution at lists.runrev.com writes:
> I don't have buttons, I have graphics.  Like a square or circle or polygon.
> Any ideas?
> 
> I do this sort of thing all the time.  Every selection just DEselects all
> objects in the
> group prior to selecting the clicked on object
> 
> on mouseUp
> repeat with i = XX to YY
> set the selected of object i to false
> end repeat
> set the selected of me to true
> end mouseUp
----------
This works just fine, of course, for selecting the object. That is, until
you have, what was it?...30,000 of them. Then the loop will have the user
getting pretty long in the tooth before the clicked object gets selected.

You can, however, store the ID of the last object clicked, and just deselect
it when you select the next one. There is no loop involved. You can even use
one offscreen handler (subroutine) to do it, as well as whatever other
operations happen, even ones specific to the ID of the object, which is what
radio buttons are generally used for.

How about this:

on mouseUp
  RBbehavior
end mouseUp

on RBbehavior
  if i is not empty then
    set the selected of graphic ID i to false
    resetStuff -- maybe to graphic ID i?
  end if
  put the ID of the target into i
  set the selected of the target to true
  doStuff -- maybe to the target?
end RBbehavior

Best regards,
Ken N.



  
  

  





More information about the use-livecode mailing list