I have an application here that needs to be read into a bunch of data from an external file and displayed as NSPopUpButton
in the Cocoa user interface. The catch here is that the data that is being read must have a flag that indicates whether it is considered βhiddenβ or not.
If the data is hidden, it must be added to NSPopUpButton
as NSMenuItem
, but the hidden
flag should be set to YES
, so it usually does not appear in the NSPopUpButton
menu. If the user holds the magic key on his keyboard (usually in this case ALT), then hidden objects must be hidden. If the user allows you to switch from the ALT key, then they should be automatically hidden, except for the one that could be selected - which will become hidden if another NSMenuItem
is selected.
Actually, I have a hell of a time to figure this out.
I was wondering if there is a direct way to do this using NSArrayController
and NSPopUpButton
, but so far I have not been able to find anything like a solution - not when it comes to managing the hidden property of NSMenuItem
objects.
Does anyone know how this can be achieved using Cocoa Bindings?
user1004332
source share