Recursive Object Function?
Peter M. Brigham, MD
pmbrig at gmail.com
Sat Aug 27 07:56:47 EDT 2011
I guess you have probably thought of using a recursive function, but if not, then here's an example. I use the following in one of my routines. This finds which of 2 "master backgrounds" a control is part of -- each of the 2 bg's contains a large number of controls and groups and nested groups. At one point, when the user clicks on a control I need to know which master background that control belongs to.
function masterBG theObject
put the long id of the owner of theObject into onr
if word 1 of onr = "card" then
return theObject
else
return masterBG(onr)
end if
end masterBG
This doesn't do what you want, but the principle of using recursion on the long id is probably what you will have to do. Sounds like a useful utility handler -- when you get it figured out, I'd love to see it.
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
On Aug 27, 2011, at 1:39 AM, DunbarX at aol.com wrote:
> I think you should be able to use the "owner" property in a repeat loop, mapping all the controls on a card to a group if they are, er, grouped, and to the card if they are not.
>
> Craig Newman
> -------------------
> Bob Sneidar <bobs at twft.com> wrote
>
> It also comes to mind that the application browser does this sort of thing.
> Also, doesn't jerrys remo do something like this?
>
> Sent from my iPad
> -------------------
> Scott Rossi <scott at tactilemedia.com> wrote:
>
>> Anyone have a script that will list all controls/subgroups of a group,
>> organized by groups? Ex:
>>
>> groupA
>> objA1
>> groupB
>> objB1
>> objB2
>> groupC
>> objC1
>> objC2
>> objA2
>>
>> Am trying to write one here (reinventing the wheel?) but am getting a bunch
>> of duplicate listings in the result. I'm missing something...
>>
>> Thanks & Regards,
>>
>> Scott Rossi
>> Creative Director
>> Tactile Media, UX Design
More information about the use-livecode
mailing list