home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / b / bb13.zip / SAMPLEM1.BAS < prev   
BASIC Source File  |  1992-12-15  |  2KB  |  86 lines

  1.  
  2.  
  3. rem
  4. rem This program is a simple example of using menu's.
  5. rem
  6. rem In this case we display the current time and the user can select
  7. rem the color of the background using a menu.  The current color
  8. rem will be 'grayed' so it cannot be selected.
  9. rem
  10. rem This program is only for Windows use.
  11. rem
  12.  
  13.  
  14.   y=mouseon
  15.  
  16.   rem
  17.   rem define my menu bar at top of screen
  18.   rem
  19.   mainmenu "&Color","","","","",""
  20.  
  21.   rem
  22.   rem define menu items
  23.   rem
  24.   rem  the '&' symbol tells windows what keyboard shortcut will select this
  25.   addsubmenu 1,"&Black",1059
  26.   addsubmenu 1,"&Red",1060
  27.   addsubmenu 1,"",0
  28.   addsubmenu 1,"&Blue",1061
  29.  
  30.   bcolor=1
  31.   color 7,bcolor
  32.   cls
  33.   menuitemgray 1061
  34.  
  35. 100
  36.   t$=time$
  37.   if t$<>oldt$ then
  38.     oldt$=t$
  39.     locate 12,35,0
  40.     print t$;
  41.   end if
  42.   a$=inkey$
  43.   if a$="" then goto 100
  44.  
  45.   if len(a$)=1 then goto 100
  46.  
  47.   if right$(a$,1)=chr$(59) then
  48.     rem
  49.     rem change to black
  50.     rem
  51.     menuitemon 1060
  52.     menuitemon 1061
  53.     menuitemgray 1059
  54.     bcolor=0
  55.     color 7,bcolor
  56.     cls
  57.     oldt$=""
  58.  
  59.   elseif right$(a$,1)=chr$(60) then
  60.     rem
  61.     rem change to red
  62.     rem
  63.     menuitemon 1059
  64.     menuitemon 1061
  65.     menuitemgray 1060
  66.     bcolor=4
  67.     color 7,bcolor
  68.     cls
  69.     oldt$=""
  70.  
  71.   elseif right$(a$,1)=chr$(61) then
  72.     rem
  73.     rem change to white
  74.     rem
  75.     menuitemon 1059
  76.     menuitemon 1060
  77.     menuitemgray 1061
  78.     bcolor=1
  79.     color 7,bcolor
  80.     cls
  81.     oldt$=""
  82.  
  83.   end if
  84.   goto 100
  85.  
  86.