Specifies which stack the expression this stack evaluates to, if no stack is specified in a statement.
# Metadata
Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:
# Syntax
set the defaultStack to stackName
# Examples
set the defaultStack to "Help"
set the defaultStack to the topStack
# Description
Use the defaultStack property to ensure that actions are performed on the correct stack.
If no stack is specified in a statement that applies to a stack, LiveCode assumes the defaultStack is the stack meant. For example, the following statement causes the defaultStack to move to its next card :
go next card -- of the current defaultStack
The expression this card refers to the current card of the defaultStack.
>*Important:* You cannot use a object reference, only > a stack name or an expression that evaluates to a > stack name. For example, the following statement causes an > error :
set the defaultStack to stack "Hmm" -- WON'T WORK
but the following statements are correct:
set the defaultStack to "Hmm" set the defaultStack to ("stack" && quote & "Hmm" & quote)
The defaultStack property is particularly useful in stacks opened in a mode other than an editable window (such as stacks that are being used as dialog box, palettes, or menus). LiveCode's message box and editing palettes set the defaultStack property to the value return by the topStack function before performing a stack action.
# Tags
# See
- **property:** name - **glossary:** property, palette, error, return, editable window, statement, expression, evaluate, object reference, dialog box - **message:** shutdown - **keyword:** card, message box - **object:** stack - **control structure:** function - **function:** topStack, stacks, menus, value, clickStack, mainStacks - **command:** call, import