setState of NSMenuItem in MainMenu.nib on program start
setState of NSMenuItem in MainMenu.nib on program start
- Subject: setState of NSMenuItem in MainMenu.nib on program start
- From: "Brandon Woodson" <email@hidden>
- Date: Tue, 30 Jan 2007 11:31:35 -0500
I haven't been doing Cocoa programming very long so bare with me. I'm
converting a Cocoa applcation (project A) I made to a Cocoa document-based
application (project B). In project A I have a call in "(void)awakeFromNib"
to load the user defaults. One of the user defaults calls setState for a
NSMenuItem located in MainMenu.nib (MainMenu.nib being where the window and
such are also located).
In project B there is the MainMenu.nib and MyDocument.nib so I know things
have to be setup differently. I created a new class called AppController.
I have MyDocument.m handling all the actions/outputs from it's corresponding
nib and I setup MainMenu.nib to have an instance of AppController to handle
the interaction. I hope that makes sense thus far! =0)
In MyDocument.m i create an instance of AppController as well since I have
moved all the code to load/save user defaults into it. In
"(void)windowControllerDidLoadNib" I call [appController loadUserDefaults]
and everything works great except that it doesn't setState on the NSMenuItem
in MainMenu.nib.
From what I can tell it's not setting the state because the NSMenuItem isn't
initialized because the IBOutlet pointer is NULL at the time it tries to
call it. I've been reading into what the problem might be and I'm wondering
if I should be looking at "validateMenuItem" or should I be working with the
FirstResponder? Any help would be awesome.
- Brandon
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden