MainMenu.nib a good spot for NSMenuItem bindings?
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