I have an NSStatusItem that displays correctly in the MenuBar. One of the elements (when pressed) displays the modal NSWindow from my application, which is designed to perform a one-time task, then disappears. (For example, the user enters a small bit of text, clicks Save, and the modal NSWindow disappears.)
The problem occurs when the application is running in the background. The modal window is correctly displayed so that the application is running in the foreground, but when the user clicks the "Save" button, the remaining application windows also become active. This is undesirable since the user must click back into any application that they used. (Destroying the convenience of NSStatusItem.) I show a modal window using:
[myWindow setFrame:finalRect display:YES animate:NO]; [myWindow setLevel:NSPopUpMenuWindowLevel]; [NSApp runModalForWindow:myWindow];
Is there a way to prevent clicks / events in my popup to make other applications become active? Or a way to let NSApp know that this particular panel should not automatically activate the rest of the application? Thanks!
xcode cocoa modal-dialog macos nswindow
Craig otis
source share