Risanje likov


to risanje
  windowcreate "root "w1 [Nariši lik] 0 0 150 110 []
  setup
end

to setup
  staticcreate "w1 "t1 [Izberi lik:] 5 10 50 10
  listboxcreate "w1 "l1 5 20 80 30
  listboxaddstring "l1 "kvadrat
  listboxaddstring "l1 "trikotnik
  listboxaddstring "l1 "šestkotnik

  staticcreate "w1 "t2 [] 5 60 60 10
  scrollbarcreate "w1 "s1 5 70 80 10 [rdeča]
  scrollbarset "s1 0 255 128
  rdeča

  buttoncreate "w1 "b1 "Nariši 100 20 40 15 [nariši]
  buttoncreate "w1 "b2 "Pobriši 100 40 40 15 [cs]
  buttoncreate "w1 "b3 "Konec 100 60 40 15 [windowdelete "w1]
end

to nariši
  setpencolor (list scrollbarget "s1 0 0)
  if equalp listboxgetselect "l1 [kvadrat]    [repeat 4 [fd 100 rt 90]]
  if equalp listboxgetselect "l1 [trikotnik]  [repeat 3 [fd 100 rt 120]]
  if equalp listboxgetselect "l1 [šestkotnik] [repeat 6 [fd 100 rt 60]]
end

to rdeča
  staticupdate "t2 sentence [Rdeča =] scrollbarget "s1
end