[MacRuby-devel] [MacRuby] #169: [HotCocoa] status_item mapping doesn't appear to work

MacRuby ruby-noreply at macosforge.org
Sat Nov 29 08:39:38 PST 2008


#169: [HotCocoa] status_item mapping doesn't appear to work
--------------------------------+-------------------------------------------
 Reporter:  chris@…             |       Owner:  lsansonetti@…        
     Type:  defect              |      Status:  new                  
 Priority:  minor               |   Milestone:                       
Component:  MacRuby             |    Keywords:                       
--------------------------------+-------------------------------------------
 I'm porting a little single file rubycocoa app to check out hotcocoa but
 ran into a little problem with the code below:

 {{{
 require 'hotcocoa'

 class Application
   include HotCocoa

   def start
     application :name => "MacMenu" do |app|
       app.delegate = self
       @item = status_item
       #@item = status_bar.statusItemWithLength NSVariableStatusItemLength
       @item.title = "MacMenu"
     end
   end
 end

 Application.new.start

 }}}

 The @item = status_item call causes the following error:

 {{{
 /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.0/hotcocoa/mappings/status_item.rb:6:in
 `alloc_with_options': undefined local variable or method `status_bar' for
 #<HotCocoa::Mappings::Mapper:0x80039e6e0> (NameError)
         from
 /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.0/hotcocoa/mapper.rb:48:in
 `block in map_method'
         from hotcocoa_menu_test.rb:9:in `block in start'
         from
 /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.0/hotcocoa/mappings/application.rb:9:in
 `call'
         from
 /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.0/hotcocoa/mappings/application.rb:9:in
 `handle_block'
         from
 /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.0/hotcocoa/mapper.rb:67:in
 `block in map_method'
         from hotcocoa_menu_test.rb:7:in `start'
         from hotcocoa_menu_test.rb:16:in `<main>'
 }}}

 Using the commented out line instead everything is fine.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/169>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list