MsgBoxButtonOverride function
Syntax
MsgBoxButtonOverride(style, title, array_of_button_labels, message_set, message_num, default_msg_txt[, paramlist])
Description
Note:
The MsgBoxButtonOverride function is based on the MessageBox function, therefore, it inherits the behavior of the MessageBox function. The restrictions applicable to the MessageBox are also applicable to the MsgBoxButtonOverride function.
Use the MsgBoxButtonOverride function to override the labels for the buttons in a message box.
Note:
Use the MsgBoxButtonOverride function in fluid applications only. If the function is called in classic pages, it behaves similar to the MessageBox function and ignores the additional parameter in the MsgBoxButtonOverride function.
Application developers can use the array_of_button_labels to specify the label for the buttons in a message box:
-
If the style parameter specifies three buttons, then only three buttons are presented and the labels provided in the array_of_button_labels parameter will be used. If you provide a fourth string in the array_of_button_labels parameter, it will be ignored.
-
If you do not pass a value for any of the button labels, the default labels are used for the buttons. For example, if the style parameter dictates a three-button message box, and you do not provide a label for the second button in the array_of_button_labels parameter, then the default label of the button is used.
-
In the array_of_button_labels parameter, you can use Message Catalog to pass labels for the buttons.
Parameters
The MsgBoxButtonOverride function uses the same parameters as the MessageBox function except for the additional parameter: array_of_button_labels.
| Parameter | Description |
|---|---|
|
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 push buttons: OK and Cancel. |
|
|
2 |
%MsgStyle_AbortRetryIgnore |
The message box contains three push buttons: Abort, Retry, and Ignore. |
|
|
3 |
%MsgStyle_YesNoCancel |
The message box contains three push buttons: 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. |
| Parameter | Description |
|---|---|
|
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".
In fluid user interface, the title is not used for a message box and it is not displayed.
| Parameter | Description |
|---|---|
|
array_of_button_labels |
A collection of labels (of type array of string) used to override the button labels presented by the MsgBoxButtonOverride function. The order in the array is used to match the order of the buttons to override. For example, the first string in the array overrides the first button label, the second string in the array overrides the second button label, and so on. This is a required parameter. |
| Parameter | Description |
|---|---|
|
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
The return values are the same as the MessageBox function.
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. |
Example
In this example, the labels of all the buttons are overridden.
Local array of string &buttonLabels = CreateArrayRept("", 0);
&buttonLabels [1] = "Stop"; /* Override label for first button */
&buttonLabels [2] = "Try Again"; /* Override label for second button */
&buttonLabels [3] = "Continue"; /* Override label for third button */
MsgBoxButtonOverride(%MsgStyle_AbortRetryIgnore, "Title", &buttonLabels, 1, 1, "My own message", "Param1", "Param2");
The MsgBoxButtonOverride function presents a message box with three buttons with the labels: Stop, Try Again, Continue (instead of Abort, Retry, Ignore).
Related Topics