I have an NSMenuItem
that is enabled/disabled based on whether or not the first responder responds to a specific selector.
My problem is that there are conditions in which I do not want the item enabled for the first responder.
But I can't just conditionally remove a method definition during runtime to disable the menu item
For an example of what I mean:
I have a NSDocument
-based application, and I have two main subclasses-- an ImageDocument
and a VideoDocument
I have an NSMenuItem
called "Capture Frame", which turns a frame of a video into an image. But obviously this should be disabled on an ImageDocument
, and only enabled on a VideoDocument
.
The NSMenuItem
is enabled if the first responder responds to -captureFrame
The VideoDocumentController
has a method, -captureFrame
, so it's enabled.
The ImageDocumentController
does not, so the menu item is never enabled.
But, there are specific VideoDocument
s that I do not want to have that menu item enabled for. What could be the best way for me to disable this menu item in order to handle special cases?