Noob: MainMenu.nib and MyDocument.nib targeting problems
Noob: MainMenu.nib and MyDocument.nib targeting problems
- Subject: Noob: MainMenu.nib and MyDocument.nib targeting problems
- From: Alain Schartz <email@hidden>
- Date: Mon, 23 Jul 2007 01:00:41 -0700
Dear all,
Now this may be a complete noob question, but I'm having some conceptual problems here. This is a document-based application :
I have a custom view on my document in MyDocument.nib. In the custom view's class I have an instance variable *document which is set to be the document (done in MyDocument's windowControllerDidLoadNib: by setting [customView setDocument: self]). I do this so that I am able to access my model data stored in the MyDocument class from inside the custom view. This works fine. (BTW, is this the preferred method or is there a more elegant way of doing this?)
I also have a menu in this application which targets an ApplicationController class, instanciated in MainMenu.nib. One of these menu items opens a "create object" panel which should add a new object to my model data stored in the MyDocument class.
My question is, how do I tell the ApplicationController the id of the current document so that I can pass on this information to the "add new object" panel's controller class (similar to the [customView setDocument: self] call done for the CustomView)? I tried instanciating MyDocument in MainMenu.nib, which (of course) generates a new instance of MyDocument and I can't access the "real" model data.
I suppose I could choose not to use an ApplicationController class at all and make the menu target the MyDocument class directly, but this raises a similar question; how do I access the current MyDocument object from inside MainMenu.nib ?
Thanks,
Alain
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden