MessageBox

Mon 01 January 2018

Syntax

MessageBox(style, title, message_set, message_num, default_msg_txt[, paramlist])

where paramlist is an arbitrary-length list of parameters of undetermined (Any) data type to be substituted in the resulting text string, in the form:

param1 [, param2]. . .

Description

Use the MessageBox function to display a message box window. This function combines dialog-display ability with the text-selection functionality of MsgGet, MsgGetText, or MsgGetExplainText. The style parameter selects the buttons to be included. title determines the title of message.

Note: The title parameter is ignored for messages displayed in the PeopleSoft Pure Internet Architecture. The title of a message box displayed by the browser is always “Message”.

Also, style is ignored if the message has any severity other than Message.

The remaining parameters are used to retrieve and process a text message selected from the Message Catalog.

MessageBox can be used for simple informational display, where the user reads the message, then clicks an OK button to dismiss the message box. Use MessageBox as a way of branching based on user choice, in which case the message box contains two or more buttons (such as OK and Cancel or Yes, No, and Cancel). The value returned by the function tells you which button the user clicked, and your code can branch based on that value.

In the MessageBox dialogs, both the Text and the Explanation, that is, more detailed information stored in the Message Catalog, are included.

If MessageBox displays buttons other than OK, it causes processing to stop while it waits for user response. This makes it a "user think-time" function, restricting its use to certain PeopleCode events.

See , , .

Parameters

Field or Control

Definition

style

Either a numerical value or a constant specifying the contents and behavior of the dialog box. This parameter is calculated by cumulatively adding either a value or a constant from each of the following list of categories:

Note: In PeopleSoft Pure Internet Architecture style is ignored if the message has any severity other than Message. If the message has a severity of Warning and the MessageBox PeopleCode is in a SaveEdit event, the message is displayed in a new window with the OK and Cancel buttons.

Category

Value

Constant

Meaning

Buttons

0

%MsgStyle_OK

The message box contains one push button: OK.

1

%MsgStyle_OKCancel

The message box contains two pushbuttons: OK and Cancel.

2

%MsgStyle_AbortRetryIgnore

The message box contains three pushbuttons: Abort, Retry, and Ignore.

3

%MsgStyle_YesNoCancel

The message box contains three pushbuttons: Yes, No, and Cancel.

4

%MsgStyle_YesNo

The message box contains two push buttons: Yes and No.

5

%MsgStyle_RetryCancel

The message box contains two push buttons: Retry and Cancel.

Field or Control

Definition

title

Title of message box. If a null string is specified, then PeopleTools provides an appropriate value.

Note: The title parameter is ignored for messages displayed in the PeopleSoft Pure Internet Architecture. The title of a message box displayed by the browser is always "Message".

Field or Control

Definition

message_set

The message set number of the message to be displayed. When message set and number are provided, it overrides the specified text. A value less than one indicates that the message comes from the provided text and not the Message Catalog.

message_num

The message number of the message to be displayed.

default_msg_txt

Default text to be displayed in the message box.

paramlist

A comma-separated list of parameters; the number of parameters in the list is arbitrary. The parameters are referenced in the message text using the % character followed by an integer corresponding to the position of the parameter in the paramlist .

Returns

Returns either a Number value or a constant. The return value is zero if there is not enough memory to create the message box. In other cases the following menu values are returned:

Value

Constant

Meaning

-1

%MsgResult_Warning

Warning was generated.

1

%MsgResult_OK

OK button was selected.

2

%MsgResult_Cancel

Cancel button was selected.

3

%MsgResult_Abort

Abort button was selected.

4

%MsgResult_Retry

Retry button was selected.

5

%MsgResult_Ignore

Ignore button was selected.

6

%MsgResult_Yes

Yes button was selected.

7

%MsgResult_No

No button was selected.