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?

Regards,

Pax 
_______________________________________________

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

Reply via email to