shoes / shoes3

a tiny graphical app kit for ruby
http://walkabout.mvmanila.com
Other
181 stars 19 forks source link

Shoes App, Window and Dialog finish events are not working #25

Open IanTrudel opened 9 years ago

IanTrudel commented 9 years ago

Shoes App, Window and Dialog finish events are not working. The following code should cause an alert to pop up when each window is closed but the finish event is never fired up.

Shoes.app(:title => "Shoes Events", :width => 450, :height => 250) {
   start { |n| para "starting #{n}\n" }
   finish { |n| alert "finishing #{n}" }
   window(:title => "Window Events", :resizable => false) {
      finish { |n| alert "finishing #{n}" }
   }
   dialog(:title => "Dialog Events", :resizable => false) {
      finish { |n| alert "finishing #{n}" }
   }
}

TEMPORARY WORKAROUND

Shoes.app(:title => "Shoes Events", :width => 450, :height => 250) {
   start { |n| para "starting #{n}\n" }
   stack { finish { |n| alert "finishing #{n}" } }
}
ccoupe commented 9 years ago

A slightly more useful example

Shoes.app(:title => "Shoes Events", :width => 450, :height => 250) {
   start { |n| para "starting #{n}\n" }
   stack { finish { |n| alert "finishing #{n}" } }
   window(:title => "Window Events", :resizable => false) {
     stack do
      finish { |n| alert "finishing #{n}" }
     end
   }
}

start and finish(in particular) don't work with the 'default' slot setup of Shoes.app. I know of cases where the default is sometimes a flow and sometimes it's a stack and sometimes (this case) it's neither.

As you've noted in other bug reports, Shoes.app, APPS[], and self.app are confusing and insufficient in documentation and lacking functionality. It's always been a confusing area in Shoes.