• 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: email@hidden
  • Date: Sat, 23 Jul 2016 21:13:34 -0700

Ok. That makes so much sense. This was a succinct explanation.

On Jul 23, 2016, at 8:40 PM, Ken Thomases <email@hidden> wrote:

> 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


References: 
 >validateUserInterfaceItem not called (From: email@hidden)
 >Re: validateUserInterfaceItem not called (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: validateUserInterfaceItem not called
  • Next by Date: Re: NSImage from bitmap - then delete bitmap
  • Previous by thread: Re: validateUserInterfaceItem not called
  • Next by thread: awakeFromFetch behaviour change in 10.12?
  • Index(es):
    • Date
    • Thread