• 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: Linking a Menu To A Document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking a Menu To A Document


  • Subject: Re: Linking a Menu To A Document
  • From: Nick Zitzmann <email@hidden>
  • Date: Wed, 30 Jul 2003 14:32:59 -0700

On Wednesday, July 30, 2003, at 12:59 PM, Seth Willits wrote:

One thing I never could figure out was how to connect a menu item to the action of an object in another nib file. How do you do this?

For example, if you create a new multi-document application in Project Builder and then create a new menu item in the file menu, how can I connect that to an action in the MyDocument class?

If you have an action in the document that looks like this:

- (IBAction)someDocumentAction:(id)sender;

Then you can solve the problem by putting the following method in a class instantiated in the same nib as the main menu:

- (IBAction)someAction:(id)sender
{
[[[NSDocumentController sharedDocumentController] currentDocument] performSelector:@selector(someDocumentAction:) withObject:sender afterDelay:0];
}

That would call the -someDocumentAction: method in the document that's in front.

Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page: http://seiryu.home.comcast.net/

Famous last words: "OK, I've pulled the pin. Now what? Where are you going?"
_______________________________________________
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.
References: 
 >Linking a Menu To A Document (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: Linking a Menu To A Document
  • Next by Date: [OT] Japanese Localisation Assistance?
  • Previous by thread: Re: Linking a Menu To A Document
  • Next by thread: Re: Linking a Menu To A Document
  • Index(es):
    • Date
    • Thread