How to use Winmessage in Peoplecode

How to use Winmessage in Peoplecode

&RESULT = WinMessage(“Please Confirm ” | Char(13) | Char(10) | ” Yes = Confirm ” | Char(13) | Char(10) | “No = Exit”, 4);

If &RESULT = %MsgResult_Yes Then
/* Yes button was pressed — do Yes button stuff */

else
/* No button was pressed — do No button stuff */

end-if;

Syntax : WinMessage(message [, ​style] [, ​title])

Message : Text displayed in message box. Normally you want to use the MsgGet or MsgGetText function to retrieve the message from the Message Catalog.

Title : Title of message box.

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 categories

Category Value Constant Meaning
Buttons 0 %MsgStyle_OK The message box contains one pushbutton: 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.
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.
Posted in Peoplecode.