Search code examples
cocoansmenunsstatusitem

Cocoa: Auto close a status menu


I hava a status menu on the status bar, and I have some tasks running behind the scene. When one of task is done, assume at the time the menu is being showed (dropped down), I want to make the menu to be not in drop down mode (pretend doing a left click on the mouse on the menu icon) automatically. Is there a way to do that?


Solution

  • It's there, but the name is a little bit counterintuitive: You want NSMenu's cancelTracking.