Reviewed and revised December 2023
tab(-10, AG_MESSAGEBOXSTD); flag1; flag2; msg; "~"; title; chr(127); Tab(-10,x) Syntax Notes
AG_MESSAGEBOXSTD (17) displays a standard Windows message box dialog, which consists of a title bar, text message (up to 1024 characters) and a set of buttons as in the following example. Note how different versions of Windows produce different versions of the dialog, with no changes to the A-Shell code.
Note that MSGBOX provides a more convenient interface to this function, and offers the additional bonus of detecting if the environment doesn’t support GUI functions, implementing the message box in text mode via INMEMO if necessary.
Parameters
flag1
A single character whose ASCII value is 32 plus the sum of a single choice from each of the following two tables (a button choice and an icon choice):
Value |
Button Option |
---|---|
0 |
OK button |
1 |
OK and CANCEL buttons |
2 |
ABORT / RETRY / IGNORE buttons |
3 |
YES / NO / CANCEL buttons |
4 |
YES /NO buttons |
5 |
RETRY / CANCEL buttons |
Value |
Icon Option |
---|---|
16 |
ICON: "X" (stop) |
32 |
ICON: "?" (question) |
48 |
ICON: "!" (exclamation) |
64 |
ICON: "i" (information) |
For example, the sample message dialog above would have set the flag1 parameter to chr(32+2+48)
flag2
A single character whose ASCII value is 32 plus the sum of zero or more options from the following table:
Value |
Description |
---|---|
1 |
Default is button #2 |
2 |
Default is button #3 |
4 |
Dialog is task modal |
8 |
Dialog is system modal |
64 |
Add a help button |
msg
A text string containing the message to display in the body of the dialog.
tilde
A single, literal tilde character ( ~ ).
title
A text string to be displayed on the title bar of the dialog.
Response
A single byte indicating how the dialog was exited, according to the following table:
Return Char |
Description |
---|---|
33 |
OK |
34 |
Cancel |
35 |
Abort |
36 |
Retry |
37 |
Ignore |
38 |
Yes |
39 |
No |
40 |
A |
41 |
Help |
Example
! simple test of AG_MSGBOXSTD (from doc)
++include ashinc:ashell.def
MAP1 A,F
? TAB(-10,AG_MESSAGEBOXSTD);chr(32+2+48);chr(32+1+4); &
"Best man tried on the bride's ring.";chr(13); &
"Now he can't get it off.~Wedding ceremony crisis.";chr(127);
xcall ACCEPT,A ! receive response (see notes below)
END
Comments
Unlike the OK/Cancel Message Dialog (-10,4),which appears as a short but wide dialog along the bottom of the window, this one is more rectangular and appears in the middle of the screen. Also, unlike the OK/Cancel dialog which is really only suitable for single-line messages, this one can handle up to 1024 characters. You can break the lines explicitly, as in the example above, with a chr(13), or you can rely on the routine itself to break the lines as it sees fit.
See Also
• | EVTMSG.SBX and XTRMSG.SBX in the SOSLIB:[907,20] |