User Tools

Site Tools


message_return_message_box_response_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== MESSAGE (return message box response) ====== Previous pageReturn to chapter overviewNext page

MESSAGE( text [,caption] [,icon] [,buttons] [,default] [,style] )

blk2blue.jpg

MESSAGE Displays a message dialog box and returns the button the user pressed.
text A string constant or variable containing the text to display in the message box. A vertical bar () in the text indicates a line break for multi-line messages. Including '<;9>' in the text inserts a tab for text alignment.
caption The dialog box title. If omitted, the dialog has no title.
icon A string constant or variable naming the .ICO file to display, or an EQUATE for one of Windows' standard icons (these EQUATEs are listed in EQUATES.CLW). If omitted, no icon is displayed on the dialog box.
buttons Either an integer expression which indicates which Windows standard buttons (may indicate multiple buttons) to place on the dialog box, or a string expression containing a vertical bar () delimited list of the text for up to 8 buttons. If omitted, the dialog displays an Ok button.
default An integer constant, variable, EQUATE, or expression which indicates the default button on the dialog box. If omitted, the first button is the default.
style The style parameter is a bitmap integer constant, variable, EQUATE, or expression that specifies the type of modal behavior, and whether or not the text of the message can be copied to the Windows Clipboard.

Valid values for the style parameter are:

Dec Bin Type

Modal Type:

0    0b   Application Modal

1    1b   System Modal

Copy Text:

0   00b   message text is displayed as a static text without copy capability

2   10b   message text is displayed as a read only multi-line edit control with the

          possibility to select all or any part of the text and copy it to the

          clipboard

The MESSAGE procedure displays a Windows-standard message box, typically requiring only a Yes or No response, or no specific response at all. You can specify the font for MESSAGE by setting SYSTEM{PROP:FONT}.

The EQUATES.CLW file contains symbolic constants for the icon, buttons, styles, and default parameters. The following list is all the EQUATEs available for use in the buttons and default parameters for use when the buttons parameter is not a string:

BUTTON:OK

BUTTON:YES

BUTTON:NO

BUTTON:ABORT

BUTTON:RETRY

BUTTON:IGNORE

BUTTON:CANCEL

BUTTON:HELP

When buttons is a string, the default must be an integer in the range of 1 to the number of buttons defined in the buttons text (a maximum of 8).

The MESSAGE procedure returns the number of the button the user presses to exit the dialog box. The button number returned is the constant value that each of these EQUATEs represents (when the buttons parameter is an integer), and an integer in the range of 1 to the number of buttons defined in the buttons text (up to 8) when buttons contains string text.

The following list shows the most common EQUATEs used in the icon parameter (there are more listed in EQUATES.CLW):

ICON:None

ICON:Application

ICON:Hand

ICON:Question

ICON:Exclamation

ICON:Asterisk

ICON:Pick

ICON:Clarion

The style parameter determines whether the message window is Application Modal or System Modal, whether or not the message text can be copied to the Windows Clipboard, and whether or not to use a fixed-pitch font (monospacing) in the message. An Application Modal window must be closed before the user is allowed to do anything else in the application, but does not prevent the user from switching to another Windows application. A System Modal window must be closed before the user is allowed to do anything else in Windows.

The following list shows the EQUATEs available for the style parameter:

MSGMODE:SYSMODAL

MSGMODE:CANCOPY

MSGMODE:FIXEDFONT

You can combine the styles as needed, for example:

MSGMODE:SYSMODAL + MSGMODE:CANCOPY + MSGMODE:FIXEDFONT

Return Data Type:See also:PROP:MsgModeDefault UNSIGNED

Examples:

!A ? icon with Yes and No buttons, the default button is No:
CASE MESSAGE('Quit?','Editor',ICON:Question,BUTTON:Yes+BUTTON:No,BUTTON:No,MSGMODE:SYSMODAL)
OF BUTTON:No                         !the window is System Modal,and has no copy ability
CYCLE
OF BUTTON:Yes
MESSAGE('Goodbye|So Long|Sayonara') !A 3-line message with only an Ok button.
RETURN
END
!Yes, No, and Maybe buttons, default is Maybe, Application Modal, with copy ability
CASE MESSAGE('Quit?','Editor',ICON:Question,'&amp;Yes|&amp;No|&amp;Maybe',3, MSGMODE:CANCOPY)
OF 1                               !Yes button
RETURN
OF 2                               !No button
CYCLE
OF 3                               !Maybe button
MESSAGE('You have a 50-50 chance of staying or going')  
IF CLOCK() % 2                    !Is the current time an odd or even hundredth of a second?
 RETURN
ELSE
 CYCLE
END
END
message_return_message_box_response_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)