Confirming a thing about IDs
Brian Milby
brian at milby7.com
Thu Oct 11 15:37:40 EDT 2018
That is what my ScriptTracker uses to build unique file names for the script of all controls (but I start with the stack).
If a card containing a certain shared group has not been visited, then the group must be referenced using background instead of group. For this reason, I use “bkgnd” to identify any shared group.
The background text issue is (was) actually a bug in the compact stack routine that should be fixed in 9.0.1 now. After you compact a stack (or save), then those extra contents should be gone. But you can still recover the text if you just remove it from a card and then place it before a compact is performed.
Thanks,
Brian
On Oct 11, 2018, 2:12 PM -0500, Geoff Canyon via use-livecode <use-livecode at lists.runrev.com>, wrote:
> 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>"
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list