Fwd: Re: [shoes] [green_shoes]:symbol vs .method
- From:
- Catsquotl
- Date:
- 2011-03-04 @ 16:38
Hi Elias,
Ehm. i didn't actualy. so i' googled and did get a little wiser..
Your code may work in shoes..
But as I am trying to write in green_shoes I got the following error.
----------------
naamloos.rb:7:in `block in <main>': undefined method `choose' for
#[Shoes::ListB
ox:0x33b5530] (NoMethodError)
from
c:/ruby192/lib/ruby/gems/1.9.1/gems/green_shoes-0.176.0/lib/shoes/m
ain.rb:77:in `instance_eval'
from
c:/ruby192/lib/ruby/gems/1.9.1/gems/green_shoes-0.176.0/lib/shoes/m
ain.rb:77:in `app'
from naamloos.rb:2:in `<main>'
-------------------------------------------
I have seen similar errors all morning.
Maybe those methods aren't implemented yet in green_shoes.
Eelco
Op 4-3-2011 14:50, Elias Crespin schreef:
> Hello Eelco,
>
> After re-reading your mail, I figured out you already knew
> this....sorry for my context blindness.
>
> I tried this code and it works fine. Maybe now I am helpful....
>
> Shoes.app do
> para "Choose a fruit:"
> @lb = list_box :items => ["Grapes", "Pears", "Apricots"],
> :width => 120
> @fruit = para "No fruit selected"
> @lb.choose ( "Pears" )
> @lb.change do |list|
> @fruit.text = list.text
> end
> end
>
>
> Elias Crespin.
>
>
> On Fri, Mar 4, 2011 at 2:12 PM, Elias Crespin <elias.crespin@gmail.com
> <mailto:elias.crespin@gmail.com>> wrote:
>
> Hi Eelco,
>
> This syntax is ruby's responsibility.
>
> It is required because hashes are used to implement named
> parameters to call the list_box initializer method. In the example
> you are calling the list_box constructor or initializer method
> with parameters items and choose.
>
> A start explanation for named parameters in ruby can be found here
> http://ruby.about.com/od/advancedruby/qt/opthash.htm
>
> You may also google "ruby named parameters" or "ruby hash method
> parameters" (without the quotes)
>
> Hope this helps.
>
> Elias Crespin.
>
>
>
> On Fri, Mar 4, 2011 at 1:42 PM, Catsquotl <catsquotl@gmail.com
> <mailto:catsquotl@gmail.com>> wrote:
>
> Hi,
>
> Can someone please explain why i can write.
> list_box :items =>@m, :choose =>"#{@m[1]}" do
> some code here
> end
>
> but not.
> @list = list_box :items =>@m
> @list.choose("#{@m[1]}") do
> some code here
> end
>
> I find i am rather clueless about this and it has me searching
> docs and
> experimenting for hours to find out the propper way to write
> the first
> example. i'd like to be able to store the first list box in a
> variable
> and call its change or choose method..
>
> Eelco
>
>
>
Re: Re: [shoes] [green_shoes]:symbol vs .method
- From:
- ashbb
- Date:
- 2011-03-05 @ 00:11
> Maybe those methods aren't implemented yet in green_shoes.
Yeah, I'll try to write them in this weekend. :)
ashbb
Re: Re: [shoes] [green_shoes]:symbol vs .method
- From:
- ashbb
- Date:
- 2011-03-05 @ 14:07
Done.
Try out green_shoes 0.179.0 : http://rubygems.org/gems/green_shoes
Hope it works well. :)
ashbb