home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / qlib.zip / XMEN.BAS < prev    next >
BASIC Source File  |  1991-01-28  |  3KB  |  71 lines

  1. DECLARE FUNCTION MENU% (A$)
  2. DECLARE FUNCTION MENINIT% ()
  3. DECLARE SUB CLMENU ()
  4. DECLARE SUB LDMENU (A$)
  5. DECLARE SUB MENFO ()
  6. DECLARE SUB TITLE (A$,B$,C$,N%)
  7.  
  8. TITLE "XMEN - Menu Demo","Ver. 01.00.00","1990",0
  9.  
  10. CYC: IF N%=0 THEN N%=MENINIT%                 ' If no menu items then initialize
  11.      I%=MENU%("MENU DEMO PROGRAM")            ' Run menu screen
  12.      IF I%=66 THEN N%=N%+1                    ' If input B then increment items
  13.  
  14.      IF I%=27 THEN GOTO XIT                   ' Exit if ESC
  15.  
  16.      IF I%=65 THEN                            ' Print info screen if A
  17.         MENFO
  18.      ELSEIF I%=66 AND N%<=20 THEN             ' Add item if B and items < 20
  19.         IF N%=3 THEN                          ' Load clear prompt if C
  20.            LDMENU "Clear Menu To Two Items"
  21.         ELSE                                  ' Load item # prompt if > C
  22.            LDMENU "Item Number"+STR$(N)
  23.         END IF
  24.      ELSEIF I%=67 THEN                        ' Clear and set items to 0 if C
  25.         CLMENU
  26.         N%=0
  27.      ELSEIF I%=>66 AND I%<=84 THEN            ' Print key push message
  28.         CLS
  29.         LOCATE 13,30
  30.         PRINT "You Pressed ";CHR$(I%);
  31.         BEEP
  32.         SLEEP 1
  33.      END IF
  34.      GOTO CYC
  35. XIT: CLS
  36. END
  37.  
  38. FUNCTION MENINIT%                              ' Create basic two item menu
  39.     LDMENU "Menu Information"
  40.     LDMENU "Increase Menu List"
  41.     MENINIT%=2
  42. END FUNCTION
  43.  
  44. SUB MENFO                                     ' Print menu info screen
  45.     CLS
  46.     LOCATE 4,1
  47.     PRINT STRING$(80,178)
  48.     DO 
  49.           READ A$
  50.           IF A$<>"END" THEN PRINT USING "▓▓  \"+SPACE$(70)+"\  ▓▓";A$
  51.     LOOP UNTIL A$="END"
  52.     PRINT STRING$(80,178)
  53.     PRINT
  54.     COLOR 0,7
  55.     PRINT " ANY KEY TO RETURN TO MENU ";
  56.     A$=INPUT$(1)
  57.     RESTORE
  58. END SUB
  59.  
  60. DATA ,"This program demonstrates the MENU sub routine by using a sample menu to"
  61. DATA "show how you can expand or decrease a menu in your applications through"
  62. DATA "program instructions."," "
  63. DATA "The decrease command in this demo clears the menu and reenters the first"
  64. DATA "two menu items.  In regular programs you can clear it and add any number"
  65. DATA "of new items."," "
  66. DATA "You can also write routines to selectively clear an item, however, this"
  67. DATA "will not disable the display of the key cleared, nor the passing of the"
  68. DATA "key value on input by the menu.  If you selectively blank a key you must"
  69. DATA "also write a routine in your program to deal with signals received from"
  70. DATA "keys assigned to empty items.","","END"
  71.