Example of Alert, a QuickBASIC Toolbox Library (MBLC) Routine (59287)






This article was previously published under Q59287

SUMMARY

Below is an example of using the Alert routine, which is a Toolbox library (MBLC) routine described on Pages 439-441 and 475 of the "Microsoft QuickBASIC for Apple Macintosh: Language Reference" manual.

This information applies to Microsoft QuickBASIC Version 1.00 for the Apple Macintosh.

MORE INFORMATION

For a more complete demonstration program, see the Alert Demo program in the QB Demos folder on the QuickBASIC Examples disk.

The syntax for the Alert routine is as follows

alert ref%,type%,id%,item%,a$(0),a$(1),a$(2),a$(3)

where:

ref% = the reference number of an open resource file

type% = the type of icon (if any) displayed in the alert box (see Pages 439 and 475)

id% = ID number of a specific alert box in the opened resource file referenced by ref%

item% = returns the number of the button that was pressed in the alert box

a$() = strings that you can put into the alert box

Code Example

ref%=0
IF SYSTEM(4) THEN    ' If program is compiled, use OpenResFile...
   n$="Examples:QB Demos:Demo Resources"  'Specify "disk:folder:file"
   OpenResFile n$,ref%
ELSE  ' else if interpreted, get file reference number of QuickBASIC:
   ref% = SYSTEM(7)
END IF
' NOTE: The alert box with ID number 305 is stored in the resource
' fork of Microsoft QuickBASIC (b) and (d), and also in the Demo
' Resources file in the QB Demos folder on the QuickBASIC Examples disk

item% = 0           'Initialize this return argument for alert,
                    'otherwise you'll get a "TYPE MISMATCH" error.
a1$ = "Example using Alert"
a2$ = "This is string 2"
a3$ = "This is string 3"
alert ref%,2,305,item%,a1$,a2$,a3$
                                 'ref% = reference # of resource file
                                 '2    = type of icon displayed.
                                 '       Icon 2 is a caution sign.
                                 '305  = ID number of alert resource
                                 '       in Macintosh QuickBASIC (b)
                                 'item% = returns the number of which
                                 '        button was pressed, if any
                                 'a1$, a2$, a3$ = Strings you wish to
                                 '              put into the alert box
IF item% <> -1 THEN
   PRINT "You have clicked button number =",item%
ELSE
   PRINT "No button was selected."
END IF
WHILE MOUSE(0)<>1 : WEND   '
END
				

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB59287