MessageBox (FPScript)

21.09.2021

Displays a message box.

Syntax

MessageBox(Title, Text, [ Type = TYPE_OK ], [ Icon = ICON_NONE ], [ Timeout = 0 ] [ , ShowTimeout = FALSE ])

 

The syntax of the MessageBox function consists of the following parts:

Part

Description

Title

String with a title for the message box.

Permitted data structures are scalar value. Supported data types are string.

Text

String with the text for the message box.

Permitted data structures are scalar value. Supported data types are string.

Type

The type of message box.

The argument Type can have the following values:

Constant

Meaning

TYPE_OK

An OK button will appear.

TYPE_OKCANCEL

The OK and Cancel buttons will appear.

TYPE_OKCANCEL2

The OK and Cancel buttons will appear. The Cancel button is the default selection.

TYPE_ABORTRETRYIGNORE

The Abort, Retry and Ignore buttons will appear.

TYPE_ABORTRETRYIGNORE2

The Abort, Retry and Ignore buttons will appear. The Retry button is the default selection.

TYPE_ABORTRETRYIGNORE3

The Abort, Retry and Ignore buttons will appear. The Ignore button is the default selection.

TYPE_YESNOCANCEL

The Yes, No and Cancel buttons will appear.

TYPE_YESNOCANCEL2

The Yes, No and Cancel buttons will appear. The No button is the default selection.

TYPE_YESNOCANCEL3

The Yes, No and Cancel buttons will appear. The Cancel button is the default selection.

TYPE_YESNO

The Yes and No buttons will appear.

TYPE_YESNO2

The Yes and No buttons will appear. The No button is the default selection.

TYPE_RETRYCANCEL

The Retry and Cancel buttons will appear.

TYPE_RETRYCANCEL2

The Retry and Cancel buttons will appear. The Cancel button is the default selection.

If this argument is omitted, it will be set to the default value TYPE_OK.

Icon

Determines which icon to display next to the text.

The argument Icon can have the following values:

Constant

Meaning

+ ICON_NONE

No icon will be displayed.

+ ICON_STOP

A stop icon will appear.

+ ICON_QUESTION

A question mark icon will appear.

+ ICON_EXCLAMATION

An exclamation mark icon will appear.

+ ICON_INFORMATION

An information icon will appear.

If this argument is omitted, it will be set to the default value ICON_NONE.

Timeout

The maximum amount of time in seconds to display the message box. If you set the argument to 0 or omit it, the message box will appear indefinitely. For group TYPE_YESNO and TYPE_ABORTRETRYIGNORE type message boxes, the display time cannot be restricted.

Permitted data structures are scalar value. All numeric data types are permitted.

The value must be greater or equal to 0.

If this argument is omitted, it will be set to the default value 0.

ShowTimeout

Specifies whether the remaining display time is to appear in the title of the message box.

Permitted data structures are scalar value. Supported data types are Boolean value.

If this argument is omitted, it will be set to the default value FALSE.

Remarks

The result is an integer, which determines which button is pressed. If you specified the argument Timeout, the return value BUTTON_TIMEOUT will indicate that the maximum display time has been exceeded.

If an argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

The function returns one of the following values:

Constant

Meaning

BUTTON_TIMEDOUT

Message box closed due to session timeout.

BUTTON_OK

The OK button was pressed.

BUTTON_CANCEL

The Cancel button was pressed.

BUTTON_ABORT

The Abort button was pressed.

BUTTON_RETRY

The Retry button was pressed.

BUTTON_IGNORE

The Ignore button was pressed.

BUTTON_YES

The Yes button was pressed.

BUTTON_NO

The No button was pressed.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

MessageBox("Note", "A zero crossing could be found.")

Displays a message box with an OK button, but no icon.

MessageBox("Note", "Curve fitting was successful.", TYPE_OK, ICON_INFORMATION, 3.5, True)

Displays a message box with an OK button and an information icon. The box will appear for a maximum of 3.5 seconds. The remaining display time will appear in the title.

MessageBox("Warning", "No zero crossing could be found!", TYPE_OK, ICON_STOP)

Displays a message box with an OK button and a stop icon.

If MessageBox("Warning", "A zero crossing could be found.\nAbort computation anyway?", _
TYPE_YESNO2, ICON_QUESTION) == BUTTON_YES
Then Throw "Computation has been aborted by the user"
End

Displays a message box with the Yes and No buttons and an exclamation mark icon. The No button is the default selection. If the user clicks on the Yes button, an exception is thrown.

See Also

Input Function

TextInput Function

TimeInput Function

TimeSpanInput Function

ChooseFile Function

Share article or send as email:

You might be interested in these articles