How do I determine objects in a group?
Zac Elston
zelston at aol.com
Fri Feb 8 17:08:00 EST 2002
I think I wasn't clear on my intentions.
I am currently using circle graphics as choices in a selection.
I know...why would I use graphics instead of buttons? Buttons are for
pressing, not graphics..but I need graphics.
The user can select only one circle from a group of circles. I use a
backgroundcolor change to indicate selection. So basically I have to change
a property of an object within a group while resetting the same property of
all the other objects in that group.
I can write a script for each circle
On mouseup
Put name into varX
Set the backgroundcolor of graphic 1 to red
Set the backgroundcolor of graphic 2 to gray
Set the backgroundcolor of graphic 3 to gray
End mouseup
And change the red to match the graphic being pressed.
But that seems tedious.
Using
Set the backgroundcolor of group 1 to gray
Set the backgroundcolor of target to red
Doesn't work because once red, the graphic will not change to gray when
another circle is pressed.
I was hoping there was a slick way to determine this like writing a loop in
the parent that allows me to bypass writing an action for my ..lets
see..30,000 circles I will end up with.
Repeate for each object in group
Set the backgroundcolor of object to gray
end
Set the backgroundcolor of target to red
Or even if I use buttons, using hilitedButton wants the button id within the
group. How can I determine that from outside the group? I want to pass a
variable instead of a number.
Can I reverse lookup the group members? I can get the group name from the
long name of the target but I don't seem to be able to determine what id
within the group that target has.
So is there an answer to the question:
How to I determine objects in a group?
Thanks
-zac
More information about the use-livecode
mailing list