• 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: A (Hopefully) simple menu problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A (Hopefully) simple menu problem


  • Subject: Re: A (Hopefully) simple menu problem
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Tue, 29 Jun 2004 14:01:05 -0700

Hello...

To make the connections for the menu in IB (since you can't make a connection directly to a document in the main nib) you make the connection to the "First Responder" object alias in the main nib file instead. This causes the action to be sent down the responder chain whenever the menu item is selected, and it will trigger the action in the active document. The validation of the menu item is handled in a similar way, since it will be enabled when an object in the responder chain responds to the action message and returns TRUE from the validateMenuItem: method.

Since the "First Responder" probably won't have an action that matches the method you want to use, you need to add it to the list of actions. You can do this by selecting the "First Responder", switching to the "Classes" tab in the nib window, and adding an action with the correct name in the inspector pallete.


Hope that helps,

Louis

I'm having a good deal of difficulty getting my head around menu enabling
(and how to get my methods called) in a multiple nib world. Specifically I
have:

1) The usual MainMenu.nib which contains among other things a menu item
"Edit Reference"
2) In another nib (LibraryDocument.nib) I have my LibraryDocument class that
knows when "Edit Reference" should be enabled and also knows what to do if
it is selected. There can be multiple library documents open of course.

I've learned about validateMenuItem: and it's implemented in my
LibaryDocument class.

So how the heck to I point the menu item at LibraryDocument? This has to be
simple right?

Thanks

Bill Colsher
_______________________________________________
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: 
 >A (Hopefully) simple menu problem (From: William Colsher <email@hidden>)

  • Prev by Date: NSTextViews with embedded pictures and vertical alignment
  • Next by Date: Using GCContextFillRect() vs. NSBezierPath's class methods
  • Previous by thread: A (Hopefully) simple menu problem
  • Next by thread: NSDateFormatter not validating input
  • Index(es):
    • Date
    • Thread