Why do group ID's change when cloning a stack
Claudi Cornaz
claudi at fiberworld.nl
Sat Aug 12 08:45:07 EDT 2006
Hi all,
Well, I do name all my controls, because ofcourse it's a lot clearer to
read
the code.
The thing I am working on now is a frame-border kind of object.
I design it in a 3D program slice into the right bits and import the
images
into runrev where they get assembled. There is provision for different
states, like focused, unfocused, dimmed, dragEnter etc. There may also
be many different styles and substyles, which ofcourse have theire
different states.
So actualy the component is a grp of grps which contain grps which
contain img's.
All these style grp's have basicaly the same setup, with the same names
for theire subgrps and subparts. Now I can treat each grp the same way
with the same code because the names of their subgroups/parts are all
the same.
So I only need the id of the enclosing grp to be very specific because
id's are unique,
whereas in this setup the names are NOT different on PURPOSE.
That's the nice thing about unique id's combined with names which
needen't
be unique. With storing the unique id of the parent grp I can adress
very specificly
all parts in that grp although there might be tens or hundred of
similar grps nested
in other grps, which are nested in other grps. One id makes it very
precise.
Because of the unique id's I only need to store one ID istead of the
whole chain of
names till I reach a unique part which might be several levels up
(img "left" of grp "focused" of grp "border" of grp "greenstyle" of grp
"defaultStyles" of grp "styles" of grp "fieldFrame".
Instead of img "left" of grp id 1003)
Well sure the id's stay unique, but they are not safe because they get
changed.
This is a real nuissance. What I am doing now is only about 3 levels
deep,
so it is manageable altough now I need to insert code to check for
duplicate names
otherwise it might get screwed up completly. (Names might be changed on
the fly)
I know I will get into situations where the number of levels get way
beyond 3
and then it becomes very awkward. Also I believe this should be
documented
somewhere 'cause it might waste people a lot of time.
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. 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
More information about the use-livecode
mailing list