NSStatusItemMBS class Popover

I’ve looked at the Statusitem with PopOver project , but I can’t figure out how to make the popover automatically close if you click elsewhere.

The only way to close the popover is to click the menu again. I know I can put a close button on it, but there should be a way to automatically close it when you mouse click away from it.

Any ideas?

Well, you could check for LostFocus event and close it then.

LostFocus and GotFocus never fire on the Container.

App.Deactivate works once. If I click a different menubar item (different app) the popover still stays up.

I also tried LostFocus on the TextArea - it also never fires.

You don’t find much on this topic on the web.
But seems like some people use NSEventMonitorMBS class to watch for global events and for mouse clicks outside.

1 Like

I managed to finagle something from the Mouse Click & Keyboard Events example so the popover closes properly when clicking outside of it.

Now I just have to see what kind of macOS security nightmares I get when I build the app.