Introduction

Language Structure

IB Statements

File System

Comet 32 Runtime

Index

MSGBOX function

Discussion: The MSGBOX function displays a Windows-style message box containing a specified string and one or more buttons (i.e., OK, Cancel, Abort, Retry, Ignore, Yes, No, Close, Help). The program is halted until the user clicks on one of the buttons. The value of the clicked button is returned to the program.
Syntax: Result = MSGBOX(string-expression, caption, type)

Where:
Result is a numeric value representing which button was clicked, based on the following table:

! From windows.inc in the WDL dir
!==========================================================
! These are standard ID's assigned by WINDOWS and used
! in many dialogs that have an OK and CANCEL button etc.
!==========================================================
if result = 1 print 'That means ID.OK'
if result = 1 print 'That means IDOK'
if result = 2 print 'That means ID.CANCEL'
if result = 2 print 'That means IDCANCEL'
if result = 3 print 'That means ID.ABORT'
if result = 3 print 'That means IDABORT '
if result = 4 print 'That means ID.RETRY'
if result = 4 print 'That means IDRETRY'
if result = 5 print 'That means ID.IGNORE'
if result = 5 print 'That means IDIGNORE'
if result = 6 print 'That means ID.YES'
if result = 6 print 'That means IDYES'
if result = 7 print 'That means ID.NO'
if result = 7 print 'That means IDNO'
if result = 8 print 'That means ID.CLOSE'
if result = 8 print 'That means IDCLOSE'
if result = 9 print 'That means ID.HELP'
if result = 9 print 'That means IDHELP'

String-expression is the text that will appear in the message box above the button(s).

Caption is a string value that will be displayed as the caption for the Window.

Type is a numeric value that represents the type of message box to be displayed, including which buttons are displayed and the icon that is displayed (i.e., stop sign, question mark, exclamation mark, information icon). In the following table these value are expressed using symbolic constants:
!==========================================================
!
! Type values for the MessageBox function
!
!==========================================================
SET MB.OK = 0 ! 0x00000000L
SET MB.OKCANCEL = 1 ! 0x00000001L
SET MB.ABORTRETRYIGNORE = 2 ! 0x00000002L
SET MB.YESNOCANCEL = 3 ! 0x00000003L
SET MB.YESNO = 4 ! 0x00000004L
SET MB.RETRYCANCEL = 5 ! 0x00000005L

SET MB.ICONHAND = 16 ! MB.ICONSTOP
SET MB.ICONQUESTION = 32 ! 0x00000020L
SET MB.ICONEXCLAMATION = 48 ! 0x00000030L
SET MB.ICONASTERISK = 64 ! MB.ICONINFORMATION

SET MB.USERICON = 128 ! 0x00000080L
SET MB.ICONWARNING = 48 ! MB.ICONEXCLAMATION
SET MB.ICONERROR = 16 ! MB.ICONHAND

SET MB.ICONINFORMATION = 64 ! MB.ICONASTERISK
SET MB.ICONSTOP = 16 ! MB.ICONHAND

SET MB.DEFBUTTON1 = 0 ! 0x00000000L
SET MB.DEFBUTTON2 = 256 ! 0x00000100L
SET MB.DEFBUTTON3 = 512 ! 0x00000200L
SET MB.DEFBUTTON4 = 768 ! 0x00000300L

SET MB.APPLMODAL = 0 ! 0x00000000L
SET MB.SYSTEMMODAL = 4096 ! 0x00001000L
SET MB.TASKMODAL = 8192 ! 0x00002000L
SET MB.HELP = 16384 ! 0x00004000L

SET MB.NOFOCUS = 32768 ! 0x00008000L
SET MB.SETFOREGROUND = 65536 ! 0x00010000L
SET MB.DEFAULT.DESKTOP.ONLY = 131072 ! 0x00020000L

SET MB.TOPMOST = 262144 ! 0x00040000L
SET MB.RIGHT = 524288 ! 0x00080000L
SET MB.RTLREADING = 1048576 ! 0x00100000L

SET MB.TYPEMASK = 15 ! 0x0000000FL
SET MB.ICONMASK = 240 ! 0x000000F0L
SET MB.DEFMASK = 3840 ! 0x00000F00L
SET MB.MODEMASK = 12288 ! 0x00003000L
SET MB.MISCMASK = 49152 ! 0x0000C000L
Example: TYPE = MB.ABORTTETRYIGNORE + MB.ICONQUESTION
Result = MSGBOX(“Click Abort, Retry, or Ignore”,”Sample program”,TYPE)