开发者

Displaying custom/arbitrary controls in an NSMenu

How can I Display an NSTextField or an NSProgressIndicator within an NSMenu? I'm looking to do something simila开发者_如何学JAVAr to the Spotlight icon menu, or the Help menu of most applications.


You can use the [NSMenu - setView:] method for it. But you can't add an NSTextField without major hacks. Apple still uses a brain dead Carbon implementation for menus. If you want keystrokes you have to go down into Carbon and do some magic for key handling.

Its so worse you will not even get a menu action fired if the user selects the menu item with the return key.

For this reason the official Apple sample just shows a slider as an embedded menu.

Please raise this topic on the official apple mailing list so Apple can see that this is a wanted feature and will be fixed soon.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