' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
'
'                           Q D E M O _ C . B A S
'
'  This file is a subcomponent of the QBSCR Screen Routines Demonstration
'  program QDEMO. It is not meant to run as a standalone program. Use only
'  in conjunction with the QDEMO.BAS program.  See QBSCR documentation or
'  QDEMO.BAS for more information.
'
' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

'$INCLUDE: 'qbscr.inc'
'$INCLUDE: 'mouse.bi'

COMMON SHARED kolor%
COMMON SHARED mouseExists%

CONST NOCOLORON3D = -2
CONST GENINFOMISSING = -7
CONST INFO3DMISSING = -10
 
DECLARE SUB InfoBox (messageNum%)

SUB About

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  This routine will display a box with some text that basically shows
	'  credits and little bits of info about this demo program.  It uses the
	'  QBSCR OkMessageBox routine to do this.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Prepare for the OkMessageBox.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	IF mouseExists% THEN
		MouseHide
	END IF

	IF kolor% THEN
		ft% = 6
		bs% = STYLE3D
	ELSE
		ft% = 0
		bs% = STYLE2D
	END IF

	DIM txt$(7)
	txt$(1) = ""
	txt$(2) = "ù ù ù Q D E M O ù ù ù"
	txt$(3) = ""
	txt$(4) = "A program demonstrating the"
	txt$(5) = "QBSCR Screen Routines"
	txt$(6) = ""
	txt$(7) = "Copyright (c) 1991 by Tony Martin"
	OkMessageBox 20, 6, 60, 19, txt$(), 7, 2, 0, 7, ft%, -1, 0, "", mouseExists%, SINGLEBORDER, bs%

END SUB

SUB Boxes3D

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  This demo displays an interesting usage of the raised and depressed 3D
	'  boxes.  By drawing a depressed box inside a raised box, we create a
	'  raised thick border for a window.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
 
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  If we are not using color, then this won't be much of a demo. Therefore
	'  instead of showing not 3D stuff, we'll display an informational message
	'  saying to try this on a color monitor instead.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	IF kolor% = FALSE THEN
		InfoBox NOCOLORON3D
		EXIT SUB
	END IF

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  If the mouse exists, turn it off while we display.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	IF mouseExists% THEN
		MouseHide
	END IF

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Make the 3D windows on the screen.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	MakeWindow 5, 6, 23, 75, 0, 7, 0, 6, -1, 0, ""
	MakeWindow 6, 8, 22, 73, 0, 7, 0, 7, -1, 0, ""
	MakeWindow 7, 16, 9, 65, 0, 7, 0, 6, -1, 0, ""
	Center "QBSCR 3D Screen Boxes", 8
	DrawButton SINGLEBORDER, 10, 19, 19, 21, 0, 7, "OK", STYLE3D

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Now add a bit of text explaining about the 3D boxes.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	Center "You've noticed, I'm sure, the 3D look of the boxes used in", 11
	Center "this demo.  The boxes surrounding this text were drawn using", 12
	Center "the QBSCR MakeWindow routine and the 3D frameType.  Notice", 13
	Center "how they seem to create a thick border around this text,", 14
	Center "as well as a nice raised bar for the title.", 15
	Center "To exit, left-click the OK button or hit the ESC or O key.", 17

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Sit in a loop waiting for the user to say "I'm done."
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	done% = FALSE
	WHILE done% = FALSE

		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		'  If mouse is around, turn him on.
		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		IF mouseExists% THEN
			MouseShow
		END IF

		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		'  Use the QBSCR GetEvent% function to get mouse events and keyboard
		'  keypresses.
		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		result% = getEvent(mouseExists%, kc%, mx%, my%)

		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		'  Decide what to do, if anything, based on the event returned by the
		'  getEvent routine.
		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		SELECT CASE result%
			CASE EMpressedLeft    ' Mouse left button pressed.
				IF (mx% >= 10) AND (mx% <= 19) AND (my% >= 19) AND (my% <= 21) THEN
					IF kolor% THEN
						PressButton SINGLEBORDER, 10, 19, 19, 21, 0, 7, "OK", STYLE3D
					END IF
					done% = TRUE
				END IF
			CASE EKpressed        ' Keyboard key pressed.
				IF kc% = ASC("O") OR kc% = ASC("o") OR kc% = 27 OR kc% = 13 THEN
					done% = TRUE
				END IF
			CASE ELSE
		END SELECT
	WEND

