Hi,

In the document based application I'm working on I have a lot of methods in the document class which simply pass a command to some internal object. This requires me do do the following in my NSDocument subclass:

- (BOOL)validateMenuItem:(NSMenuItem *)item
{
    SEL action = [item action];

    if (actio...@selector(myAction:))
        return [internalObject shouldEnableMyAction];
    else
      ...

}

- (void)myAction:(id)sender
{
    [internalObject myAction:sender];
}

This works fine but it requires me to write an annoying amount such glue code every time I add an action so I'm looking for a better way to do this. Is it possible to further delegate the action methods and menu validation from the NSDocument subclass? The best way for me would be to have internalObject implement validateMenuItem and myAction and have the NSDocument pass them along without actually implementing each action method.

TIA

Eyal

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to