Page 1 of 1
How to keep track of grouped objects?
Posted: Thu Jul 29, 2010 4:07 pm
by Eric
Is there any way I can tell what - if any - named group(s) a particular object/control is a member of?
Or, to use an alternative approach, is there any way I can list the member objects of a particular group?
Re: How to keep track of grouped objects?
Posted: Thu Jul 29, 2010 4:39 pm
by Dixie
Hi Eric...
You can try this...
Code: Select all
repeat with count = 1 to the number of controls of group 1
put the long name of control count of group 1 & cr after theList
end repeat
put theList
be well
Dixie
Re: How to keep track of grouped objects?
Posted: Thu Jul 29, 2010 4:40 pm
by Klaus
Hi Eric,
you could use a repeat loop like this to get a list of all elements of a group:
Code: Select all
...
repeat with i = 1 to the num of controls of grp "Your named group here"
put the name of control i of grp "Your named group here" & CR after tGroupList
end repeat
delete char -1 of tGroupList
## Get rid of trailing CR
...
This will give you a list like this, the first "word" is the TYPE of control, the second "word" = the short name of that element in quotes:
field "Name of field"
button "my button"
etc...
Hope that helps
Best
Klaus
Re: How to keep track of grouped objects?
Posted: Fri Jul 30, 2010 12:31 am
by Curry
also see: owner
Re: How to keep track of grouped objects?
Posted: Fri Jul 30, 2010 8:50 am
by Mark
Hi Eric,
You might like
the scripts.
put the objects of grp x
get the objects of stack y
Best,
Mark
Re: How to keep track of grouped objects?
Posted: Fri Jul 30, 2010 4:38 pm
by Eric
Thanks, guys.
All great solutions.
I think "the owner of" was the most ideal for my purposes.
That said, it didn't work perfectly with my nested groups. Strangely, the top group was acknowledged by just one of its two subgroups, and ignored by the other (which instead identified the current card as its owner) - perhaps because the top group is set as a background?
put the objects of grp "Background" produced an odd result.
It didn't trigger any error - but always returned empty!
Re: How to keep track of grouped objects?
Posted: Fri Jul 30, 2010 4:44 pm
by Mark
Eric,
You need to copy those scripts from the website into your mainstack/library stack/backscript.
Mark
Re: How to keep track of grouped objects?
Posted: Sat Jul 31, 2010 2:51 am
by Curry
You're welcome! Owner is pretty handy and you can also get the owner of the owner of, etc.
Re: How to keep track of grouped objects?
Posted: Sat Jul 31, 2010 11:49 am
by Eric
Oh, I see.
Got it.
Thanks, Mark.