More Long ID Differences

Brian Milby brian at milby7.com
Sun May 20 23:21:22 EDT 2018


Just pushed the updated code that manually creates the consistent long
IDs.  Not sure what to call them - they are still pretty much a long ID, in
the same form as the long ID that is used for behaviors but derived
differently.

Bulk of the code for the stack is here:
https://github.com/bwmilby/lc-misc/blob/master/ScriptTracker/ScriptTracker_Scripts/stack_ScriptTracker_button_id_1003.livecodescript

I've also added an option to perform a sync when saving the stack using a
front script that intercepts the SaveStackRequest.


On Sat, May 19, 2018 at 10:27 AM, Brian Milby <brian at milby7.com> wrote:

> 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