On Thu, Jul 17, 2008 at 12:28:21PM +0200, Jo Vermeulen wrote:
> I modified it a bit, and I get the rectangles, but when I click OK, the
> window is just blank, it doesn't recreate the rectangles and button. Here's
> my code:

Here's an updated version:

  Shoes.app :width => 400, :height => 500 do
    rectangles = proc do
      20.times do
        nostroke
        fill rgb(rand(0.6) + 0.4, rand(0.1) + 0.9, rand(0.2) + 0.8, rand(0.4) + 
0.1)
        r = rand(300) + 60 # radius
        rect rand(100), rand(200), r, r
      end
      button "OK", :top => 300, :left => 400 do
        # clear wipes out the window and uses the passed block to repaint
        # it again.
        clear &rectangles
      end
    end
    rectangles.call
  end
  
I'll update the blog entry as well.  Thankyou!

_why

Reply via email to