• 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: Finding myDocument from AppController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Documentation download?
      • From: James Pengra <email@hidden>
References: 
 >Finding myDocument from AppController (From: John Nairn <email@hidden>)

  • Prev by Date: Re: Finding myDocument from AppController
  • Next by Date: Re: how do you enter text in Symbol?
  • Previous by thread: Re: Finding myDocument from AppController
  • Next by thread: Documentation download?
  • Index(es):
    • Date
    • Thread