Tim P. [email protected] writes:
But then I get an assertion error:
*** Assertion failure in -[NSApplication
In the initial Apple example code there method is marked as (void) and
not an (IBAction), can this method not be called directly?
It’s a callback - you don’t actually connect an event to it, or call it
yourself. In your action method, you’d call:
Then, Cocoa will call your callback, passing along whatever return code
you’ve specified. This allows your action methods to perform whatever
action is specific to the action that was performed, then the callback
does whatever action-neutral cleanup is needed - including sending an
orderOut message to @connection to make it go away.
Also, I have
establised an IB outlet which im guessing the nib is loaded into?
What are you referring to when you say “established an outlet”? Have you
declared it in Ruby with ib_outlets? Have you also connected it in
Interface Builder? I’ve a suspicion that you might have forgotten that
second part, so…
In IB, double-click the “file’s owner” to edit the class definition.
“Classes/Subclass NSObject”, and enter the name of your Ruby class.
add the outlet to the class in the “attributes” pane of the inspector
That doesn’t actually declare your class or add an outlet to it, it
lets IB know about it.
Objective-C programmers can simply drag and drop .h files to do this
or do this step manually and let IB create the .h files, but IB doesn’t
grok scripting languages… so we have to do both steps by hand,
the outlet in IB and declaring it in our code.
To make the connection, click back over to the “instances” tab. Then,
drag a connection starting with “file’s owner” and ending on the window
using as a sheet. The inspector panel should switch over to its
pane - there, double-click the outlet you just added, or click the
Are there any tutorials at all out there on using sheets?!
None that I know of. But then, I’m biased - I wrote CamelBones, and I’ve
recently started looking at “other” bridges.