defaultStack

Typeproperty
DictionaryLCS
LibraryLiveCode Script
Syntax
set the defaultStack to <stackName>
Summary

Specifies which stack the expression this stack evaluates to, if no stack is specified in a statement.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Example
set the defaultStack to "Help"
set the defaultStack to the topStack
Values
NameTypeDescription
Value

The defaultStack is the name of an open stack.

RelatedProperty: 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
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 stack 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 boxes, palettes, or menus). LiveCode's message box and editing palettes set the defaultStack property to the value returned by the topStack function before performing a stack action.

Tagsobjects