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

Frisco Del Rosario friscodelrosario at sbcglobal.net
Tue Apr 21 01:27:51 PDT 2009


Got two unexpected results from running this script in HotConsole:

require 'hotcocoa'
include HotCocoa

w = window(:title => "Window", :size => [220,100])

$lv = layout_view :frame => [0,0,200,80], :layout => {:expand =>  
[:width, :height], :align => :center, :start => true} do |view|
   view << $l = label(:text_align => :center, :text => "", :layout =>  
{:expand => [:width, :height], :align => "center"})
   view << $btn = button(:title => "Put some text in the  
label", :layout => {:align => "center"})
end

w << $lv

$btn.on_action($l.text = "some text")

Expected: Nothing
Got: NoMethodError: undefined method `on_action' for 0:NSButton
hotconsole:13:in `<compiled>'

Expected: Text label to be empty
Got: "some text"



More information about the MacRuby-devel mailing list