Display OK / Cancel Message Box

? tab(-10, AG_MESSAGEBOXOK); btnflag; msg; tilde; title; chr(127);

AG_MESSAGEBOXOK (4) displays a message in a dialog box that is positioned along the bottom couple of lines of the window, as shown below. The dialog returns a single byte to the keyboard buffer indicating which button was pushed: ESCAPE (ASCII 27) for the Cancel button and RETURN (ASCII 13) for the OK button. This may be considered a GUI approximation of the standard MESAG subroutine.  

 (WinXP)

 (Win10)

Parameters

btnflag

A single character which must be a space (ASCII 32) to display just an OK button in the dialog, or an exclamation point (ASCII 33) to display both OK and CANCEL buttons

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.

Example

map1 btnflag,s,1

map1 msg,s,80

map1 title,s,80

map1 x,b,1

btnflag = "!"   ! OK and Cancel buttons

msg = "Please make sure checks are aligned before printing."

title = "Printer Check"

? TAB(-10,AG_MESSAGEBOXOK); btnflag; msg; "~"; title; chr(127);

xcall ACCEPN, x

if x = 27 ? "Cancel"

if x = 13 ? "OK" ? TAB(-10,AG_MESSAGEBOXOK);"!Make sure you have a backup before posting!"; ~Read This!";chr(127);

 

Notes

MSGBOX a similar but more flexible and powerful implementation in subroutine form. The main advantage of AG_MESSAGEBOXOK is that it could be issued from an arbitrary server (not running A-Shell), provided the client was ATE.

See Also

•   MSGBOX.SBR

•   EVTMSG.SBX and XTRMSG.SBX in SOSLIB:[907,20]