Re: Hiding contextual menu items

David Dunham <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On 8 Mar 2010, at 08:00, Christiaan Hofman wrote:

> I have an NSTableView with a contextual menu, that's automatically updated using the -menuNeedsUpdate: delegate method. I want to conditionally hide some items, depending on the current state. So I tried to call -setHidden on the items on the menu in my implementation of -menuNeedsUpdate:. This does not work, the menu items are all shown, no matter whether I pass YES or NO to this method. What's going on, why doesn't it respect my settings? And is there an alternative way to do this?


I think this is where I override menuForEvent and provide a menu with only the right items.

Also, I think that if you're talking about standard items, you should disable them rather than hide, and that the hiding happens automatically.

David Dunham     A Sharp, LLC
Voice/Fax: 206 783 7404     http://a-sharp.com
Efficiency is intelligent laziness.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.