Previous Page | Next Page

SAS Component Language Dictionary

MESSAGEBOX



Displays a host message window with a specified text and icon
Category: Utility

Syntax
Details
Example

Syntax

text=MESSAGEBOX(textlist-id<,icon<,buttons
<,caption<,default<,right>>>>>);

text

contains the text of the button that a user pressed in the message dialog window. This text can be

ABORT, APPEND, CANCEL, IGNORE, OK, NO, REPLACE, RETRY, YES, or YESTOALL. When a user presses Enter instead of selecting a button, either default is returned (if specified) or the text of the first button in the message window is returned.

Type: Character

textlist-id

contains the identifier for the SCL list that contains the lines of text to display in the message window. Lines that are too long are wrapped. For example, if there are two lines and the first is too long, the text displays as three lines.

Type: List

icon

specifies the icon to display in the message window:

'I'

Information or note icon (default)

'?'

Query icon

'!'

Warning icon

'S'

Error icon (stop sign/hand)

Type: Character
buttons

specifies the set of command buttons to display in the message window:

'O'

Ok (default)

'OC'

Ok, Cancel

'YN'

Yes, No

'YNC'

Yes, No, Cancel

'YYNC'

Yes, Yes to all, No, Cancel

'ARI'

Abort, Retry, Ignore

'RAC'

Replace, Append, Cancel

'RC'

Retry, Cancel

Type: Character
caption

is the title for the message window.

Type: Character

default

is a single character that corresponds to one of the characters specified in buttons. Default specifies the value that is returned when a user presses Enter in the message window instead of selecting a button. If default is not supplied, the default selection is the text of the first button in the message window.

Type: Character

right

specifies whether the text in the message window is right- or left- justified:

'N'

Left justify the text. (default)

'Y'

Right justify the text.

Type: Character

Details

MESSAGEBOX calls a host message window and specifies text to be displayed there. It can also specify an icon, one or more buttons, and a title to display in the window.

If the message window cannot open, or if textlist-id is invalid, the program halts. Otherwise, MESSAGEBOX returns OK, CANCEL, ABORT, RETRY, IGNORE, YES, or NO. On hosts that allow users to close the message window without selecting a button, CANCEL is returned even if it is not one of the button choices.


Example

Create a window to prompt users to save the latest changes when they close an application window. If no button is selected to close the window, NO is returned to the variable COMMAND.

commandlist=makelist();
commandlist=insertc(commandlist,
   'You have not saved the latest changes.',1);
commandlist=insertc(commandlist,
   'Do you want to save your changes?',2);
...more SCL statements...
command=messagebox(commandlist,'!','YN','','N','');
commandlist=dellist(commandlist);

Previous Page | Next Page | Top of Page