I've written a cross platform application for Windows and Mac. It sits on the system tray and when there is a trigger, a window pops up. On Windows I can force the window to the top, so it is always visible, no matter what application I am working on. For the Mac, I can't seem to find the same functionality. So in essence I want to unhide a window, which works, but also make this window appear foremost. Does anyone have any pointers for achieving this?
Thanks
Bring Window to the Front
Re: Bring Window to the Front
Maybe you need to bring the whole program to front.
Code: Select all
#NSApplicationActivateAllWindows = 1 << 0
#NSApplicationActivateIgnoringOtherApps = 1 << 1
currentApplication = CocoaMessage(0, 0, "NSRunningApplication currentApplication")
CocoaMessage(0, currentApplication, "activateWithOptions:", #NSApplicationActivateAllWindows | #NSApplicationActivateIgnoringOtherApps)
macOS Catalina 10.15.7
Re: Bring Window to the Front
Thanks Peter, wasn't even aware of that one. Works well.Kiffi wrote:StickyWindow() does not work on a Mac?
Greetings ... Peter
Colin
Re: Bring Window to the Front
Thanks Wolfram. HAven't checked this one as the other works and also gives me the benefit of having the same code for Windows.Wolfram wrote:Maybe you need to bring the whole program to front.
Code: Select all
#NSApplicationActivateAllWindows = 1 << 0 #NSApplicationActivateIgnoringOtherApps = 1 << 1 currentApplication = CocoaMessage(0, 0, "NSRunningApplication currentApplication") CocoaMessage(0, currentApplication, "activateWithOptions:", #NSApplicationActivateAllWindows | #NSApplicationActivateIgnoringOtherApps)
Colin