put into named field weirdness

J. Landman Gay jacque at hyperactivesw.com
Mon Feb 11 15:31:36 EST 2008


Russell Martin wrote:

> ...now, within my openStack handler, just before I spit out the answer
> dialog and then call my readPrefsFile handler, I do, inside of my
> openPrefsFile handler, open a separate stack stored on disk, but once
> that handler completes and execution returns to the line below it, how
> does the recently opened preferences stack then become the stack that
> is calling readPrefsFile?!? That doesn't make any sense.

The stack that is running the script is not necessarily "this stack". 
"This stack" is effectively the same thing as the defaultstack, which is 
reset when you open a stack. So, in your scripts, you open the main 
stack, which is also the defaultstack. The main stack opens the prefs 
stack, which in turn becomes the defaultstack. The prefs stack will 
remain the defaultstack until you either go back to the main stack, or 
set the defaultstack to the main stack specifically in a handler.

Use "set the defaultstack to 'my_main_stack'" in your script before 
trying to work with any fields in the main stack.

I have several projects that use an invisible prefs stack that stays 
open all the time, and I have to do the same thing with those. I need to 
reset the defaultstack after opening my invisible prefs so that scripts 
will be directed to the right stack. Otherwise all commands would be 
directed to the last-opened stack (my prefs stack) which isn't what I want.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list