Ok. That makes so much sense. This was a succinct explanation. On Jul 23, 2016, at 8:40 PM, Ken Thomases <k...@codeweavers.com> wrote:
> On Jul 23, 2016, at 10:12 PM, livinginlosange...@mac.com wrote: >> >> I have a simple AppDelegate that instantiates an NSWindowController and >> Window. I have an NSMenuItem that invokes an IBAction on the firstResponder >> in my xib. This works as expected. When I press command+1, the IBAction >> fires. However, I specified that my NSWindowController use the >> ‘NSUserInterfaceValidations’ protocol, but my ‘validateUserInterfaceItem’ is >> never invoked. Any ideas why? > > Is the class that implements validateUserInterfaceItem the same class that > implements the action method? The frameworks only ask the target that will > be sent the action method to validate it. > > Also, if your superclass implements validateMenuItem, then you need to > override that. For actions that your class handles, you can implement it by > calling validateUserInterfaceItem if you want to cover all your bases (like > toolbar items). For any other action, return what super returns. The reason > is that NSMenu checks whether the target implements validateMenuItem before > it checks if it implements validateUserInterfaceItem. If it implements the > former, it is called and the latter is not. > > Unfortunately, whether a class implements validateMenuItem is not necessarily > documented. > > Regards, > Ken > _______________________________________________ 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