Group buttons?
Cubist at aol.com
Cubist at aol.com
Tue Nov 28 18:26:14 EST 2006
In a message dated 11/28/06 10:05:00 AM, LunchnMeets at aol.com writes:
> How do I group some square style buttons so that only one can be hilited at
> a
> time?
> This sounds, to me, like you want to have a bunch of square thingies that
*behave* like radiobutton-type buttons, even tho they don't have that funky
filled/unfilled circle off to the left. Presuming I'm right about what you
want, one solution that might serve your needs might be like so:
First: Make your buttons. Since you're doing nonstandard stuff with the
hilites, you'll have to make sure that autoHilite is turned off for *all* of
them. You'll also want to make sure each button has a unique name -- no
duplicate names here, thanks.
Second: Group all of your buttons.
Third: Make sure that each button in the group has a mouseUp handler.
Make sure that each button's mouseUp handler includes the line "RadioLite (the
short name of me)"
Fourth: Put this handler into the script of the group that contains all
your buttons:
on RadioLite (TheClickedButton)
repeat with K1 = 1 to the number of buttons in me
set the hilite of button K1 to (the short name of button K1 =
TheClickedButton)
end repeat
end RadioLite
Note that I haven't actually tested this code. I *think* the "number of
buttons in me" bit should work, since the "me" refers to the object that has
the script -- which is, in this case, the group that contains your buttons. The
"set the hilite" line, however, will work and is the key to the whole thing.
The hilite is a Boolean value, i.e., it's either "true" or "false"; this means
you can set a button's hilite to anything, as long as that thing *is* a
Boolean value. Thus, since TheClickedButton is the short name of the button that was
actually clicked on, "the short name of button K1 = TheClickedButton" will be
"false" for every button that's *not* the button that was clicked on, right?
Thus, all not-clicked-on buttons will be unhilited.
Even if I've messed up, tho, I believe this solution should at least
point the way to a viable solution for you.
--
ANTHRO -- http://anthrozine.com
It's furry. It's the *good* stuff.
More information about the use-livecode
mailing list