On Aug 30, 2008, at 17:50, John Velman wrote:

So, if the button is pushed to bring up a new window, the IBAction is in
the master window controller.  But the actual adding of the
NSWindowController and its associated window should be done by a method
back in MyDocument.

I can't find description of this part of the process.

The action in the existing window controller can create a new window controller, then invoke [self.document addWindowController: newWindowController]. That's all it should take.

Or, if the document needs to create the new window controller itself for some reason, implement the action to create the new window controller in your document class instead, and invoke [self addWindowController: newWindowController].

Note that the document and the window controllers are all effectively in the responder chain, so sending the button action to First Responder instead of a specific object will send the action to whichever object implements it.

One way I can think
of to do it is as follows:

In my MasterWindowController, have an instance variable called something like "createdby", and a method "setCreatedby". Then in MyDocument, when I
alloc and init the instance of the masterWindowController, I follow
directly with [masterWindowController setCreatedby:self].

Window controllers already have a "document" outlet that is automatically set by [NSDocument addWindowController]. You don't need to roll your own.


_______________________________________________

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