home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / Basic / QWINDO.ZIP / PULLMENU.BAS < prev    next >
Encoding:
BASIC Source File  |  1990-01-01  |  2.8 KB  |  72 lines

  1. '****************************************************************************
  2. ' PULLMENU.BAS - Pull down menu demonstration
  3. '****************************************************************************
  4. REM $DYNAMIC
  5. DEFINT A-Z              'Make all variables integers by default.
  6. CALL QWINIT(4)          'Need to call this command before using any QW commands.
  7.  
  8. CLS                     'Clear the screen.
  9. DIM SHARED menu$(16)    'Dimension string array for up to 16 menu items.
  10. DIM SHARED bar$(10)
  11. DIM SHARED kb(10)
  12. DIM SHARED w(2048)      'Dimension integer array for window.
  13. nummenus = 6            '6 menus across top (Could be up to 10)
  14. barattr = &H40
  15.  
  16. '------------- Setup Arrays describing the menus. ---------------
  17. ' To setup the menubar & menus themselves, we use DATA statements.
  18. ' You could initialize the arrays separately & explicitly if desired.
  19.  
  20. '---- Read in strings for MENU BAR, and the associated key values ---
  21. DATA File,8448,Edit,4608,View,12032,Search,7936,Midi,12800,Comm,11776
  22. FOR i = 0 TO nummenus - 1
  23.     READ bar$(i), kb(i)
  24. NEXT i
  25. CALL MENUBAR(nummenus, barattr, kb(), VARPTR(bar$(0)))
  26.  
  27. '---- Read in each of the menu options & xfer into internal storage ----
  28. DATA 7,"TITLE",Load,Save,Open,Close,Print,Shell,Quit      : 'Menu 1
  29. DATA 4,"",Undo,Cut,Copy,Paste                             : 'Menu 2
  30. DATA 2,"",Options,Windows                                 : 'Menu 3
  31. DATA 4,"",Find,Selected Text,Repeat Last Find,Change      : 'Menu 4
  32. DATA 2,"",Record,Playback                                 : 'Menu 5
  33. DATA 3,"",Receive File,Send File,Comm Parameters          : 'Menu 6
  34. DATA 4,"",Chicago,New York,Helvetica,Elite                : 'Menu 7
  35. DATA 16,"",5,8,9,10,12,14,16,20,24,30,32,36,40,48,60,72   : 'Menu 8
  36. DATA 7,"",None,Single,Double,Light,Medium,Dark,Solid      : 'Menu 9
  37. DATA 5,"","!!!!!","#####","%%%%%","&&&&&","*****"         : 'Menu 10
  38. FOR i = 1 TO nummenus
  39.     READ msize, menu$(0)
  40.     FOR j = 1 TO msize: READ a$: menu$(j) = "  " + a$: NEXT j
  41.     CALL MENUSET(i, msize, 2, 10, 15, 7, -1, VARPTR(menu$(0)))
  42. NEXT i
  43.  
  44. '---- Turn on menu bar ----
  45. CALL MENUON
  46.  
  47. '---- Open a window for status information. ----
  48. id = 1
  49. CALL WOPEN(1, 2, 80, 24, 2, 2, "SAMPLE WINDOW", w(), id)
  50. CALL WCOLOR(id, &H17)
  51. CALL WCLS(id)
  52. CALL WLOCATE(id, 2, 13)
  53. CALL WPRINT(id, " Hold ALT key down & Press first letter of menu.")
  54. '--- We can disable a menu option(s) ----
  55. CALL MENUOPTION(1, 2, 0)
  56. CALL MENUOPTION(1, 4, 0)
  57.  
  58. DO
  59.     CALL MENUGET(m, o, f)
  60. LOOP WHILE f = 0
  61.  
  62. stat$ = "~~ Menu: " + STR$(m) + "~ Option: " + STR$(o) + "~ Flag: " + STR$(f)
  63. CALL WCLS(id)
  64. CALL WLOCATE(id, 4, 13)
  65. CALL WPRINT(id, stat$)
  66. CALL WPRINT(id, "~~    Press ANY key to close window.")
  67. WHILE INKEY$ = "": WEND
  68. CALL WCLOSE(id)         'Close our status window.
  69. CALL MENUOFF            'Turn off menu system.
  70. END
  71.  
  72.