Long Standing Issue with the defaultStack

Bob Sneidar bobsneidar at iotecdigital.com
Sat Apr 18 17:12:31 EDT 2020


What is worse, after THIS script runs:

on openStack
   put the defaultStack && the short name of the topStack & cr into msg
   go stack "untitled 2"
   put the defaultStack && the short name of the topStack & cr after msg
   go the owner of me
   set the defaultStack to the owner of me
   put the defaultStack && the short name of the topStack & cr after msg
end openStack

I get:
stack "Untitled 1" Untitled 1
stack "Untitled 2" Untitled 2
stack "Untitled 1" Untitled 2

Here, the defaultStack is set by script to stack “Untitled 1” as you would expect, but upon termination of the script, the command "put the defaultStack” reveals that stack “Untitled 2” has reverted to the defaultStack!

In other words, going to another stack, or card of a stack by script DOES NOT ALTER the defaultStack, and neither does setting it by script once the script terminates. Additionally it does not make it the topStack. 

If a user CLICKS in an open stack THEN it becomes the defaultStack AND the topStack. It just does not work by script. 

The only reliable way to change either by script is by setting the style of a stack to “topLevel”. 

Bob S


> On Apr 18, 2020, at 1:48 PM, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Okay I created a simple stack with one sub stack. In the card script of stack 1 I put the handler:
> 
> on openStack
>   put the defaultStack & cr into msg
>   open stack "untitled 2"
>   put the defaultStack & cr after msg
>   open me
>   put the defaultStack & cr after msg
> end openStack
> 
> I get:
> stack "Untitled 1"
> stack "Untitled 2"
> stack "Untitled 2”
> 
> It seems going,opening a stack sets the opened stack to the default… IF IT’s NOT ALREADY OPENED! If it IS, well then you are on your own. The defaultStack is the last stack opened. (I’m assuming it’s a normal stack and not a pallet or something else). 
> 
> Now you would think at this point you can use topStack instead, but NAY! This script:
> 
> on openStack
>   put the defaultStack && the short name of the topStack & cr into msg
>   open stack "untitled 2"
>   put the defaultStack && the short name of the topStack & cr after msg
>   go me
>   put the defaultStack && the short name of the topStack & cr after msg
> end openStack
> 
> produces:
> stack "Untitled 1" Untitled 1
> stack "Untitled 2" Untitled 2
> stack "Untitled 2" Untitled 2
> 
> After I go me, neither the defaultStack nor the topStack changes! What is more, the untitled 2 stack still has focus!! 
> 
> Just to be certain I disabled all my plugins and relaunched, same thing. 
> 
> This CANNOT BE RIGHT! And if it is the expected behavior, it ought not be. 
> 
> Bob S
> 
> 
> 
>> On Apr 18, 2020, at 12:56 PM, Mark Wieder via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> On 4/18/20 11:33 AM, Bob Sneidar via use-livecode wrote:
>> 
>>> Until I can figure out what is causing it, I cannot trust the defaultStack.
>> 
>> I think the basic lesson here is "if you're going to rely on the defaultstack you should set the defaultstack".
>> 
>> -- 
>> Mark Wieder
>> ahsoftware at gmail.com
> 
> _______________________________________________
> 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