home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / libbasic / buttons1.bas < prev    next >
BASIC Source File  |  1994-04-23  |  2KB  |  87 lines

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