END SUB

SUB Buttons3D

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  This routine will demonstrate the ability of QBSCR to provide the user
	'  with buttons to press, as well as the lesser but equally interesting
	'  ability of those buttons to stay depressed while the mouse button is
	'  still depressed.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  If we are not using color, then this won't be much of a demo. Therefore
	'  instead of showing not 3D stuff, we'll display an informational message
	'  saying to try this on a color monitor instead.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	IF kolor% = FALSE THEN
		InfoBox NOCOLORON3D
		EXIT SUB
	END IF

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  If the mouse exists, turn it off while we display.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	IF mouseExists% THEN
		MouseHide
	END IF

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Make the 3D windows on the screen.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	MakeWindow 6, 6, 23, 75, 0, 7, 0, 6, -1, 0, ""
	MakeWindow 7, 16, 9, 65, 0, 7, 0, 6, -1, 0, ""
	MakeWindow 20, 8, 22, 58, 0, 7, 0, 7, -1, 0, ""
	Center "QBSCR 3D Buttons", 8

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Add the buttons to the screen.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	DrawButton SINGLEBORDER, 60, 11, 72, 13, 0, 7, "Nothing", STYLE3D
	DrawButton SINGLEBORDER, 60, 14, 72, 16, 0, 7, "Zilch", STYLE3D
	DrawButton SINGLEBORDER, 60, 17, 72, 19, 0, 7, "Panic", STYLE3D
	DrawButton DOUBLEBORDER, 60, 20, 72, 22, 0, 7, "OK", STYLE3D

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Add explanatory text to the window.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	LOCATE 11, 9, 0: PRINT "To the right of this window are four buttons";
	LOCATE 12, 9, 0: PRINT "for you to try out.  The first three don't do";
	LOCATE 13, 9, 0: PRINT "anything; the OK button gets out of this demo.";
	LOCATE 15, 9, 0: PRINT "Buttons stay depressed until you release them";
	LOCATE 16, 9, 0: PRINT "(if you're using a mouse).  Also select buttons";
	LOCATE 17, 9, 0: PRINT "by pressing the first letter of their title.";
	LOCATE 19, 9, 0: PRINT "Last Relevant Action:";

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Now sit in a loop waiting for user to press buttons.  Display a
	'  message in the Last Action box that tells the user what just happened.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	done% = FALSE
	WHILE done% = FALSE

		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		'  If mouse is around, turn him on.
		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		IF mouseExists% THEN
			MouseShow
		END IF

		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		'  Use the QBSCR GetEvent% function to get mouse events and keyboard
		'  keypresses.
		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		result% = getEvent(mouseExists%, kc%, mx%, my%)

		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		'  Decide what to do, if anything, based on the event returned by the
		'  getEvent routine.
		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		SELECT CASE result%
			CASE EMpressedLeft    ' Mouse left button pressed.
				IF (mx% >= 60) AND (mx% <= 72) AND (my% >= 11) AND (my% <= 13) THEN
					LOCATE 21, 10, 0: PRINT SPACE$(45);
					LOCATE 21, 10, 0: PRINT "You pressed the NOTHING button."
					PressButton SINGLEBORDER, 60, 11, 72, 13, 0, 7, "Nothing", STYLE3D
					LOCATE 21, 10, 0: PRINT SPACE$(45);
					LOCATE 21, 10, 0: PRINT "You released the NOTHING button."
				END IF
				IF (mx% >= 60) AND (mx% <= 72) AND (my% >= 14) AND (my% <= 16) THEN
					LOCATE 21, 10, 0: PRINT SPACE$(45);
					LOCATE 21, 10, 0: PRINT "You pressed the ZILCH button."
					PressButton SINGLEBORDER, 60, 14, 72, 16, 0, 7, "Zilch", STYLE3D
					LOCATE 21, 10, 0: PRINT SPACE$(45);
					LOCATE 21, 10, 0: PRINT "You released the ZILCH button."
				END IF
				IF (mx% >= 60) AND (mx% <= 72) AND (my% >= 17) AND (my% <= 19) THEN
					LOCATE 21, 10, 0: PRINT SPACE$(45);
					LOCATE 21, 10, 0: PRINT "You pressed the PANIC button."
					PressButton SINGLEBORDER, 60, 17, 72, 19, 0, 7, "Panic", STYLE3D
					LOCATE 21, 10, 0: PRINT SPACE$(45);
					LOCATE 21, 10, 0: PRINT "You released the PANIC button."
				END IF
				IF (mx% >= 60) AND (mx% <= 72) AND (my% >= 20) AND (my% <= 22) THEN
					LOCATE 21, 10, 0: PRINT SPACE$(45);
					LOCATE 21, 10, 0: PRINT "Goodbye!"
					PressButton DOUBLEBORDER, 60, 20, 72, 22, 0, 7, "OK", STYLE3D
					done% = TRUE
				END IF

			CASE EKpressed        ' Keyboard key pressed.
				IF kc% = ASC("N") OR kc% = ASC("n") THEN
					LOCATE 21, 10, 0: PRINT SPACE$(45);
					LOCATE 21, 10, 0: PRINT "You pressed the NOTHING button."
				END IF
				IF kc% = ASC("Z") OR kc% = ASC("z") THEN
					LOCATE 21, 10, 0: PRINT SPACE$(45);
					LOCATE 21, 10, 0: PRINT "You pressed the ZILCH button."
				END IF
				IF kc% = ASC("P") OR kc% = ASC("p") THEN
					LOCATE 21, 10, 0: PRINT SPACE$(45);
					LOCATE 21, 10, 0: PRINT "You pressed the PANIC button."
				END IF
				IF kc% = ASC("O") OR kc% = ASC("o") OR kc% = 27 THEN
					done% = TRUE
				END IF
			CASE ELSE
		END SELECT
	WEND

