[MacRuby-devel] NoMethodError for button#on_action in HotCocoa

Frisco Del Rosario friscodelrosario at sbcglobal.net
Tue Apr 21 01:39:59 PDT 2009


I found I could fix one problem by moving the label and button  
declarations outside the layout_view block:

w = window(:title => "Window", :size => [300,150])

l = label(:text_align => :center, :text => "", :layout => {:expand =>  
[:width, :height], :align => "center"})
btn = button(:title => "put some text in the label", :layout =>  
{:align => "center"})

lv = layout_view :frame => [0,0,280,130], :layout => {:expand =>  
[:width, :height], :align => :center, :start => true} do |view|
   view << l
   view << btn
end

w << lv

And then the button#on_action parameter has to be in braces:

btn.on_action{l.text = "some text"}


More information about the MacRuby-devel mailing list