Always on Top window for OSX

Hello, I am a programmer in Japan.
I have openFrameworks create applications for exhibition there,
but it is not know how to display Always on Top window, I’m having problems very.

For example, alerts when the app crashed will appear at the front than the app.

It is likely to be resolved, if possible Always on Top window.

I think it depends very much if you are on Windows or Mac.
What are you using?
Here there is an old thread about it:

What you probably want is to set your app to the “shielding” window level.

  1. Change your ofApp’s file name from “ofApp.cpp” to “ofApp.mm”. This lets you use Objective-C++.
  2. Add the following code in your ofApp’s setup()
CGCaptureAllDisplays();
NSWindow * window = (NSWindow *)ofGetWindowPtr()->getCocoaWindow();
[window setLevel:CGShieldingWindowLevel()];

You’ll probably want to do a clean (Cmd+Shift+K) and then build. If you get errors on the NSWindow line, you might not be in Objective-C++. Let me know if you get errors.

Also, watch out! If the app crashes as you’re working on it it’ll cover up everything, even when Xcode tries to show you the error. Use Cmd+. (command period) to get Xcode to force-quit the app in that case.

3 Likes

Nice solution @admsyn,
Sorry @calmbooks i just realised you are in OSX ! didn’t see the title!

I’m sorry late reply!
I was able to thanks to your code, to achieve a successful challenge.

Bacause exhibition which I exhibition from tomorrow, it was barely in time.
Thank you again!

Thank you for the answer!
When it only title, It is was hard to understand. Sorry!
Thank you for the URL of the reference!