How can I programmatically force a mac window to be the front window? I have the window handle, and want to ensure that my window is displayed above all other windows. I can use both Carbon & Cocoa for this.
9. Open the window you want it to be on top. Then, click CTRL + SPACE. Then, you will see that the window will stay on top no matter which app you open later.
Updated at 07 Feb, 2022 07:25 PM. If you want Tot's window to float above other windows on the Mac desktop, use the "Display as Floating Window" item in the Window menu. Note that the Window menu is only visible when you're using Tot with a Dock icon.
When you drag a window on your Mac, the layout view appears as an overlay on screen and you choose the one you want, and where you want the current window to sit in that layout. You can then add more windows to the it. Layouts can be organized in groups – such as those for two apps, three apps, etc.
For Cocoa, you can set the window level using:
[window setLevel:NSFloatingWindowLevel];
A floating window will display above all other regular windows, even if your app isn't active.
If you want to make your app active, you can use:
[NSApp activateIgnoringOtherApps:YES];
and
[window makeKeyAndOrderFront:nil];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With