insert script vs start using stack questions
J. Landman Gay
jacque at hyperactivesw.com
Sat Jan 24 11:07:28 EST 2004
On 1/24/04 6:43 AM, Doug Lerner wrote:
> (1) What is the difference between
> insert script of stack "mainstack"
> and
> start using stack "mainstack"
The difference is subtle. When you "start using" a stack, its stack
script is inserted into the hierarchy ahead of the home stack. When you
"insert script into back" the script is inserted behind (i.e., after)
the home stack.
In standalones, which have no home stack, the mainstack functions as the
home stack. So inserting scripts into the back in a standalone will
place them after any scripts in your main stack script.
You don't have to insert the script of a mainstack unless you are using
separate external stacks. If all your stacks are substacks of a single
main stack, they have access to the main stack script automatically.
> (2) I added
>
> insert script of stack "mainstack"
>
> to the preOpenStack handler for a stack. But a handler call in the stack
> caused an error saying it couldn't find the handler. Shouldn't it though?
Normally. But I'm guessing that in preOpenStack, there is not yet a
stack available so there are no scripts to insert. Try doing your
insertions on openStack instead. But note that unless you are using
external stacks rather than substacks, you don't need to insert the
script of the main stack.
> (3) Do repeated "start using" or "insert script" calls mean anything, or are
> they like "global" calls that affect all stacks after the call?
Every time you do an "insert" or "start using" command, the script that
is inserted moves to the front of any others already in use. So repeated
"start using" commands will shuffle scripts already in use to the front
of the list. If you have only one script in use or inserted, then
repeated calls to "insert" or "start using" don't do anything.
In practice it is unusual to insert scripts that have duplicate handler
names, so usually the order of the scripts in use doesn't make any
difference.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list