More Long ID Differences

Brian Milby brian at milby7.com
Sat May 19 11:27:05 EDT 2018


I found another example where the long id of an object is different
depending on whether the card has been visited or not.  The following
command in the message box:

put the long id of button id 1015 of stack "ScriptTrackerPrefs" of stack
"ScriptTracker"

Will generate 2 different results:

button id 1015 of stack "ScriptTrackerPrefs" of stack
"[snip]/ScriptTracker.livecode"

button id 1015 of card id 1005 of stack "ScriptTrackerPrefs" of stack
"[snip]/ScriptTracker.livecode"

The first is what I get when opening the stack, before I have visited any
cards.  Objects on the first card will always get the second results.
After making the stack visible and visiting the card, the second result
will always be returned (regardless of the current card).

This is obviously related to the background issue identified earlier.  If a
card containing a background has never been visited, then "bkgnd xxx" is
found in the long id.  If it has, then "group xxx of card yyy" is found in
the long id.  This similarly changes objects within those groups as well.

I'm sure this doesn't matter to most developers as it does not effect the
ability to locate an object and interact with it.  If, however, you are
counting on the card being identified in the long id it may.  For my stack,
I'm putting the long id in the script header and this causes diffs when
there shouldn't be any (think Git).  In the case of objects that are not in
a background group, I do want the card reference.  On the flip side, if in
a background then I don't.

I'll be expanding my code to handle this difference.  Since I'm working my
way down from stack to control, it will be easy to maintain the parent
portion of my long id/name.  If importing, then I will just use the
previous long id/name.

If you want to take a look, the code is here:
https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

Cheers,
Brian



More information about the Use-livecode mailing list