What's going on in the below code? I expected each number to capture
the current value of i in its click callback, but every click says
"10"

martin

Shoes.app :width => 840, :height => 700, :title => "Test" do

  def list_view(ary)
    i = -1
    ary.map {|e|
      i = i + 1
      flow do
        background (i % 2 == 0 ? lightblue : white)
        para e, :size => 8
        click do
          alert i
        end
      end
    }
  end

  background white

  stack :width => 280, :margin_top => 20, :margin_left => 10, :height => 600 do
    @listview = stack :width => 275, :margin => 10,  :height => 580,
:scroll => true do
      background white
      append do
        list_view (0..10).to_a
      end
    end
  end
end

Reply via email to