On Aug 29, 2013, at 6:38 AM, Pax wrote: > I've written some code to enable / disable the menu items of my NSDocument > based application, as appropriate. It works for methods that I've written > myself, but not (apparently) for ones that are provided for me. > > Here's the code (simplified slightly just to say return 'NO' - a quick test > to see if what I'm doing works): > > - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem > { > SEL theAction = [anItem action]; > > if (theAction == @selector(toggleFormat:)) > { > return NO; > } > if (theAction == @selector(toggleToolbarShown:)) > { > return NO; > } > if (theAction == @selector(runToolbarCustomizationPalette:)) > { > return NO; > } > if (theAction == @selector(previewData:)) > { > return NO; > } > > return [super validateUserInterfaceItem:anItem]; > } > > The question is - what am I doing wrong? Why don't toggleToolbarShown or > runToolbarCustomizationPalette get validated? How would you suggest that I > fix this?
These two methods are implemented by NSWindow, and chances are the window is gobbling up the actions because it is earlier in the responder chain: https://developer.apple.com/library/mac/documentation/cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW9 Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com