|
From: Jonathan P. <jp...@dc...> - 2006-02-04 18:11:41
|
On 4 Feb 2006, at 9:14, Yvon Thoraval wrote:
> i'm starting within RubyCocoa, although i've been using Cocoa-Java,
> i want to setup the items of an NSPopUpButton programmatically.
>
> if i list all the associated methods by :
>
> ctm...@ch...
> ctmethods.each { |m| p "choixTheme #{m}"}
>
> i never get even the "titleOfSelectedItem" nor "indexOfSelectedItem"
> why ?
The 'methods' method lists plain Ruby methods. The Objective C
methods are implemented via the method_missing hook, and therefore
don't show up like that.
There is an 'objc_methods' method provided by RubyCocoa, but it had a
bug which was fixed in CVS a couple of days ago. Your version may not
have this fix yet.
> @choixTheme.addItem("Unbelievable")
> i get an error :
> /Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/
> osx/objc/oc_wrapper.rb:17:in `NSApplicationMain': NSApplicationMain
> - RBException_OSX::OCMessageSendException - NSPopUpButton#addItem:
> - methodSignature is nil. (OSX::OCException)
>
> then, what's the correct way to setup all the items of a
> NSPopUpButton programmatically ?
XCode documentation tells me there's no method called 'addItem' on
NSPopUpButton. There is 'addItemWithTitle' though. Can you try it?
|