Tim Perrett <freestyle_kayaker / hotmail.com> writes:

>>> In the initial Apple example code there method is marked as (void) and 
>>> not an (IBAction), can this method not be called directly?
>
> I actually meant the code that calls the sheet in the first place? In 
> there example it seems to be marked as void? If you wanted to call the 
> sheet from a button click for instance im guessing it would need to be 
> called by an IBAction?

Yes, exactly. Button clicks and other GUI events can only call methods
that take one object argument and return void. Obviously, nothing stops
you from implementing such a method as a one-liner that does nothing but
call NSApp's sheet method.

> Ok no problem, I understand letting IB know about new objects you create 
> - however in your example you say by subclassing NSObject it will be 
> avalible in the file owners connection pane? I thought you normally had 
> to instansiate any NSObject subclasses?

You can, but you don't have to. In your earlier code, you had code that
loaded the NIB and made your object its owner; if you *also* instantiate
an instance of your class in the NIB itself, you'll then wind up with two
instances of your class.

> I have declared the outlet called :connection, so i add my demo NSObject 
> subclass into IB. Without instansiating my new "demo" object, surley I 
> cant use anything defined on it as there is no instance from which it 
> can call?

The "file's owner" icon in IB is just a visual proxy of sorts for whatever
object you pass as the second argument to loadNibNamed_owner(). It's there
so you can make connections to that object.

When you define the class of the "file's owner", you're not creating an
instance of that class. You're just informing IB what class the NIB's
owner will belong to, when it's loaded and assigned an owner.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net