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

  1. '********************************************************************
  2. 'POPMENU1.BAS - A SAMPLE POP-UP MENU EXAMPLE
  3. 'POPMENU1 is like POPMENU, but lets you set attributes (colors) for
  4. 'each item in the menu.
  5. '********************************************************************
  6. REM $DYNAMIC
  7. DEFINT A-Z              'Make all variables integers by default.
  8. DIM w(2000)             'Dimension an integer array for our window.
  9. CALL QWINIT(4)          'Need to call this command before using any QW commands.
  10. CLS                     'Clear the screen.
  11.  
  12. DIM SHARED m$(16)       'Define String array to hold menu items.
  13. DIM SHARED cattr(16)    'Define integer array to hold attributes.
  14. style = 2               'Make menu border double lined.
  15. borderattr = 2          'Set attribute for border =
  16. x = 30                  'Begin at column 25.
  17. y = 6                   '& Row 6
  18. max = 15                'Set # of items in menu = 15
  19.         
  20. '---- Load integer array with attributes for menu items ----
  21. FOR i = 0 TO max
  22.     cattr(i) = i + 1
  23. NEXT i
  24.  
  25. ' ----- Array element (0) is used for the menus title -----
  26. m$(0) = "Help Menu"
  27.  
  28. '--- Load string array for menu items from data statements. ----
  29. DATA WOPEN,WCLOSE,WCLOSEALL,WPRINT,WLOCATE,WCSRPOS,WCLS, WCOLOR
  30. DATA WWRAP,WCOPYSTR, WSETCSR,WCSRON,WCSROFF,WMOUSE,POPMENU
  31. FOR i = 1 TO max
  32.    READ a$
  33.    m$(i) = "  " + a$
  34. NEXT i
  35.  
  36. LOCATE 3, 40
  37. PRINT "POPMENU1 - ALLOWS YOU TO SET DIFFERENT COLORS FOR EACH MENU ITEM"
  38.  
  39. kb = 1: 'Allow F1 to exit the popmenu function. Result of key pressed in KB.
  40. CALL POPMENU1(curel, kb, style, borderattr, cattr(), x, y, max, VARPTR(m$(0)))
  41.  
  42. LOCATE 16, 1: PRINT "Keyboard exit value: "; kb;
  43. LOCATE 17, 1
  44. IF curel = 0 THEN
  45.     PRINT "No options selected."
  46. ELSE
  47.     PRINT "You've selected menu option:  "; curel; "-->"; m$(curel)
  48. END IF
  49. PRINT "PRESS ANY KEY"
  50. WHILE INKEY$ = "": WEND
  51. END
  52.  
  53.  
  54.