Satoshi,
I think when you click the link the initial window is erased. Make sure you
check the parent window before you close the child to make sure the content
is still there. My understanding is that since we have clicked a link shoes
expects us to actaully go somewhere and it is clearing the page in
anticipation of that. The new_window method can end with a visit "/"
statement. And that takes care of the blankness. I too found this behavior
a bit surprising initially. Perhaps shoes shouldn't wipe the page when
visiting a link that creates a new window, but this behavior doesn't really
bother me. The fact that I have to make strange gyrations in order to do
something as fundamental as share code seems more concerning.
On Sun, Nov 2, 2008 at 6:03 AM, Abdullah Mancy <[EMAIL PROTECTED]> wrote:
> i've tried the 3 examples on WinXP ..
>
> when the new window closed, the content of the initial window gets erased!!
>
> On Sun, Nov 2, 2008 at 12:12 PM, Satoshi Asakawa <[EMAIL PROTECTED]> wrote:
> > 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
> >
> >
>
>
>
> --
> Mancy
> CTO, eCribz Inc.
> Web Developer, Holibyte Online Solutions
> Phone USA: +1 (571) 366-7780
> Phone UK: +44 (207) 193-3999
> Fax: +1 (206) 691-8377
>
> PS. http://www.rasoulallah.net/
> http://www.youtube.com/watch?v=YBTS4JwyDLc
>