END SUB

SUB GeneralInfo

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  This routine will create a scrolling list of information about the demo
	'  and the QBSCR Screen Routines themselves.  The routine used will be the
	'  QBSCR ViewList routine.  Whent he user is done, the simply hit ESC or
	'  the right mouse button (explained at the start of the scrolling text),
	'  and they are returned to the main menu.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	IF mouseExists% THEN
		MouseHide
	END IF

	IF kolor% THEN
		ft% = 6
	ELSE
		ft% = 0
	END IF

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  See if the file GENINFO.TXT exists.  If so, proceed.  If not, display
	'  a file-missing error and get out.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	IF FirstFile%("GENINFO.TXT", NormalAttr, dta$) = FALSE THEN
		InfoBox GENINFOMISSING
		EXIT SUB
	END IF

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Display a "Wait" window.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	MakeWindow 9, 21, 13, 60, 0, 7, 0, ft%, -1, 0, ""
	COLOR 0, 7
	Center "Loading text...Please wait.", 11

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Define the text to be displayed about the QBSCR Screen Routines and the
	'  Demo itself.  The text is stored in a file called GENINFO.TXT on disk
	'  and will be read in a line at a time.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	DIM txt$(100)
	OPEN "GENINFO.TXT" FOR INPUT AS #1
	numLines% = 0
	WHILE (NOT (EOF(1)))
		LINE INPUT #1, aLine$
		aLine$ = RTRIM$(aLine$)
		numLines% = numLines% + 1
		txt$(numLines%) = aLine$
	WEND
	CLOSE #1

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Call the ViewList function, which takes care of the whole mess of
	'  making a window, scrolling the text, etc.  Even handles the mouse.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	ViewList txt$(), numLines%, 56, 8, 20, 12, 0, 7, ft%, 0, -1, "", mouseExists%

