home *** CD-ROM | disk | FTP | other *** search
/ HomeWare 14 / HOMEWARE14.bin / os2 / lbasic04.arj / MENUDEMO.BAS < prev    next >
BASIC Source File  |  1994-02-18  |  2KB  |  87 lines

  1.  
  2.     ' This is a turtle graphics demo
  3.     ' using pull down menus.  This is a
  4.     ' Liberty BASIC for Windows program
  5.     ' and it runs fine under the OS/2
  6.     ' version of Liberty BASIC
  7.  
  8.     size$ = "100"
  9.     size = val(size$)
  10.     color$ = "black"
  11.  
  12.     button #1, Triangle, [triangle], LR, 140, 5
  13.     button #1, Square, [square], LR, 84, 5
  14.     button #1, Size, [size], LR, 44, 5
  15.     button #1, Quit, [quit], LR, 5, 5
  16.     button #1, Red, [colorRed], UL, 5, 5
  17.     button #1, Blue, [colorBlue], UL, 45, 5
  18.     button #1, Green, [colorGreen], UL, 85, 5
  19.     menu #1, &Colors, &red, [colorRed], &blue, [colorBlue], &green, [colorGreen]
  20.     menu #1, &Graph, &square, [square], &triangle, [triangle], &size, [size], |, &quit, [quit]
  21.     open "This is a turtle graphics window!" for graphics as #1
  22.  
  23.     print"Press one of the buttons in the graphics window"
  24.  
  25. [loop]
  26.     input a$
  27.     goto [loop]
  28.  
  29.  
  30. [triangle]
  31.  
  32.     print #1, "color "; color$
  33.     print #1, "cls ; home ; down ; north"
  34.  
  35.     for x = 1 to size
  36.         print #1, "turn 122 ; go "; str$(x*2)
  37.     next x
  38.  
  39.     print #1, "flush"
  40.     goto [loop]
  41.  
  42.  
  43. [square]
  44.  
  45.     print #1, "color "; color$
  46.     print #1, "cls ; home ; down ; north"
  47.  
  48.     for x = 1 to size
  49.         print #1, "turn 88 ; go "; str$(x*2)
  50.     next x
  51.  
  52.     print #1, "flush"
  53.     goto [loop]
  54.  
  55.  
  56. [colorRed]
  57.  
  58.     color$ = "red"
  59.     goto [loop]
  60.  
  61.  
  62. [colorBlue]
  63.  
  64.     color$ = "blue"
  65.     goto [loop]
  66.  
  67.  
  68. [colorGreen]
  69.  
  70.     color$ = "green"
  71.     goto [loop]
  72.  
  73. [size]
  74.  
  75.     prompt "What size figure?"; size$
  76.     size = val(size$)
  77.     if size < 1 then beep : goto [size]
  78.     goto [loop]
  79.  
  80.  
  81. [quit]
  82.     confirm "Do you want to quit?"; quit$
  83.     if quit$ = "no" then [loop]
  84.     close #1
  85.     end
  86.  
  87.