#907: forKeyPath and valueForOutputKey don't appear to work in MacRuby -------------------------------------+-------------------------------------- Reporter: shaun@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: -------------------------------------+-------------------------------------- Description changed by martinlagardette@…: Old description:
I am new to MacRuby so I apologize if I have this wrong.
I am trying to access the patch values of a quartz composer controller object and I am running into some errors.
Here is a summary of the code:
class AppController
attr_accessor :testButton, :myQCView
def awakeFromNib
@test_btn = false
puts @myQCView.is_a? NSObject @myText.setStringValue("this is my value") @myQCView.setValue(txt, forKeyPath:"patch.text.value") puts @myQCView
end
# a test button def testButton(sender) if @test_btn @testButton.setTitle("test button") puts "test button activated" @myText.setStringValue("test content") @test_btn = false image = @myQCView.valueForOutputKey("quartz_image") puts "this is the image " + image if image puts "got the image" end else puts 'test button Stopped' @testButton.setTitle("stop test") @test_btn= true end end
The error message I get is:
2010-09-19 16:43:39.851 QCRuby[4511:a0f] /Users/shaun/Documents/Code/MacRuby/QCRuby/build/Debug/QCRuby.app/Contents/Resources/AppController.rb:146:in `testButton:': undefined method `valueForOutputKey' for #<QCPatchController:0x2006696a0> (NoMethodError) from /Users/shaun/Documents/Code/MacRuby/QCRuby/build/Debug/QCRuby.app/Contents/Resources/rb_main.rb:11:in `<main>'
2010-09-19 16:43:40.697 QCRuby[4511:a0f] /Users/x/Documents/Code/MacRuby/QCRuby/build/Debug/QCRuby.app/Contents/Resources/AppController.rb:146:in `testButton:': undefined method `valueForOutputKey' for #<QCPatchController:0x2006696a0> (NoMethodError) from /Users/x/Documents/Code/MacRuby/QCRuby/build/Debug/QCRuby.app/Contents/Resources/rb_main.rb:11:in `<main>'
New description: I am new to MacRuby so I apologize if I have this wrong. I am trying to access the patch values of a quartz composer controller object and I am running into some errors. Here is a summary of the code: {{{ #!ruby class AppController attr_accessor :testButton, :myQCView def awakeFromNib @test_btn = false puts @myQCView.is_a? NSObject @myText.setStringValue("this is my value") @myQCView.setValue(txt, forKeyPath:"patch.text.value") puts @myQCView end # a test button def testButton(sender) if @test_btn @testButton.setTitle("test button") puts "test button activated" @myText.setStringValue("test content") @test_btn = false image = @myQCView.valueForOutputKey("quartz_image") puts "this is the image " + image if image puts "got the image" end else puts 'test button Stopped' @testButton.setTitle("stop test") @test_btn = true end end end }}} The error message I get is: {{{ 2010-09-19 16:43:39.851 QCRuby[4511:a0f] /Users/shaun/Documents/Code/MacRuby/QCRuby/build/Debug/QCRuby.app/Contents/Resources/AppController.rb:146:in `testButton:': undefined method `valueForOutputKey' for #<QCPatchController:0x2006696a0> (NoMethodError) from /Users/shaun/Documents/Code/MacRuby/QCRuby/build/Debug/QCRuby.app/Contents/Resources/rb_main.rb:11:in `<main>' 2010-09-19 16:43:40.697 QCRuby[4511:a0f] /Users/x/Documents/Code/MacRuby/QCRuby/build/Debug/QCRuby.app/Contents/Resources/AppController.rb:146:in `testButton:': undefined method `valueForOutputKey' for #<QCPatchController:0x2006696a0> (NoMethodError) from /Users/x/Documents/Code/MacRuby/QCRuby/build/Debug/QCRuby.app/Contents/Resources/rb_main.rb:11:in `<main>' }}} -- -- Ticket URL: <http://www.macruby.org/trac/ticket/907#comment:1> MacRuby <http://macruby.org/>