END SUB

SUB Info3D

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  This routine displays some info about the new 3D routines in the
	'  QBSCR Screen Routines.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  If we are not using color, then this won't be much of a demo. Therefore
	'  instead of showing not 3D stuff, we'll display an informational message
	'  saying to try this on a color monitor instead.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	IF kolor% = FALSE THEN
		InfoBox NOCOLORON3D
		EXIT SUB
	END IF

	IF mouseExists% THEN
		MouseHide
	END IF

	IF kolor% THEN
		ft% = 6
	ELSE
		ft% = 0
	END IF

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Check to see if the file INFO3D.TXT exists.  If so, proceed.  If not,
	'  then display an error and exit this function.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	IF FirstFile%("INFO3D.TXT", NormalAttr, dta$) = FALSE THEN
		InfoBox INFO3DMISSING
		EXIT SUB
	END IF

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Display a "Wait" window.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	MakeWindow 9, 21, 13, 60, 0, 7, 0, ft%, -1, 0, ""
	COLOR 0, 7
	Center "Loading text...Please wait.", 11

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Define the text to be displayed about the QBSCR Screen Routines and the
	'  Demo itself.  The text is stored in a file called INFO3D.TXT on disk
	'  and will be read in a line at a time.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	DIM txt$(100)
	OPEN "INFO3D.TXT" FOR INPUT AS #1
	numLines% = 0
	WHILE (NOT (EOF(1)))
		LINE INPUT #1, aLine$
		aLine$ = RTRIM$(aLine$)
		numLines% = numLines% + 1
		txt$(numLines%) = aLine$
	WEND
	CLOSE #1

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Call the ViewList function, which takes care of the whole mess of
	'  making a window, scrolling the text, etc.  Even handles the mouse.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	ViewList txt$(), numLines%, 56, 8, 20, 12, 0, 7, ft%, 0, -1, "", mouseExists%


END SUB

