On Tue, Nov 11, 2008 at 8:14 AM, Josh Cronemeyer
<[EMAIL PROTECTED]> wrote:
> So i got this response from brian off-list
>
> <quoth brian>
> While trying this, I found that I had to kill and re-open shoes to get it t
> reload the changed .rb file,  don't know what's up with that.

I dunno either, but I just do it now as a sort of rule. It's easy
enough to do that I don't really care that it seems like a bug.

> class Bummer < Shoes
>   url "/", :index
>   url "/cleveland", :cleveland
>   url "/neverland", :neverland
>
>   def index
>       stack do
>         para link("rather, go to neverland", :click =>"/neverland")
>         para link("go to cleveland", :click => "/cleveland")
>
>     end
>   end
>
>   def cleveland
>     window :title => "cleveland", :width =>200, :height=>200 do
>       stack do
>         para link("go to neverland", :click => lambda
> {$main.visit("/neverland")})
>         para link("go to crocodile", :click => lambda {clear ; para "tick
> tock"})
>       end
>     end
>     visit "/"
>   end
>
>   def neverland
>     para "cherries, syrup, puppies"
>   end
> end
>
> $main=Shoes.app :title => "bummer"
> </quoth brian>
>
> and hey.  that works. woo. I had tried a proc, but not a lambda...  I guess
> that makes some sense because of the app object weirdness.

I don't think the difference between proc and lambda is significant
here. It's the fact that your actions are only defined for the main
app instance. window() creates a context that is basically a new
instance of an app. I think you could achieve what you did with your
dreaded global variable with Shoes owner() method.

-- 
Seth Thomas Rasmussen
http://greatseth.com

Reply via email to