[MacRuby] #169: [HotCocoa] status_item mapping doesn't appear to work
#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/>
#169: [HotCocoa] status_item mapping doesn't appear to work --------------------------------+------------------------------------------- Reporter: chris@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: --------------------------------+------------------------------------------- Comment(by chris@…): Should have mentioned, MacRuby is svn r758 -- Ticket URL: <http://www.macruby.org/trac/ticket/169#comment:2> MacRuby <http://macruby.org/>
#169: [HotCocoa] status_item mapping doesn't appear to work --------------------------------+------------------------------------------- Reporter: chris@… | Owner: rich@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: --------------------------------+------------------------------------------- Changes (by lsansonetti@…): * owner: lsansonetti@… => rich@… Comment: Rich, can you look at this? -- Ticket URL: <http://www.macruby.org/trac/ticket/169#comment:3> MacRuby <http://macruby.org/>
#169: [HotCocoa] status_item mapping doesn't appear to work --------------------------------+------------------------------------------- Reporter: chris@… | Owner: rich@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: --------------------------------+------------------------------------------- Comment(by vincent.isambart@…): The code works if either: * "include HotCocoa" is done not in a class, but at the top level (it's probably why this was not seen earlier). It works because then all the HotCocoa methods become available to '''all''' objects * you add "include HotCocoa" in HotCocoa::Mappings::Mapper as alloc_with_options is run on an instance of HotCocoa::Mappings::Mapper -- Ticket URL: <http://www.macruby.org/trac/ticket/169#comment:4> MacRuby <http://macruby.org/>
#169: [HotCocoa] status_item mapping doesn't appear to work --------------------------------+------------------------------------------- Reporter: chris@… | Owner: rich@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: --------------------------------+------------------------------------------- Comment(by isaackearse@…): Attached is a diff that fixes the issue for me, but ticket #305 also needs to be applied. -- Ticket URL: <http://www.macruby.org/trac/ticket/169#comment:6> MacRuby <http://macruby.org/>
#169: [HotCocoa] status_item mapping doesn't appear to work --------------------------------+------------------------------------------- Reporter: chris@… | Owner: rich@… Type: defect | Status: closed Priority: minor | Milestone: Component: MacRuby | Resolution: fixed Keywords: | --------------------------------+------------------------------------------- Changes (by rich@…): * status: new => closed * resolution: => fixed Comment: applied the patch -- Ticket URL: <http://www.macruby.org/trac/ticket/169#comment:7> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby