|
From: | Riccardo Mottola |
Subject: | Re: issue with auto-enable of Menus |
Date: | Mon, 13 Nov 2017 16:03:45 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.1 |
Hi, Ivan Vučica wrote:
Menu items should auto enable/disable depending on whether the target object supports the passed selector.Would it make sense to not have custom code to enable/disable menu items, and just have appkit do it for you depending on the target?
auto-enable already works that way. If you attach to NSFirst it goes down the responder chain.
This works especially magically if you use target NSFirstResponder and target the “first responder” correctly. Depending on how Graphos works, this might be infeasible, of course.
It works but it is not "enough".If I want to enable "copy" only if an object is selected I need to ask my document or view if it has something selected inside. If you just validate if your controller supports copy there still might be nothing to do. I wanted to go more "finegrained", up to the point where certain menus are enabled only if certain things are selected.
Riccardo
[Prev in Thread] | Current Thread | [Next in Thread] |