Livecode Wiki

Stacks and cards structure

Specifies which main stack a substack belongs to.


set the mainStack of <stack> to <mainStack>


set the mainStack of this stack to "Central"
go the mainStack of stack "/Disk/Folder/file.rev"
set the mainStack of stack "Hello" to "Goodbye"

Use the mainStack property to organize stacks in files.

Each LiveCode file contains either a single main stack, or a main stack and one or more substacks. You can use this capability to bundle several related stacks into a single file for easy distribution, or to organize the stacks into categories, or to allow several stacks to inherit properties from the same main stack.

The mainStack of a stack file is the main stack in that file. (Each stack file can have only one main stack.)

The mainStack of a main stack is itself.

The mainStack of a substack is the main stack in that substack's file.

Changing a stack's mainStack property moves it into the same file as the specified main stack. The stack becomes a substack of the specified mainStack.

Changing a substack's mainStack property to itself makes the substack into an independent main stack (and removes it from the original main stack's substacks property). The next time you save the stack, LiveCode will prompt you for a file name and location for the stack.

You can set the mainStack property of a stack to the name of any open stack.

The mainStack property is simply the short name of the main stack, not a full stack reference.

See also: mainStacks (function), mainStackChanged (message), stack (object), name (property), substacks (property), stackFiles (property),