Help: Id's can be completly unreliable
claudi.c at fiberworld.nl
Wed Nov 10 18:05:33 EST 2010
Referencing a control with a ID 0 and using ID's to reference this
control might result in a error (control doesn't exist)
but not always. It depends on what you do.
Programaticly putting some text in a field with ID 0 (referencing the
control with the long id) didn't generate
a error but it also didn't put the text in the field, for instance.
Same with properties, no error, but also the propertie didn't get set.
This makes using ID's not reliable.
So to be save, I don't use ID's anymore. It might go well a hundred
times but suddenly you might get an error.
Sometimes I get 8 out of 10 times a ID of 0 when copying a grp.
This also means the it variable might hold a invalid reference to the
newly created grp after copying, so you can't use it reliably
and you have to use the work around to reference the newly created grp.
This problem with the ID of 0 has happened in different stacks and
with different kinds of grp's.
It drove me quite nuts for a while, as the IDE/engine gave sometimes a
error, but not always. This made it difficult to
find what's was going on.
The names of the grp's I copy have names like "textPiece" for instance
(this is the one I have trouble's with right now)
I have to say, this grp belongs to a grp called "textPieceTmplts". I
will change this name to see if that will make a difference.
Also like I wrote in my first mail, I found in a rev lib stack a
comment that the engine sometimes returns 0 as ID for controls
so apparently the 'wizards' in Edinburgh know about this.
More information about the Use-livecode