Name: go

Synonyms: open

Type: command

Syntax: go [invisible] [to] <card> [of <stack>] [{as <mode> |in [a] new window|in <window>}]

Syntax: go [invisible] [to] {first | prev[ious]| next | last | any} [marked] [<card>]

Syntax: go [invisible] [to] {recent | start | finish | home} <card>

Syntax: go {forward | forth | back[ward]} [<number>]

Summary:
Navigates to another <card> or <stack>.

Introduced: 1.0

OS: mac, windows, linux, ios, android

Platforms: desktop, mobile

Example:
go to card 2

Example:
go to stack "Controls" as palette

Example:
go to next marked card

Example:
go back 7

Example:
go invisible stack "Preferences"

Example:
local tStackFile, tStackFolder
put the effective filename of me into tStackFile
set the itemDelimiter to "/"
put item 1 to -2 of tStackFile into tStackFolder
set the defaultFolder to tStackFolder
go stack "somethingElse.livecode"
-- "somethingElse" being the name of a stack file in the same folder

Parameters:
card:
Any card reference. Cards can be described by their name, number, or ID
properties. 

stack:
Any stack reference, or any file path or http URL reference that
resolves to a stack file. If you specify a file path or http URL, the
command opens the main stack of the specified stack file.

mode (enum):

-   editable window
-   palette
-   modal dialog box
-   modeless dialog box 
-   sheet dialog box - appears in <defaultStack(property)>
-   drawer - appears in <defaultStack(property)>, centered at left 
    side if there's room 


window:
The name or windowID property of any open stack. If a window is
specified, the stack opens in that window, replacing the stack that was
previously displayed in that window.

number:
The number of cards to move within the recent cards list.

The result:
If the stack or card you specify doesn't exist, an error message is
returned by the result function.

Description:
Use the <go> command to move to another card in the current stack, to
open a stack and go to a card within it, or to move backward and forward
among recently visited cards.

If the stack is open, is closed but loaded into memory, or is listed in
the current stack's stackFiles property, you can specify it simply
by name:

go stack "My Stack"

Otherwise, you must include the stack's file path.

If the specified file path is relative, the <go> command
will look in the <defaultFolder>.

When going to a previously-unopened stack, if you don't specify a card,
the <go> command displays the first card of the stack. If the stack is
already open, the current card of the stack appears and the stack window
is brought to the front.

If the <lockScreen> <property> is set to true, the <go> command does not
bring an already-open stack to the front until the <lockScreen> is set
to false. (Remember that the <lockScreen> is automatically set to false
when all pending handlers finish executing.)

If you specify a mode, the stack opens in the specified mode. If you
don't specify a mode, the stack opens in whatever mode is specified by
the stack's style property.

When going to a stack, you can specify a mode or a window for the stack
to appear in, but not both.

>*Important:*  The style of the stack, if it is anything other than
> "topLevel", overrides any mode you specify in a <go> command. For
> example, if you open a stack using the statement go stack "Some Stack"
> as modeless, and the style of "Some Stack" is set to "palette", it
> opens as a palette rather than a modeless dialog box, ignoring the
> mode you specified.

The <go>... as sheet form can be used only on OS X systems. If you use
this form on Mac OS, Unix, or Windows, the stack is displayed as a modal
dialog box instead. If you don't specify a mode, the stack is opened
with the mode specified by its style property.

If you specify a URL, the stack is downloaded from that URL and
displayed. The stack must be in stack file format (that is, not
compressed or archived). Stacks opened in this way are treated as
unsaved stacks; the long name of such a stack is the same as its
abbreviated name, until the stack is saved on a local disk. The
downloaded stack is a copy: changes you make to the stack are not
automatically made on the server the stack came from. To change the
stack on the server, you must save the stack file locally and re-upload
it. 

You can <go> to the first, previous, next, or last card of the current
stack. The form go any card goes to a random card in the current stack.
If you include the marked parameter, the go command is restricted to
cards whose mark property is set to true.

Each card the user visits while the <lockRecent> <property> is false is
placed in the recent cards list. You can use the <go> command to move
among the previously-visited cards:

* The <go> recent card form goes to the most recently visited card.
* The <go> start and go finish forms go to the first or last card in the
  recent cards list.
* The <go> home form goes to the first card in the application's main
  stack. (This form is included mainly for HyperCard compatibility; the
  statement go home does not do anything useful in the development
  environment.) 
* The <go> back number form backs up number cards. The go forward number
  form moves forward in the recent cards list. "forward" and "forth" are
  synonyms. 


If you use the <go> invisible form, the window or card change does not
show on the screen. (When going to a stack, this form sets the stack's
<visible> <property> to false.) Use this form of the <go> command to open
a stack without displaying it on screen. To display the stack later, use
the <show> <command> or set its <visible (property)>to true.

Any visual effects that have been queued with the visual effect command
are displayed when the <go> command is executed (unless the screen is
locked). 

>*Tip:*   To test whether a stack or card exists before trying to go to
> it, use the there is a operator:

    if there is a card "Index" then go card "Index"
    if there is a stack myPath then go card 2 of stack myPath

The go... as sheet form was introduced in version 2.0. Previous versions
did not support sheet dialogs.

References: unlock recent (command), show (command), command (glossary),
show cards (command), drawer (command), modeless (command),
push (command), previous (keyword), recent (keyword), as (keyword),
card (keyword), stack (object), lockRecent (property),
lockScreen (property), property (glossary),
HCImportStat (property), visible (property),
defaultStack (property), defaultFolder (property)

Tags: navigation

