From: Eloy D. <e....@su...> - 2008-04-11 11:27:51
|
Hi Alli, It works fine for me: >> class BarCell < NSCell >> def initTextCell(str) >> puts 'here' >> super_initTextCell(str) >> end >> end => nil >> BarCell.alloc.initTextCell('foo') here => #<BarCell:0x363df0 class='BarCell' id=0x581390> >> BarCell.initTextCell('foo') OSX::OCMessageSendException: Can't get Objective-C method signature for selector 'initTextCell:' of receiver BarCell from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_wrapper.rb:50:in `ocm_send' from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_wrapper.rb:50:in `method_missing' from (irb):10 It looks like you are sending the initTextCell: message to the class BarCell instead of to an instance. So you should first send it the alloc message to get back an instance and then send it the initTextCell: message Cheers, Eloy On Apr 11, 2008, at 1:05 PM, Allison Newman wrote: > Hi everyone (on this apparently rather quiet mailing list!) > > I'm having a problem with creating a subclass of NSCell. > Specifically, I am trying to initilise it as follows: > > cell = BarCell.initTextCell_("") > > The class definition for BarCell looks like this: > > class BarCell < NSCell > attr_accessor :highlighted > > def initTextCell_(str) > super_initTextCell_(str) > end > end > > I'm getting back an error that the bridge can't find the Objective-C > method for the init... > > Can't get Objective-C method signature for selector 'initTextCell:' > of receiver BarCell > > I've tried everything that I can think of, including playing around > with the underscore on the end of the function declarations and > references. Can anyone explain to me what is going on? (I've never > had any trouble subclassing NSControls or NSViews) > > Alli > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save > $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Rubycocoa-talk mailing list > Rub...@li... > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk |