Re: closure & slot
- From:
- Régis d'Aubarède
- Date:
- 2011-09-16 @ 14:41
Oups,
A solution with instance_eval() :
def show_popup(title,w=400,h=200,&blk)
Shoes.app(:title=> title,:width=>w,:height=>h) do
stack do
@box=stack :height=>(h-40)do
title "#{title}..."
instance_eval(&blk)
#-------------------------
end
flow :width=> 400 do
button("Exit",:width => 200) { self.close_dialog }
end
end
end
end
2011/9/16 Régis d'Aubarède <regis.aubarede@gmail.com>
> Hello,
>
> A very stupid question : in this code, why "Bonjour" appear in main window,
> an not in the popup ?
>
> require 'green_shoes'
> def show_popup(title,w=400,h=200)
> a=Shoes.app(:title=> title,:width=>w,:height=>h) do
> stack do
> @box=stack :height=>(h-40)do
> title "#{title}..."
> yield
> end
> flow :width=> 400 do
> button(" Exit
> ",:width => 200) { self.close_dialog }
> end
> end
> end
> end
>
>
> Shoes.app :title=>"Test", :width => 300, :height => 200 do
> para " "
> button "action" do
> show_popup("The popup") do
> para "Bonjour ... should be in popup ?!.."
> end
> end
> end
>
> Thank you,
>
>
> --
>
> - - - - - - - - - - - - - - - - -
> __ ___ __ . __
> |__) |__ / _` | /__`
> | \ |___ \__> L| .__/
>
> http://regisaubarede.posterous.com/
> - - - - - - - - - - - - - - - - -
>
>
>
--
- - - - - - - - - - - - - - - - -
__ ___ __ . __
|__) |__ / _` | /__`
| \ |___ \__> L| .__/
http://regisaubarede.posterous.com/
- - - - - - - - - - - - - - - - -
Re: [shoes] Re: closure & slot
- From:
- ashbb
- Date:
- 2011-09-16 @ 14:47
Hi Regis,
Yeah, pay attention to `self`. ;-)
ashbb