On May 23, 2008, at 5:30 PM, [EMAIL PROTECTED] wrote:
On May 23, 2008, at 2:49 PM, Johnny Lundy wrote:
I decided to once again go verbatim through Cocoa Fundamentals. So
far it has been largely "uh-huh, yep", but the File's Owner, my
nemesis, comes up again.
[deleted]
Again, I'm sensing a very fundamental disconnect, perhaps more
fundamental than you realize.  Anybody can recite documentation, so
there's no need to tell us that and no need to recite the
documentation. I think it would be more helpful to tell us at what
*part* of the documentation you start to get lost, and what
specifically is confusing about it, perhaps as relates to your other
programming experience.

The point at which after it says "the proxy is filled in at runtime with the object that was set as the owner, ****so that the nib objects can communicate with other objects outside the nib*****.

What other objects outside the nib? I have nothing connected to File's Owner except the delegate, and looking at

STOP. You just answered your own question. You connected the delegate outlet of an object outside the nib to some object within the nib. That is why File's owner exists! You just used File's Owner to make a connection to an object outside the nib. That object is the application's one and only NSApplication instance.

File's Owner's "off the shelf" connections, the only one it has is to the About.... menu item.
...AND the delegate IBOutlet that you just said you connected. Don't forget that one.

So I don't see why any "object outside the nib" could use File's Owner to find out about "objects inside the nib", since File's Owner isn't connected to any objects inside the nib (except the About... menu item).

The one and only NSApplication instance outside your nib found out about some object in your nib when you made a connection to File's Owner telling the NSApplication instance to set its delegate outlet to some object inside your nib.


So I understand it's a proxy, I understand it has an object it knows as its owner, I know the standard owner is an instance of NSApplication aka NSApp global variable, but what I do not get is why I need this thing, or how it is needed to "connect the rest of the nib objects with an object outside the nib." What object outside the nib?

Maybe so that you can set the delegate of the NSApplication instance ?

[lots of experience that indicates and ability to learn complex information deleted]


But I don't understand File's Owner. Everything else that I listed up there, I understood.

[deleted]
Here's my problem. I didn't make any connections to File's Owner. I never have. Before bindings, I had a view object send an action to my class, by coding (IBAction) myMethod: in my code, and setting that action in the view object's action method.

You mean except connecting the delegate outlet of the File's Owner.


With bindings, I bind the view object to the NSArrayController, and the controller to an NSObject whose class is set to my custom class. Nothing done with File's Owner at all.

In my opinion, you are not ready to use NSArrayController or bindings.

[deleted]

I understand that if I wanted to make another nib (which I definitely will need at some point), that I invoke loadNIbNamed:owner:, but I still wouldn't know why I was specifying an owner. I assume said owner would be an object, which might be one of my class instances, but really I have no idea.

Well, let's see. If the NSApplication instance outside your MainMenu.nib had not been specified as the File's Owner for your nib, how would you have made a connection to the NSApplication instance's delegate outlet ?

Please read http://lists.apple.com/archives/Cocoa-dev/2008//May/msg02323.html again.

I despair that I am unable to adequately explain the concept and utility of File's Owner to you. This disturbs me greatly because I have written a book about Cocoa Programming, and I explained File's Owner in that book. I fear that I have failed. If I can't explain this concept to a very learned programmer, how can I explain it to a true novice.

_______________________________________________

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