## XSIUIToolkit.MsgBox

### Introduced

v4.0

### Description

This method is identical to the vbscript MsgBox function and provides the ability to pop up a simple modal message window in Softimage. The application is frozen and the user is forced to click a button to dismiss the window.
By default only an OK button is displayed, but flags like siMsgAbortRetryIgnore and siMsgYesNo are supported to change this behavior.
By default no icon is displayed, but flags like siMsgQuestion can be used to help indicate the nature and importance of the message.
This method is better to use than the vbscript native MsgBox function because it does not block execution of scripts in batch mode. When Softimage runs in batch mode the routine returns immediately with the default button as the returned value. By default the first button is considered the default button, but this can be changed by specifying the flag siMsgDefaultButton2 or siMsgDefaultButton3.
For further details please refer to the vbscript documentation on MsgBox or the Win32 documentation on MessageBox.

### C# Syntax

    Int32 XSIUIToolkit.MsgBox( String in_Msg, Int32 in_flags, String in_Caption );

### Scripting Syntax

    oReturn = XSIUIToolkit.MsgBox( Message, [Flags], [Caption] );

### Return Value

siMsgButtonPressed

### Parameters

Parameter | Type | Description
--- | --- | ---
Message | String | Message to display on the screen
Flags | siMsgBoxFlags | Flags to control the appearance of the dialog.
Caption | String | Text to show in the title of the Message Box. Often this is used to describe the source of the message box, for example the name of a plug-in or perhaps a script filename. By default the standard Softimage title is used.

### Examples

#### JScript Example

    // In batch mode buttonPressed is always "siMsgYes"

    var buttonPressed = XSIUIToolkit.Msgbox( "Is this example exciting?",

    			siMsgYesNo | siMsgQuestion, "SDK Example" ) ;

    if ( buttonPressed == siMsgNo )

    {

    	LogMessage( "I am sorry, I will try harder next time." ) ;

    }

    else

    {

    	LogMessage( "Thanks, if software had emotions I'd be feeling good" ) ;

    }

    // Try to encourage the user to select the second button

    // In batch mode buttonPressed is always siMsgCancel

    buttonPressed = XSIUIToolkit.Msgbox( "Please click cancel", siMsgOKCancel | siMsgDefaultButton2 );

    if ( buttonPressed == siMsgCancel )

    {

    	LogMessage( "Thank you" ) ;

    }