home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_BAS
/
MNUSYS22.ZIP
/
MLIBDEMO.BAS
< prev
next >
Wrap
BASIC Source File
|
1994-01-13
|
6KB
|
218 lines
'Menulib Demo Program
'Version 2.2
'(C) Copyright 1993, 1994 by Tim Gerchmez
'All Rights Reserved.
'Demonstrates some of the routines available
'in Menulib for Menusys.
'Note: Color and Mouse Required
'for this Demo.
$compile exe
$link "menusys.pbu"
$link "menulib.pbu"
$float procedure
public mouse%, segment& 'Mouse Flag and Video Segment
public msx%, msy%, lb%, rb% 'Mouse X and Y pos, Left/Right Buttons
public topcount%, bottomcount% 'Top/Bottom Menu Counts
public mainclr%, mainbckg% '"Main" Screen Colors
public clr%, bckg% 'Temporary (Current) Colors
public clr1%, clr2%, clr3% 'Alternate Character Colors
public bckg1%, bckg2%, bckg3% 'Alternate Background Colors
public helpfn$, progname$ 'Help File and Program Name
'Help filename should contain path as
'well as main filename.
'------------------------------------------------------------------------------
mouse% = 1: segment& = &HB800
mainclr% = 7: mainbckg% = 0
clr1% = 0: bckg1% = 7
bckg3% = bckg1%
clr2% = mainclr%
COLOR mainclr%, mainbckg%: CLS
CALL mhardreset(a%, b%)
'INFOBOX --------------------------------------------------------------------
REDIM msg$(9)
msg$(1) = " MenuLIB Test/Example Program"
msg$(2) = " (C) Copyright 1993 by Tim Gerchmez"
msg$(3) = ""
msg$(4) = "This program demonstrates some of the routines"
msg$(5) = "that are available in MENULIB for Menusys."
msg$(6) = ""
msg$(7) = "This is one of the routines, called INFOBOX, which"
msg$(8) = "displays information on the screen and waits for the"
msg$(9) = "user to select OK or press ENTER or ESC."
LOCATE 1, 1: PRINT "INFOBOX"
call sounds(1)
CALL infobox(msg$())
call sounds(2)
'CHOOSEBOX ------------------------------------------------------------------
REDIM msg$(3)
LOCATE 1, 1: PRINT "CHOOSEBOX"
msg$(1) = " Begin Program "
msg$(2) = ""
msg$(3) = " Are you sure ? "
CALL choosebox(msg$(), choice%)
IF choice% THEN END
'YESNOBOX -------------------------------------------------------------------
LOCATE 1, 1: PRINT "YESNOBOX "
CALL yesnobox("Are you positive you want to start?", c%)
IF c% <> 1 THEN END
'SELECTFORE SELECTBACK ------------------------------------------------------
LOCATE 1, 1: PRINT "SELECTFORE "
CALL selectfore(clr%)
LOCATE 1, 1: PRINT "SELECTBACK "
CALL selectback(bckg%)
mainclr% = clr%: mainbckg% = bckg%
COLOR mainclr%, mainbckg%: CLS
'BACKGROUND -----------------------------------------------------------------
CALL background(1)
'PICKLIST -------------------------------------------------------------------
REDIM lst$(1 TO 50)
FOR t% = 1 TO 50: lst$(t%) = "Choice Number" + STR$(t%)
NEXT t%
LOCATE 1, 1: PRINT "PICKLIST"
locate 1,10
CALL picklist(lst$(), ch%)
a$ = "You Chose Number" + STR$(ch%)
LOCATE 1, 1: PRINT "ALERTBOX"
CALL alertbox(a$)
ERASE lst$
CLS
'MARKLIST --------------------------------------------------------------------
REDIM lst$(1 : 50),mrk?(1 : 50)
FOR t% = 1 TO 50: lst$(t%) = "Selection " + STR$(t%)
NEXT t%
LOCATE 1, 1: PRINT "MARKLIST"
CALL marklist(lst$(), mrk?())
ERASE lst$, mrk?
CLS
'RADIOBOX -------------------------------------------------------------------
DIM optn$(1 TO 10)
FOR t% = 1 TO 10: optn$(t%) = "Option" + STR$(t%)
NEXT t%
title$ = "^Pick One"
LOCATE 1, 1: PRINT "RADIOBOX "
locate 6, 28:CALL radiobox(title$, optn$(), ch%)
a$ = "You Chose Number" + STR$(ch%)
LOCATE 1, 1: PRINT "ALERTBOX "
CALL alertbox(a$)
ERASE optn$
'MOUSEPICK ------------------------------------------------------------------
REDIM ypos%(5), xmin%(5), xmax%(5)
FOR t% = 2 TO 6: ypos%(t%-1) = t% * 2: NEXT t%
FOR t% = 1 TO 5: xmin%(t%) = 2: xmax%(t%) = 6: NEXT t%
LOCATE 4, 1: FOR t% = 1 TO 5: PRINT " ===== "; t%: PRINT : NEXT t%
LOCATE 1, 1: PRINT "MOUSEPICK "
LOCATE 15, 1: PRINT "Click on one of the five ===== bars"
WHILE pick% = 0
IF INKEY$ = CHR$(27) THEN GOTO clickedpoint
CALL mousepick(ypos%(), xmin%(), xmax%(), pick%)
WEND
clickedpoint:
a$ = "You clicked on #" + STR$(pick%)
LOCATE 1, 1: PRINT "ALERTBOX "
CALL alertbox(a$)
ERASE ypos%, xmin%, xmax%
CLS
'MESSAGEBOX -----------------------------------------------------------------
REDIM msg$(5)
title$ = "Choose a Text File to Display"
msg$(1) = "Choose a file to display using the mouse"
msg$(2) = "or keyboard. Make sure the file chosen"
msg$(3) = "is a pure text file! Also, make sure"
msg$(4) = "file is not too large, as it will be read"
msg$(5) = "into memory all at once."
LOCATE 1, 1: PRINT "MESSAGEBOX "
LOCATE 8, 35
CALL messagebox(title$, msg$())
'CHOOSEDIR ------------------------------------------------------------------
LOCATE 1, 1: PRINT "CHOOSEDIR "
CALL choosedir("*.*", ch$, 1)
IF ch$ = "" THEN
LOCATE 1, 1: PRINT "ALERTBOX "
a$ = "No File Selected!": CALL alertbox(a$)
GOTO testcheckandpick
END IF
'SHOWTEXTFILE ---------------------------------------------------------------
LOCATE 1, 1: PRINT "SHOWTEXTFILE "
CALL showtextfile(ch$, 15)
'CHECKBOX -------------------------------------------------------------------
testcheckandpick:
CLS
REDIM mb$(5), help$(5), mb%(5)
mb$(1) = "Selection One": mb$(2) = "Selection Two"
mb$(3) = "Selection Three": mb$(4) = "Selection Four"
mb$(5) = "Selection Five": title$ = "Test"
help$(1) = " Use Cursor Keys or Mouse to select -- ESC or Right Button to Cancel."
LOCATE 1, 1: PRINT "CHECKBOX"
LOCATE 5, 5
CALL checkbox(title$, mb$(), mb%())
'MENUPICK -------------------------------------------------------------------
LOCATE 1, 1: PRINT "MENUPICK "
locate 3,2
CALL menupick(title$, mb$(), help$(), choice%)
a$ = "You Chose Number" + STR$(choice%)
LOCATE 1, 1: PRINT "ALERTBOX "
CALL alertbox(a$)
'INPBOX -------------------------------------------------------------------
testinput:
LOCATE 1, 1: PRINT "INPBOX "
ip$ = "*.*"
CALL inpbox("File to Load:", ip$, 48, 12, 0, 255)
'ALERTBOX -------------------------------------------------------------------
testalert:
a$ = "You Chose " + ip$
IF ip$ = "" THEN a$ = "Command Cancelled"
LOCATE 1, 1: PRINT "ALERTBOX "
CALL alertbox(a$)