Oh, you're right -- this works fine:
Shoes.app :width => 840, :height => 700, :title => "Test" do
background white
ary=(0..10).to_a
stack :width => 280, :margin_top => 20, :margin_left => 10, :height
=> 600 do
background white
(0..ary.length-1).to_a.each_with_index do | e, i |
flow do
background( i % 2 == 0 ? lightblue : white )
para e, :size => 8
click do
alert "clicked flow #{i}"
end
end
end
end
end
I'm not sure exactly what in Martin's original example was keeping the
click from working correctly.
On Jul 26, 2008, at 2:26 AM, _why wrote:
On Sat, Jul 26, 2008 at 12:28:29AM -0400, Edward Heil wrote:
Each slot can have its own click handler, but it's sometimes tricky
getting
the handler assigned to the right slot. You might put a click
handler
inside a flow's block, but the click handler will get assigned to
the app
as a whole instead of the flow unless you specifically tell it
otherwise.
One way to do it is to assign the slot explicitly with a variable
and call
"click" as a method on that variable:
@this_flow = flow
@this_flow.append { para "whatever " }
@this_flow.click { alert "clicked this flow" }
but that's kind of unpleasant.
You're probably doing this inside a widget? I've had to do this in
a widget before. I'll put this on my list here.
_why