The Owner of a background group

Peter M. Brigham pmbrig at
Tue Aug 21 11:17:19 EDT 2012

I have sometimes been tripped up by the fact the the long id of a control is in fact not very robust, in the sense that it will vary depending on which card you are currently on and where the stack is stored on disk. I needed a long ID equivalent that would be consistent no matter where it was called from, so I wrote a virtual property handler:

getProp robustID
   ----  a virtual property, read only  ----
   -- the robustID is consistent no matter what card is current
   -- and no matter which folder the user has stored the stack in;
   -- format: button id 1039 of bkgnd id 1003 of stack "subStack1"
   --            of stack "tMainStack"
   -- the robustID can be used as a complete object reference,
   --    just like the long ID
   put numtochar(6) into delim1
   put numtochar(7) into delim2
   put the long id of the target into tLongID
   replace " stack " with delim1 in tLongID
   set the itemdelimiter to delim1
   put item -1 of tLongID into mainStackFileName
   if not (word 1 of mainStackFileName = "stack") then
      put "stack " before mainStackFileName
   end if
   put the short name of mainStackFileName into mainStackName
   put quote & mainStackName & quote into item -1 of tLongID
   replace delim1 with " stack " in tLongID
   replace " of " with delim2 in tLongID
   set the itemdelimiter to delim2
   put itemoffset("card",tLongID) into cdItemNbr
   if cdItemNbr > 1 then delete item cdItemNbr of tLongID
   replace delim2 with " of " in tLongID
   replace "group" with "bkgnd" in tLongID
   -- in case the group is not placed on the currentcard
   return tLongID
end robustID

-- Peter

Peter M. Brigham
pmbrig at

On Aug 20, 2012, at 5:28 PM, DunbarX at wrote:

> Bob.
> It seems more natural to me that the owner is the current card. It makes the message hierarchy consistent.
> The "progenitor" could be a property as you suggest, but since this is not native, just set a custom property of the group to the id of the card that gave it birth. You then get everything you could ask for.
> Bob Sneidar <bobs at> wrote
>> Never mind works the same either way. Frankly, I would like the owner to return 
>> the card it was originally on. It seems confusing to me that the owner would 
>> change when the active card changes. Doesn't seem intuitive. I suppose however, 
>> this might allow for the deletion of the "owner" card without deleting the group 
>> that is placed on multiple cards. 
>> I thought it might be related to behaviors but nada. I cannot make it work where 
>> the owner is the first card the group was placed on/created on. 

More information about the use-livecode mailing list