[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: issue with auto-enable of Menus

From: Wolfgang Lux
Subject: Re: issue with auto-enable of Menus
Date: Mon, 13 Nov 2017 18:52:29 +0100

> Am 13.11.2017 um 12:54 schrieb Ivan Vučica <address@hidden>:
> To add to thread from a different perspective...
> Menu items should auto enable/disable depending on whether the target object 
> supports the passed selector.

I'm afraid this logic is too simple. Yes, the target object should support the 
selector. But there may be additional conditions: For instance, a paste menu 
item should be enabled only when the pasteboard contains content that is 
compatible with the receiver. And cut, copy and delete menu items should be 
enabled only if the receiver has a non-empty selection.

> 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?

In my experience, custom code is unavoidable in almost any non-trivial case 
because the AppKit is not able to determine exactly when a menu item is 
applicable and when not. Having support for the selectors is a necessary but 
not a sufficient condition.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]