• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: File's owner and delegate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File's owner and delegate


  • Subject: Re: File's owner and delegate
  • From: Allan Odgaard <email@hidden>
  • Date: Wed, 12 May 2004 15:20:46 +0200

On 12. May 2004, at 14:21, Joakim Danielson wrote:

I'm trying to bind the content of a NSObjectController to an ivar in my controll class but I end upp with the error message "[<NSWindowController 0x348b20> valueForUndefinedKey:]: this class is not key value coding-compliant for the key delegate."

Is this when loading MainMenu.nib or one of the other nibs (containing a window)?

_wcTransactions = [[NSWindowController alloc] initWithWindowNibName:@"Transaction"];

This will load the Nib with File's Owner being the window controller. You probably want to use the initWithWindowNibName:owner: version, and give the application delegate as owner.

In IB I have an instance of my controll class and connected it as a delegate to File's owner (NSApplication) and for the NSObjectController binding objectContent I have written delegate.transaction and set Bind To: to File's owner.

Is this in the same Nib? Cause then you are making the (AFAIK non-documented) assumption that connections are created *before* bindings.

I just did a test, and this currently is practice, so that shouldn't be your problem, but I would file an enhancement request to get this behavior documented, if you plan on making use of it (if I did not overlook something in the documentation).

So why is NSWindowController the receiver of "delegate" and not my controll class?

I'd say because File's Owner is the window controller. I assume that this is not in the MainMenu.nib, and thus the problem is with your window controller initialization where you do not specify an owner.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: File's owner and delegate
      • From: Joakim Danielson <email@hidden>
References: 
 >File's owner and delegate (From: Joakim Danielson <email@hidden>)

  • Prev by Date: How to tell if first responder
  • Next by Date: Re: NSBezierPath, flipped Glyphs, and NSOutlineView
  • Previous by thread: File's owner and delegate
  • Next by thread: Re: File's owner and delegate
  • Index(es):
    • Date
    • Thread