开发者

NSMenuItem's NSView not highlighting in submenu

开发者 https://www.devze.com 2023-03-11 04:15 出处:网络
I have an NSStatusItem that displays an NSMenu full of NSView subclasses. I override drawRect: in my NSView subclass to implement highlighting in the NSMenu and everything works fine in the root menu,

I have an NSStatusItem that displays an NSMenu full of NSView subclasses. I override drawRect: in my NSView subclass to implement highlighting in the NSMenu and everything works fine in the root menu, but for some reason it doesn't work in submenus of the root menu. I put some NSLog statements in my NSView subclasses drawRect: and noticed that it's not even being called for the views in the submenu. Any ideas?

I can post the code that 开发者_如何学PythonI'm using to highlight the views, but I don't think that its necessary since drawRect: is not even being called. Let me know if there's any other code you need to see that might help.


Could you use NSMenuItem's setEnabled method to sort of jog the submenuItems awake?


The problem seems to have resolved itself. I might have just forgot to set the view to use my NSView subclass.

0

精彩评论

暂无评论...
验证码 换一张
取 消