Programming with Reflection
MsgBox method
Syntax Result = object.MsgBox(Message, [Type], [Caption])
Displays a message in a dialog box. Once the user has selected a command button in the dialog box, this method returns an integer indicating which button was selected.
This method works much like the MsgBox function, but is more versatile because it can be used to return a button number to other programming environments that communicate with Reflection.
Message Argument Type: String
Required
A string expression containing the message to be shown in the dialog box. The maximum length of prompt ranges from about 160 to 255 characters, depending on the widths of the characters used. Prompts longer than one line automatically break at the nearest space and wrap to the next line.
Type Argument Type: Integer
Optional
Specifies which icons and buttons are displayed in the dialog box. Select a value from each of three groupsthe Button group, the Icons group, and the Default group, as shown in the following table. Then, add the selected value from each group to compute the Type value.
Value |
Description |
Group 1 - Buttons |
|
0 |
OK only |
1 |
OK, Cancel |
2 |
Abort, Retry, Ignore |
3 |
Yes, No, Cancel |
4 |
Yes, No |
5 |
Retry, Cancel |
Group 2 - Icons |
|
16 |
Critical Message (STOP) |
32 |
Warning Query (?) |
48 |
Warning Message (!) |
64 |
Information Message (i) |
Group 3 - Default |
|
0 |
First button |
256 |
Second button |
512 |
Third button |
For example, to specify that the message box should have three buttonsYes, No, and Cancelselect the appropriate value for that set of buttons (3). To specify that the Information icon should appear in the message box, use the appropriate Icon value (64). Finally, to select the Yes button as the default button, use the appropriate Default value (0). Then, add all three values to compute the Type value (67).
If the Type argument is omitted, the message box displays a single OK button.
Caption Argument Type: String
Optional
Specifies the caption that appears in the dialog box's title bar. The default value is the name of the Reflection product ("Reflection for HP," "Reflection for UNIX," or "Reflection for ReGIS Graphics").
Result Return type: Integer
The number returned indicates which button the user clicks in the message box:
Value |
User Clicks |
1 |
OK |
2 |
Cancel |
3 |
Abort |
4 |
Retry |
5 |
Ignore |
6 |
Yes |
7 |
No |