SourcePoint AMD Help

Table of Contents

messagebox

Display a user-defined message box.

Syntax

[result =] messagebox(string-expr [, icon, buttons])

Where:

result

is an ord4 return value containing the key pressed by the user.

string-expr

specifies the text to display; can be an nstring variable or string constant.

icon

specifies the icon type to display in the message box.

buttons

specifies the button layout of the message box.

Discussion

The messagebox function displays a user-defined message box with variable text, icons, and button layouts.

The icon argument is optional. If not specified, then MB_ICONEXCLAMATION is assumed. Possible icons include:

MB_ICONINFORMATION

Displays an information icon

MB_ICONEXCLAMATION

Displays an exclamation mark icon

MB_ICONQUESTION

Displays a question mark icon

The button argument is optional. If not specified, then MB_OK is assumed. ย Possible button layouts include:

MB_OK

Display a single OK button

MB_OKCANCEL

Displays OK and Cancel buttons

MB_YESNO

Displays Yes and No buttons

MB_YESNOCANCEL

Displays Yes, No, and Cancel buttons

MB_RETRYCANCEL

Displays Retry and Cancel buttons

MB_ABORTRETRYIGNORE

Displays Abort, Retry, and Ignore buttons

The messagebox function returns a value corresponding to which button was pressed. ย Possible return values include:

ID_OK

OK button was pressed

ID_YES

Yes button was pressed

ID_NO

No button was pressed

ID_RETRY

Retry button was pressed

ID_IGNORE

Ignore button was pressed

ID_CANCEL

Cancel button was pressed

ID_ABORT

Abort button was pressed

Example 1

To open a message box with a single OK button.

Command input:

messagebox("This is a test") ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย 

Example 2

To open a multi-line message box:

Command input:

messagebox("This is line 1\n\nAnd this is line 2") ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย 

Example 3

To open a message box with Yes and No buttons (messagebox checks whether the Yes button was pressed):

Command input:

if (messagebox("Yes or No?", MB_ICONQUESTION, MB_YESNO) == ID_YES)
{

ย ย ย ย ย // execute some additional code

}

ย 

ย