Window: Set Focus

I’ve got a window that may loose focus due to user action, but I want to give back the focus to it.

Let’s say this program is called “foo” which shall have focus. It may loose focus when the user clicks anywhere else, but it shouldn’t. Or it may loose focus when another program is started, but I want the focus back on foo.

I found the PtGlobalFocusNext() -Function; I need something similar that switches between windows. Btw: Alt+Tab isn’t sufficent; it may be that two other programs are started, so when i try to switch back from “program2” with Alt+Tab to “foo”, i will focus “program1”…

I found PtWindowToBack(); that is cool as it sends the new window to back, but foo may still loose focus, so when the user tries to type something in into foo, he will type somewhere else…

Any ideas how to solve that?


mh, this also means you do not want any other application to be shown or drawn or in fokus?

Why not just kill all menus and open up your application in fullscreen → There is nowhere to cklick than your app.
Just put and only put your app into the autostartsequence for Photon.

I don’t know the exact funtions calls but why don’t you put a callback on “lost focus” event on your “foo” application where when your “foo” app loses focus it calls PtWindowToFront() on your “foo” app, so that it gets focus as soon as it loses one.

PtWindowFocus () maybe?