/
messagePrompt

messagePrompt

Description

Prompts the user with a window displaying a message and Yes/No/Ok/Cancel buttons.

Calling this command halts script execution until the user clicks on one of the buttons, or dismisses the window using the ESC key. Choices of button combinations are OK, OK/Cancel, Yes/No, and Yes/No/Cancel. The return value holds the code to the button that the user selected. If no button options are specified, an OK button only is displayed.

Here is a list of buttons and their codes/return values:

ButtonReturn Code
OK/Yes1
No0
Cancel-1

Functional area

Interface

Command syntax

Syntax

messagePrompt "message"[-okCancel integer] [-yesNo integer] [-yesNoCancel integer]

Arguments

NameTypeRequiredComments
messagestringyesMessage to display to the user.

Flags

NameFlag argumentsArgument typeExclusive toComments
okCancel1integeryesNo, yesNoCancelDisplays an OK and a Cancel button. Integer value specifies the "default" button.
yesNo1integerokCancel, yesNoCancelDisplays a Yes and a No button. Integer value specifies the "default" button.
yesNoCancel1integerokCancel, yesNoDisplays a Yes, a No, and a Cancel button. Integer value specifies the "default" button.

Return value

integer

Examples

// Prompt the user with a message and proceed according
// to the button that was clicked. Make No the default button
int $returnCode;
boolean $shouldSave;
$returnCode = `messagePrompt "Not all nodes are selected for export.\n\n Do you still want to save?" -yesNoCancel 0`;
switch( $returnCode )
{
   case -1: // User clicked Cancel. Exit the script
            return; 
   case 0:  // User clicked No. Don't save
            $shouldSave = false; 
            break; 
   case 1:  // User clicked Yes. Can proceed with save 
            $shouldSave = true; 
            break;
}
// Save if it's safe to save, according to the user.
$if( $shouldSave )
{ 
   saveFile -s;

}

Additional information

Related commands

Related content


© Copyright Vicon Motion Systems. All rights reserved.

Vicon trademarks