MsgBox: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
m (1 revision)
(No difference)

Revision as of 14:11, 15 January 2012

The MsgBox Internal Function will display a Windows Message Box. It has four possible parameters:

  • PROMPT$
  • TITLE$
  • BUTTONS$
  • ICON$

PROMPT$ is the only required parameter. It is a string which is to be displayed within the message box. TITLE$ is a string containing the title of the message box. BUTTONS$ indicates which buttons will be displayed in the message box, and ICON$ indicates what ICON, if any, will be displayed. If you don't specify a title, a blank title bar is displayed. If you don't specify a button configuration the OK button is displayed. The value of the button the user selects is returned to BR in CNT (see below).

Examples

Let MSGBOX( PROMPT$, TITLE$, BUTTONS$, ICON$)
Let VALUE= MSGBOX( "Record not Found", "Error", "OK", "ERR")
Let MSGBOX( "End of Data", "NOTE")

Acceptable values for BUTTONS$

OK Displays OK button (default)
YN Displays Yes and No buttons
OKC Displays OK and Cancel buttons
YNC Displays Yes, No and Cancel buttons


Acceptable values for ICON$

INF Displays (i) Information icon
ERR Displays Error Icon (e.g. stop sign)
EXCL Displays Exclamation Point
QST Displays a Question Mark


All Buttons$ and Icon$ values are case insensitive except that if "Yn" or "Ync" is specified then the Yes button becomes the default button and if "yN" or "yNc" is specified then the No button is displayed as the default button (will be selected by the Enter key). The case of the "c" has no bearing on default button focus, and "YN" or "yn" are ambiguous with respect to default button focus.

Returned Values

Possible return values are:

0 An error occurred such as not enough memory. (quite rare)
1 The OK button was selected.
2 The YES button was selected.
3 The NO button was selected.
4 The CANCEL button was selected, or ESC was pressed. (The ESC key has no affect when the Cancel button is not displayed.)

To force a new line in the text of a message box insert a CHR$(13) or HEX$("0D0A"), carriage return,in the text at the point where the word wrap should occur. If no line is forced Windows will determine a wrap point based on the width of the monitor.