Confirming a thing about IDs

Geoff Canyon gcanyon at gmail.com
Thu Oct 11 15:11:20 EDT 2018


I had never tried this before. It seems to work, but I figured I'd run it
by the list, both as a way of confirming and informing.

Is it accurate that

<type> id <id> of stack "<stack name>"

is a complete and unique identifier for any control? (with the exception
for fields noted below)

For example, suppose there is a button in a group in a group that is a
background in stack "untitled 1". Further, suppose that background is not
placed on the current (or any) card in stack "untitled 1". Then the long id
of the button might be:

button id 1003 of group id 1004 of bkgnd id 1006 of stack "Untitled 1"

But, for example, this returns true:

put there is a button id 1003 of stack "untitled 1"

And as far as I know, there will never be any other button with id 1003 in
that stack. So

button id 1003 of stack "untitled 1"

is a unique and permanent id for that button, no matter what card, group,
or background it is in/on or not.

Is this correct? (mind blown if it is)

And of course I recognize that in the unique(?) case of a field with
sharedText set to false, the rest of the id could matter as far as the
htmlText, text, and rtfText are concerned. I just tested, and it seems that
in that case the groups are still irrelevant, and an ID like

put the text of fld id 1007 of card id 1014 of stack "untitled 1"

returns the text associated with that card, if the field exists on that
card, and an error if it doesn't, but if the stack is currently on a card
where the field doesn't exist, then (amazingly enough) this id

put the text of fld id 1007 of stack "untitled 1"

will return the text that last existed in that field on that card! In other
words, place the background with the field on card 1 of a stack. Put "This
is surprising" into the field. Remove the background from card 1. Then the
text of the field of the stack will be "This is surprising" even though the
field is no longer on card 1.

So for all purposes, is an ID like this sufficient?

<type> id <id> of stack "<stack name>"

with this for fields if accessing text:

field id <id> of card id <id> of stack "<stack name>"



More information about the use-livecode mailing list