Skip navigation.
The QNX Community Portal

View topic - Window: Set Focus

Window: Set Focus

Isn't the name clear?

Window: Set Focus

Postby Mr.Green » Wed Dec 03, 2008 1:15 pm

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?

Active Member
Posts: 37
Joined: Tue Nov 11, 2008 12:21 pm

RE: Window: Set Focus

Postby micro » Wed Dec 03, 2008 3:13 pm

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.
Senior Member
Posts: 458
Joined: Thu Jul 22, 2004 8:41 pm

RE: Window: Set Focus

Postby jinma » Wed Dec 03, 2008 11:48 pm

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.
Senior Member
Posts: 428
Joined: Thu Oct 28, 2004 10:13 pm

RE: Window: Set Focus

Postby juanplacco » Thu Dec 04, 2008 12:44 am

PtWindowFocus () maybe?
Senior Member
Posts: 318
Joined: Wed May 17, 2006 2:30 pm

Return to GUI Programming

Who is online

Users browsing this forum: No registered users and 1 guest