I’d like to disable cut and/or paste in the menubar at runtime, in my ObjC app. I know that that’s possible in iOS using
-(BOOL)canPerformAction:(SEL)aSelector withSender:(id)sender
Is there anything similar for MacOS?
Thank you
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is the NSUserInterfaceValidations Protocol, a generic protocol for validating items. You simply implement the
validateUserInterfaceItem:method and return NO to disable the action.There is also a NSMenuValidation Protocol, which performs the same function but is used only to validate menu items, instead of all interface items. If you don’t implement it, the system will fall back to the standard validation instead.