Help: Id's can be completly unreliable

Richard Gaskin ambassador at fourthworld.com
Wed Nov 10 18:30:37 EST 2010


Claudi Cornaz wrote:

> 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.

Thanks for the background on that.

If you have a recipe for that please submit a bug report, but to be 
honest I've never seen anything like that in 12 years of working with 
this engine.

IDs normally begin at 1001 and increment from there for every object 
added to the stack.

Given how many people use the DataGrid, which copies groups many times 
during its operation, I suspect this bug is not easy to reproduce or 
we'd be seeing reports of DG failures.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv




More information about the Use-livecode mailing list