A question about openCard

David Epstein dfepstein at comcast.net
Sat Jun 8 14:41:37 EDT 2019


Jacqueline is correct:  if I’m not debugging, the execution contexts is not in the list of recentCards.
But my palette still does not appear in the list of recentCards.  Further testing reveals:  although activating a palette triggers a resumeStack message, and leaving a palette triggers a resumeStack message in the stack activated, palettes do not get listed in “the recentCards”.
So I think I will resort to a global.  In my main stacks, a resumeStack handler should 
— compare the name of this stack with a global “gActiveStack”
— if they are not the same, carry out init actions, and put the name of this stack into gActiveStack.
David Epstein

Jacqueline Gay wrote:
I wouldn't expect the execution contexts to be in the list but it sounds 
like that's a result of the debugging process itself. Is it different if 
you just log it to the message box without the debugger?

get the recentCards
put it
... etc

Does the palette not appear anywhere in the list at all?

> On Jun 8, 2019, at 9:13 AM, David Epstein <dfepstein at comcast.net> wrote:
> 
> Several people gave helpful replies to my question, including pointing out that this is a case of “resumeStack”, not “openCard”:
> 
> Is there some simple way that an openCard handler can branch based on what card it is coming from?
> 
> When a user goes to a different card in a stack, or to a different stack, I use an “openCard” handler to set things up.  But I do not want those actions taken if the user is merely “returning” to a card after using a palette tool, or after a palette tool has been opened.
> 
> Jacqueline Gay suggested using the “recentCards” to determine what card the user is coming from.  So I wrote this handler:
> 
> function resumedTheSameCard
>   -- call this in a "resumeStack" handler.
>   -- returns true if palette "tTools" has just been active and the resumeStack message was received by the same card that had been active when that palette was activated.
>   -- returns false if we are coming from a different card, either directly or with a palette activation in between.
>   get the recentCards
>   if the long id of stack "tTools" is not in line 2 of it then return false -- nb should work even if palette "tTools" stack has several cards
>   return line 1 of it = line 3 of it
> end resumedTheSameCard
> 
> But this does not work.  When I debug, I see that line 2 of the recentCards does not refer to a card on my palette stack (“tTools”); it refers instead to a card in the stack “Execution Contexts”.
> 
> Why is that LiveCode system stack appearing in the recentCards, and why is my palette not appearing there?
> 
> Many thanks.
> 
> David Epstein




More information about the use-livecode mailing list