• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: validateUserInterfaceItem not called
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: validateUserInterfaceItem not called


  • Subject: Re: validateUserInterfaceItem not called
  • From: Ken Thomases <email@hidden>
  • Date: Sat, 23 Jul 2016 22:40:40 -0500

On Jul 23, 2016, at 10:12 PM, email@hidden 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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: validateUserInterfaceItem not called
      • From: email@hidden
References: 
 >validateUserInterfaceItem not called (From: email@hidden)

  • Prev by Date: validateUserInterfaceItem not called
  • Next by Date: Re: validateUserInterfaceItem not called
  • Previous by thread: validateUserInterfaceItem not called
  • Next by thread: Re: validateUserInterfaceItem not called
  • Index(es):
    • Date
    • Thread