home *** CD-ROM | disk | FTP | other *** search
- ***************************************************************************
- ** MENU2.PRG
- ** (C) Copyright 1990-92, Sub Rosa Publishing Inc.
- **
- ** A demonstration program provided to VP-Info users.
- ** This program may be copied freely. If it is used in commercial code,
- ** please credit the source, Sub Rosa Publishing Inc.
- **
- ** MENU2 demonstrates the use of the MENU() function along with a variety
- ** of Info commands and functions.
- **
- ** MENU2 displays a menu, determines the choice made, and takes
- ** action depending both on the selection and the key used to make
- ** the selection.
- **
- ** MENU2 is compatible with all current versions of VP-Info.
- **
- ** Sid Bursten and Bernie Melman
- ***************************************************************************
- IF :color <> 7
- SET color to 31; white on blue
- ENDIF
- SET WIDTH to 80
- COLOR :color,0,0,24,79,177 ;fill screen with pattern
- * 177 is the fill character ▒.
- COLOR 112,7,20,21,66 ;draw black box to become shadow
- WINDOW 6,18,19,62 DOUBLE COLOR :color ;declare space for menu text
- ON escape
- CURSOR 22,0
- WINDOW
- CANCEL
- ENDON
- DO WHILE t ;put main menu in an infinite loop
- ERASE ;fills window with blanks
- TEXT
-
- DEMO MAIN MENU
-
- 0. Exit to Sample Programs Menu
-
- 1. Branch 1 of sample program
- 2. Do not choose this option
- 3. Branch 3 - choose with function key
- 4. Do not choose this option
- 5. Run the demo program EDBROW
- 6. Exit to Conversational VP-Info
- 7. Return to Main Demonstration Menu
- ENDTEXT
- CURSOR 12,25 ; positions menu cursor over 1st character of 1st choice
- selection=menu(7,37) ;seven choices menu bar width 37
- DO CASE
- CASE selection=0 .or. :key=327 ; <home> key
- CHAIN samples
- CASE selection=1
- IF :key = 13
- @ 20,21 say " CHOSEN WITH ENTER KEY! Press any key. "
- ELSE
- IF :key < 255
- @ 20,21 say " CHOSEN WITH KEY "+chr(:key)+" Press any key. "
- ELSE
- @ 20,21 say " KEY WITH Info code "+str(:key,3)+" Press any key. "
- ENDIF
- ENDIF
- dummy=inkey() ;wait for keystroke
- @ 20,21 say blank(40,205)
- CASE selection=3
- IF (:key < 315) .or. (:key > 324)
- @ 20,21 say " NOT A Function KEY! Press any key. "
- ELSE
- @ 20,21 say " CHOSEN WITH F"+str(:key-314,2)+". Press any key. "
- ENDIF
- DUMMY = inkey()
- @ 20,21 say blank(40,205)
- CASE selection=5
- CHAIN EDBROW
- CASE selection=6
- WINDOW ;reset window to full screen
- ERASE ;clear screen
- CANCEL
- CASE selection=7
- CHAIN samples
- WINDOW ;reset window to full screen
- OTHERWISE
- @ 20,21 say " ILLEGAL CHOICE! Press any key. "
- DUMMY = inkey()
- @ 20,21 say blank(40,205) ;205 rebuilds double box
- ENDCASE
- ENDDO
- *
- * *** end of MENU.PRG ***
-