Test if JuceApplication has Focus


#1

Hi,

Is there a mean to test if your application is the focused one in the OS ?
I want to get that to make only one window from the 10 of my app,
when my app is not focused / on-top of the desktop.

A bit like Photoposh e.g.

Thanks


#2

Well, you can try this call “isActiveWindow ()”.


#3

Process::isForegroundProcess() might be what you’re looking for?


#4

Oh yes. Thank you;
juce works.


#5

One last question : what is the instance I should use with ?
JUCE_APPLICATION cannot be correct I guess…

[quote]Well, you can try this call “isActiveWindow ()”.[/quote]This is not a clean solution, involving too many tests. Definitely the solution if nothing else available.


#6

Sorry, I don’t understand your question…


#7

Process::isForegroundProcess() :

how do you use it ?
how do you get “Process” ?


#8

it’s a static method, you should be able to call it from anywhere.

static bool Process::isForegroundProcess ( )  throw () [static] 

#9

Of course, thanks.

What would be the best callback to use to test process just befor it loses focus ?


#10

TopLevelWindow::activeWindowStatusChanged () <<