I have an application with multiple documents opened at once (as different tabs), but not implemented the Cocoa way, with NSDocument
etc
So, let's say, that application is a text editor : e.g. an NSTextView in each document/tab and a menu (in the MainMenu
) with options (on/off) related to that particular document.
Scenarios :
How should I go about that in the most Cocoa-friendly way?
(I certainly CAN do it; though I'm interested in what could be a more efficient way (and my definitely isn't))
You can implement validateUserInterfaceItem: on NSDocument. Menu and toolbar items call it to check if they should be enabled or not. Read about Implementing Validation in general and Enabling Menu Items specifically.