我利用NSMenu和NSStatusItem长时间在地位酒吧展示习俗菜单:
statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:18] retain];
[statusItem setImage:[NSImage imageNamed:@"myIcon"]];
[statusItem setMenu:myMenu];
[statusItem setHighlightMode:NO];
...
It works fine by start clicking its image icon. But I noticed that apple s menu located on status bar can be triggered simple by mouse move over, like the airport menu, power menu, language menu and date/time menu. They are all auto pop up when you mouse walk over. How did they get it?
I have checked the "add tracking rect" for NSView with "mouseEntered" event, but things is not as difficult as that I think.
任何建议?