Object naming

Alex Tweedly alex at tweedly.net
Tue Jul 28 06:19:01 EDT 2020


On 28/07/2020 08:27, Curry Kenworthy via use-livecode wrote:
>
> Alex:
>
> > Using unambiguous short names prevents behaviour scripts
> > that references child controls completely
>
> Sure about that? (Option A)
>
Yes, I think I am. At least, it prevents using names of the child 
objects in the script. The other solution using cached IDs works in a 
behaviour script. But I still can't see a way to do it using names.

Give me one more clue please; I'd really like to use option A.

> > Inside A, there is a rect called "R" and also a group called "B"
> > inside B there is a rect called "R"
>
> Or put the "direct" R in a subgroup also. (Option B)
> A-B-R vs A-C-R.
>
No, unfortunately option B doesn't work. Remember that A and B are 
instances of the same group, so when you introduce the extra group level 
in A, you do the same in B; i.e. it's now A-C-R versus A-B-C-R

And again Livecode's "incomplete" name matching will give whichever one 
has a lower layer number.

Verified:
 > *put*thelongnameofgrc"R1"ofgrp"A"
... graphic "R1" of group "C" of group "B" of group "A" of card id 1002 
of stack "Untitled 1"

when A-B is lower than A-C (which it has to be to avoid obscuring it).


So I'm going to abandon this idea - I can go back to a different 
solution which allows behaviour scripts, but requires slightly more 
setup. Not quite so easy to use (initially), but probably easier to 
continue to use in the long run.

Many thanks,

Alex.




More information about the use-livecode mailing list