ashbb,
i don't _need_ multiple windows... but i did want to use them. Thanks for
the sample code (and screenshots!)
My takeaway from this thread is that shoes treats child windows more like
red headed stepchild windows :) Url navigation from a child window requires
some acrobatics. One thing you can't do it seems is to put a link on a
child page that goes to a place defined on the parent. For example in the
following code getting the child window to go to neverland cant happen,
right?
#!/usr/bin/env open -a Shoes.app
class Bummer < Shoes
url "/", :index
url "/cleveland", :cleveland
url "/neverland", :neverland
def index
stack do
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 => "/neverland")
end
end
visit "/"
end
def neverland
para "cherries, syrup, puppies"
end
end
Shoes.app :title => "bummer"
I suppose not doing much with multiple windows follows from the decision to
make shoes 'web-like'. Anyway, thanks for all the multi window tips and
tricks. I'm sure they will come in handy, but in the end I think that
because of the way url and link work I'm stuck just using one window for url
style navigation.
On Tue, Nov 11, 2008 at 10:51 AM, Satoshi Asakawa <[EMAIL PROTECTED]> wrote:
> Hi Josh,
>
> Do you really need to open multiple windows?
> If not, the following code works well.
>
> class Bummer < Shoes
> url "/", :index
> url "/cleveland", :cleveland
> url "/neverland", :neverland
>
> def index
> para link("go to cleveland", :click => "/cleveland")
> end
>
> def cleveland
> #window :title => "cleveland" do
> para link("go to neverland", :click => "/neverland")
> #end
> #visit "/"
> end
>
> def neverland
> para "cherries, syrup, puppies"
> end
> end
>
> Shoes.app :title => "bummer"
>
>
> But if you need to open multiple windows and send some messages between
> them, the following sample might be of help.
>
>
> http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00530_Open_a_new_app_window.mdown
>
> Regards,
> ashbb
>
>
>
> On Wed, Nov 12, 2008 at 12:23 AM, Seth Thomas Rasmussen <
> [EMAIL PROTECTED]> wrote:
>
>> 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
>>
>
>