SUB MenuDemo

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  This demo illustrates the MakeMenu% function.  It displays some text
	'  and a couple of buttons.  A menu pops up if the Menu button is pressed,
	'  and then the window displays which item the user selected.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
 
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Set the type of window frames to be used, based on whether or not we
	'  have color capability.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	DIM scr%(BlockSize%(55, 76, 10, 18))
	IF kolor% THEN
		ft1% = 6
		ft2% = 7
		bs% = STYLE3D
	ELSE
		ft1% = 0
		ft2% = 0
		bs% = STYLE2D
	END IF

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  If the mouse exists, turn it off while we display.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	IF mouseExists% THEN
		MouseHide
	END IF

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Add the primary window and buttons to the display.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	MakeWindow 7, 6, 23, 75, 0, 7, 0, ft1%, -1, 0, ""
	MakeWindow 9, 8, 19, 73, 0, 7, 0, ft2%, -1, 0, ""
	MakeWindow 20, 30, 22, 73, 0, 7, 0, ft2%, -1, 0, ""
	DrawButton SINGLEBORDER, 8, 20, 17, 22, 0, 7, "Done", bs%
	DrawButton SINGLEBORDER, 19, 20, 28, 22, 0, 7, "Menu", bs%

	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	'  Add text to the window.
	' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
	Center "QBSCR Menus", 8
	LOCATE 10, 10, 0: PRINT "You've seen the QBSCR MultiMenu routine in action.  The main";
	LOCATE 11, 10, 0: PRINT "pulldown menu is actually MultiMenu.  The MakeMenu% function";
	LOCATE 12, 10, 0: PRINT "creates a pop-up menu anywhere on the screen.  To see a sample";
	LOCATE 13, 10, 0: PRINT "menu, left-click the Menu button below or press the M key.  A";
	LOCATE 14, 10, 0: PRINT "menu will appear on the right side of the screen.  Select any";
	LOCATE 15, 10, 0: PRINT "of the items from the menu, and you choice will be echoed to";
	LOCATE 16, 10, 0: PRINT "the small text window below.";
	LOCATE 18, 10, 0: PRINT "To exit, left-click the Done key or hit the ESC or D key.";

	DIM m$(7)
	m$(1) = "^Chocolate"
	m$(2) = "^Popcorn"
	m$(3) = "P^otato Chips"
	m$(4) = "C^heese & Crackers"
	m$(5) = "Pret^zels"
	m$(6) = "P^eanuts"
	m$(7) = "C^arrot Sticks"

	done% = FALSE
	WHILE done% = FALSE

		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		'  If mouse is around, turn him on.
		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		IF mouseExists% THEN
			MouseShow
		END IF

		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		'  Use the QBSCR GetEvent% function to get mouse events and keyboard
		'  keypresses.
		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		result% = getEvent%(mouseExists%, kc%, mx%, my%)

		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		'  Decide what to do, if anything, based on the event returned by the
		'  getEvent routine.  If the Menu button was selected (by mouse or by
		'  keyboard), then save the screen where the menu will be displayed,
		'  make a window for the menu, execute the menu, restore the screen
		'  underneath the menu (thus removing the menu window from the screen),
		'  and finally display a message informing the user which option they
		'  chose from the menu.
		' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
		SELECT CASE result%
			CASE EMpressedLeft    ' Mouse left button pressed.
				IF (mx% >= 19) AND (mx% <= 28) AND (my% >= 20) AND (my% <= 22) THEN
					IF kolor% THEN
						DrawButton SINGLEBORDER, 19, 20, 28, 22, 0, 7, "Menu", bs%
					END IF
					IF mouseExists% THEN MouseHide
					BlockSave 55, 76, 10, 18, scr%(), GetVideoSegment!
					MakeWindow 10, 56, 18, 76, 0, 7, 0, ft1%, -1, 0, ""
					menuResult% = MakeMenu%(m$(), 7, "L", 58, 75, 11, "^", "|", 0, 7, 15, 0, 15, 7, mouseExists%)
					IF mouseExists% THEN MouseHide
					BlockRestore 55, 76, 10, 18, scr%(), GetVideoSegment!
					COLOR 0, 7
					LOCATE 21, 32, 0: PRINT SPACE$(40);
					LOCATE 21, 32, 0
					IF menuResult% = 0 THEN
						PRINT "You aborted the menu!";
					ELSE
						PRINT "You selected menu item"; menuResult%;
					END IF
				END IF
				IF (mx% >= 8) AND (mx% <= 17) AND (my% >= 20) AND (my% <= 22) THEN
					COLOR 0, 7
					LOCATE 21, 32, 0: PRINT SPACE$(40);
					LOCATE 21, 32, 0: PRINT "Goodbye!";
					PressButton SINGLEBORDER, 8, 20, 17, 22, 0, 7, "Done", bs%
					done% = TRUE
				END IF
			CASE EKpressed        ' Keyboard key pressed.
				IF kc% = ASC("M") OR kc% = ASC("m") THEN
					IF mouseExists% THEN MouseHide
					BlockSave 55, 76, 10, 18, scr%(), GetVideoSegment!
					MakeWindow 10, 56, 18, 76, 0, 7, 0, ft1%, -1, 0, ""
					menuResult% = MakeMenu%(m$(), 7, "L", 58, 75, 11, "^", "|", 0, 7, 15, 0, 15, 7, mouseExists%)
					IF mouseExists% THEN MouseHide
					BlockRestore 55, 76, 10, 18, scr%(), GetVideoSegment!
					COLOR 0, 7
					LOCATE 21, 32, 0: PRINT SPACE$(40);
					LOCATE 21, 32, 0
					IF menuResult% = 0 THEN
						PRINT "You aborted the menu!";
					ELSE
						PRINT "You selected menu item"; menuResult%;
					END IF
				END IF
				IF kc% = ASC("D") OR kc% = ASC("d") OR kc% = 27 THEN
					done% = TRUE
				END IF
			CASE ELSE
		END SELECT
	WEND

END SUB

