CocoaDev

Edit AllPages

Does anybody know of a better way in a document-based app?

The only way I could figure out to do it for this simple example was (using General/NSNotificationCenter):


Use something like

-(BOOL)validateMenuItem:(General/NSMenuItem *)anItem { if ( [ anItem action ] == @selector( toggleControlsDrawer: ) ) { if ([controlsDrawer state] == General/NSDrawerOpenState || [controlsDrawer state] == General/NSDrawerOpeningState) { [anItem setTitle:@”Close Controls Drawer”]; else { [anItem setTitle:@”Open Controls Drawer”]; } }

return YES; //or do other stuff here to enable/disable items }