Re: Finding myDocument from AppController
Re: Finding myDocument from AppController
- Subject: Re: Finding myDocument from AppController
- From: mmalcolm crawford <email@hidden>
- Date: Thu, 16 May 2002 14:11:50 -0700
On Thursday, May 16, 2002, at 01:19 PM, John Nairn wrote:
I am now to the stage I want a menu command to run a dialog box
relevant to the document in the current window. I added an
AppController to the MainMenu.nib and set the target of a menu item to
an action in that class. I can find the current main window with [NSApp
mainWindow] and open a sheet on that window, but I do not see how to
access the class in the myDocument.nib from the AppContoller in
MainMenu.nib. I want the planned sheet to change some class variables
in myDocument.
I assume that myDocument is an NSDocument instance, or may be set to be
the delegate of the window it's controlling?
Short answer:
In MainMenu.nib, add the method to the First Responder "class".
Now connect your menu item to First Responder in that nib.
Provided that the assumptions above are correct, your document instance
should receive the message from the menu by virtue of then being part of
the responder chain:
file://localhost/Developer/Documentation/Cocoa/TasksAndConcepts/ProgrammingTopics/
BasicEventHandling/index.html
mmalc
_______________________________________________
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.