• 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: NSWindowController Subclassing - windowDidLoad Method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindowController Subclassing - windowDidLoad Method


  • Subject: Re: NSWindowController Subclassing - windowDidLoad Method
  • From: Mike Abdullah <email@hidden>
  • Date: Sun, 30 Apr 2006 23:55:06 +0100

The code should be fine in NSWindowController's windowDidLoad method. You must have something hooked up wrong somewhere. Check:

* All outlets to the text field and button are OK
* The NIB file's owner is your NSWindowController subclass
* The NSWindowController is connected to your window
* The NSDocument knows what it is supposed to be doing properly with regards to window controllers


Mike.

On 30 Apr 2006, at 11:14AM0, Nelson Santos wrote:

Hi all,

I am stuck. I am building a Cocoa document-based application. I have decided to separate my model-controller and view-controller into two classes. A subclass of NSDocument is acting as the model- controller and a subclass of NSWindowController is acting as the view-controller.

In my document nib file, I have several controls including an NSButton and an NSFieldText. What I'd like to do is set the enabled/disabled status of the button and the text value of the text field to certain values before the window/nib is displayed to the user. I tried doing this in NSWindowController's windowDidLoad method, but it didn't work. The problem is that none of the controls have been instantiated yet when this method was called. Another option is to do it in the NSDocument's windowControllerDidLoadNib method which I'm sure will work, but I don't want to put the code in there because I feel that it is a view-controller related thing and belongs in my NSWindowController subclass.

What are my other options? Am I using the best approach? Should I just lump all controller related code into NSDocument subclass and be done with it? I know that splitting the controller logic is a viable design decision, but I can't figure out how to handle this situation.

Thanks to all who respond!

Nelson

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Distributed objects: Code required on both sides? (From: Philippe Mougin <email@hidden>)
 >NSWindowController Subclassing - windowDidLoad Method (From: Nelson Santos <email@hidden>)

  • Prev by Date: Re: NSOpenPanel setCanChooseDirectories behavior
  • Next by Date: Re: Getting notified on tab-switch in Safari?
  • Previous by thread: NSWindowController Subclassing - windowDidLoad Method
  • Next by thread: Re: Distributed objects: Code required on both sides?
  • Index(es):
    • Date
    • Thread