Jens, Shawn,
Thanks.

I have my application working, however not exactly as I would like.  What I
did was, in IB, created a NSObject, and set it to my POSsocket class.  I
understand now that IB "automatically" instantiates this classes that you
put in there.  I added the required outlets, and I can do what I need to do.

I would prefer to separate I/O activities, business logic, etc from the GUI,
as well as be able to instantiate objects programmatically, and that is what
I have been attempting to do, I just have no mechanism of sending messages
to my "controller" class from my "model" objects unless the "controller"
makes the call.

I guess I just have to get my head around it, and design appropriately.

Again, thanks so much for your help,
Matt

-----Original Message-----
From: Jens Alfke [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 21, 2008 10:06 PM
To: [EMAIL PROTECTED]
Cc: cocoa-dev@lists.apple.com
Subject: Re: fundamental question: how do I call controller methods from
other classes?


On 21 May '08, at 5:07 PM, Matthew Youney wrote:

> The name of the controller object in interface builder is
> myPOSsocketController, and the following gives the compiler error
> "myPOSsocketController undeclared or first use in function"

If you want an object in a nib to know about another one, then modify
its class to add an instance variable declared as an IBOutlet:

@interface  POSocket
{
        ...
        IBOutlet POSocketController myController;

Save the .h file and IB will now know about that outlet, and you can
control-drag from the POSocket to the controller and assign the
myController instance variable.

Typically what happens is that you have a controller object (often an
NSWindowController) that's the nib's owner, and you add outlets to it
for all the other nib objects you need to reference directly. It's
rarer for other objects in the nib to have outlets pointing to each
other, but it happens sometimes.

-Jens


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to