• 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
MainMenu.nib a good spot for NSMenuItem bindings?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MainMenu.nib a good spot for NSMenuItem bindings?


  • Subject: MainMenu.nib a good spot for NSMenuItem bindings?
  • From: Scott Ellsworth <email@hidden>
  • Date: Thu, 2 Jun 2005 17:48:16 -0700

Hi, all.

I have read up on makeWindowControllers, and have created two windows for my app - IWMainWindowController and IWGroupWindowController. The group inspector shows and hides just fine under the influence of an ivar in MyDocument. I now want my app's main menu to have a 'show/ hide' menu item to toggle that variable.

Ideally, it would show a tick mark if the groups window is open, and selecting/deselecting would tweedle the ivar in MyDocument, which the window uses to show and hide.

To do this:
I created an item in the window menu.
I bound its value to File's Owner.selection.groupWindowVisible

I had expected this to walk the firstResponder chain until it got to the appropriate accessor in MyDocument.h.

Instead, I got complaints about NSApplication not being kvc compliant for groupsWindowVisible. Of course it isn't. That data lives in MyDocument.

I then erased the bindings, and put a plain old IBAction method in MyDocument called showHideGroups. This gets called as expected.

This is the first time I have tried to bind something to one of my application's menus. Am I thinking about this incorrectly?

Aside:

The conceptual docs seem to imply that I do not want to have my IBAction in MyDocument, given that the NSDocument subclass should become a model-controller, leaving view-controller logic to the NSWindowController subclasses.

Thing is, MyDocument seems to be the right place to put the instance variable which determines whether the group inspector is shown. (There is one inspector per document.)

Did I miss something here?

Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Setting the "Open with" attribute on a file
  • Next by Date: Re: Setting the "Open with" attribute on a file
  • Previous by thread: kerning broken on Tiger
  • Next by thread: Bug in NSImageView / NSPDFImageRep in Tiger?
  • Index(es):
    • Date
    • Thread