Eric Roller's Development Blog

Binding "enabled" for an NSMenuItem

- Posted in macOS by

If you ask me, this is a bug: binding "enabled" of an NSMenuItem to anything does not make any difference. It seems that the target of the menu item needs to tackle the issue in the conventional manner, i.e. through the method:

- (BOOL) validateMenuItem:(NSMenuItem*)item
    if (itemShouldBeEnabled)
        return YES;

    return NO;

The downside of this is that the target may need access to other objects that would have beeen simple to achieve through the binding mechanism, sigh.