Why do group ID's change when cloning a stack

Wilhelm Sanke sanke at hrz.uni-kassel.de
Mon Aug 14 18:07:02 EDT 2006


On Sat, 12 Aug 2006, Claudi Cornaz <claudi at fiberworld.nl> wrote:

> I am also interested WHY this should happen. If you have stack A with 2
> grp's
> and you clone the stack then the id's of the 2 grp's will stay the same
> but every
> control in the grp will get a new ID.


One interesting part of this is why - I did a quick test - the IDs of 
the two groups stay the same even when their layer should have been changed.

My experience is that each time you change the layer of an object *and" 
clone the stack or *copy * a card within a stack, the IDs (or new IDs) 
will be re-assigned following the order of the layers,

e.g. if you have 4 buttons on a card with consecutive ID s of  1010 to 
1013 and you change the layer of button 4 to lowest (of the buttons), 
then on the next (copied) card the sequence of IDs for these Buttons is 
1015 to 1018. On the copied card button 4 now has the lowest ID instead 
of the highest as on the original card.

When needing to copy a card when developing a new variant of a language 
program I several times ran into that problem. I then took care to 
rearrange the layers of objects to their original state to be able to 
reestablish references to objects more easily.

And; if you put your two groups into a super-group and change their 
layers, the IDs of the embedded groups will be both new and in a 
different order than before.

 

> If I clone the same stack A again
> I now
> have 2 cloned stacks which are identical that is to say all the ids of
> all controls
> in both cloned stacks are exactly the same and both differ from the
> original.
> So Why?
>
> Best wishes
> Claudi 


The  cloned stack are identical because you did not change any object 
layers in between the two acts of cloning.

I assume, one reason behind the fact that lower order objects (such 
inside a group) get new IDs is that the original stack and the cloned 
stack are *open* at the same time and are somehow treated like two cards 
inside a stack (one of which is a copy of the first as I described above).-

So IMHO the best thing you can do to optimize the creating of cloned 
stacks or copied cards is to reestablish the original layer order before 
cloning or copying.

Best regards,

Wilhelm Sanke

<http://www.sanke.org/MetaMedia>




------------------------------




More information about the use-livecode mailing list