Hi Josh, Seth et al,

I've tried the other solution. :-D

class Examplish < Shoes
  url "/", :index
  url "/new", :new_window

  def index
    header self
    para link "make a new window", :click => "/new"
  end

  def new_window
    window  :title => 'child' do
      owner.header self
      para "a new window"
    end
  end

  def header win
    win.para "header : #{win}\n"
  end
end

Shoes.app :title => 'parent'

On Sun, Nov 2, 2008 at 3:32 PM, Seth Thomas Rasmussen <
[EMAIL PROTECTED]> wrote:

> On Sun, Nov 2, 2008 at 1:59 AM, Josh Cronemeyer
> <[EMAIL PROTECTED]> wrote:
> > Basic usage question follows:
> >
> > #!/usr/bin/env open -a Shoes.app
> > class Examplish < Shoes
> >
> > url "/", :index
> > url "/new", :new_window
> >
> >
> > def index
> >  header
> >  para link "make a new window", :click => "/new"
> >
> > end
> >
> > def new_window
> >  window do
> >    header
> >    para "a new window"
> >
> >  end
> > end
> >
> > def header
> >   para "header"
> > end
> >
> > end
> > Shoes.app
> >
> >
> > In the above code the header method is not available inside of the window
> > block.  Is there a good way to make a method from the parent window
> > available on the child?
>
> I dunno if it's good, but this seems to work:
>
> #!/usr/bin/env open -a Shoes.app
>
> class ::Shoes
>   def header
>    para "header"
>  end
> end
>
> class Examplish < Shoes
>  url "/", :index
>  url "/new", :new_window
>
>  def index
>    header
>    para link "make a new window", :click => "/new"
>  end
>
>  def new_window
>    window do
>      header
>      para "a new window"
>    end
>  end
> end
>
> Shoes.app
>
> ###
>
> It seems that window() creates a new instance of a Shoes app or
> something which somehow has no understanding of the app which spawned
> it.
>
> Note that if you say "class Shoes" without the leading "::" the app
> somehow ends up not knowing what "url" means. At least that's what I
> found just now with "shoes raisins (0.r1064) [i686-darwin8.9.1]".
>
> The unusual context within which the main file is executed seems to
> continually be a problem. It would be nice for it to behave like a
> normal person.
>
> --
> Seth Thomas Rasmussen
> http://greatseth.com
>

Reply via email to