How to keep track of grouped objects?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
How to keep track of grouped objects?
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?
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?
Hi Eric...
You can try this...
be well
Dixie
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
Dixie
Re: How to keep track of grouped objects?
Hi Eric,
you could use a repeat loop like this to get a list of all elements of a group:
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
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
...
field "Name of field"
button "my button"
etc...
Hope that helps
Best
Klaus
Re: How to keep track of grouped objects?
also see: owner
Best wishes,
Curry Kenworthy
LiveCode Development, Training & Consulting
http://livecodeconsulting.com/
WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/
Curry Kenworthy
LiveCode Development, Training & Consulting
http://livecodeconsulting.com/
WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/
Re: How to keep track of grouped objects?
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: How to keep track of grouped objects?
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!
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?
Eric,
You need to copy those scripts from the website into your mainstack/library stack/backscript.
Mark
You need to copy those scripts from the website into your mainstack/library stack/backscript.
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: How to keep track of grouped objects?
You're welcome! Owner is pretty handy and you can also get the owner of the owner of, etc.
Best wishes,
Curry Kenworthy
LiveCode Development, Training & Consulting
http://livecodeconsulting.com/
WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/
Curry Kenworthy
LiveCode Development, Training & Consulting
http://livecodeconsulting.com/
WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/
Re: How to keep track of grouped objects?
Oh, I see.
Got it.
Thanks, Mark.
Got it.
Thanks, Mark.