Message prompter
A CwMessagePrompter displays a message to the user and waits for a button to be pressed. A message prompter from the OS/2 platform is illustrated below.
Message prompter
The message displayed by a message prompter is set using the messageString: method.
The buttons displayed by the prompter can be changed using the buttonType: method. Valid values are:
XmOK
OK button only
XmOKCANCEL
OK and Cancel buttons (default setting)
XmRETRYCANCEL
Retry and Cancel buttons
XmABORTRETRYIGNORE
Abort, Retry, and Ignore buttons
XmYESNO
Yes and No buttons
XmYESNOCANCEL
Yes, No, and Cancel buttons
The button selected by default if the user presses the return key can be changed using the defaultButtonType:method. Valid values are:
XmDEFAULTBUTTON1
The first button is the default (default setting)
XmDEFAULTBUTTON2
The second button is the default
XmDEFAULTBUTTON3
The third button is the default
The icon displayed in the message box can be changed using the iconType: method. Valid values are:
XmNOICON
No icon
XmICONINFO
Info icon (default setting)
XmICONWARNING
Warning icon
XmICONERROR
Error icon
XmICONQUESTION
Question icon
The prompt method returns one of the following values, depending on which button was pressed:
true
The OK, Yes, or Retry button was pressed
false
The No or Abort button was pressed
nil
The Cancel or Ignore button was pressed
The message prompter shown above is created by the following code.
| reply |
reply :=
CwMessagePrompter new
title: 'Message Prompter Example';
messageString: 'Is this a message prompter?';
buttonType: XmYESNOCANCEL;
defaultButtonType: XmDEFAULTBUTTON1;
iconType: XmICONQUESTION;
prompt.
Transcript cr; show: 'The reply was: ', reply printString
Last modified date: 12/21/2017