Window is not active window on startup


#1

One of my programs has the strange property that it isn’t the active window after startup.

I double click somewhere in the window, and it gains keyboard focus and becomes the active window.
But really, it needs to be the active window right away.

Actually … I notice the juceDemo is not immediately the active window after instantiation ether. It does several repaints before it becomes the active window.

I must be missing something here. Is there a way to programmatically ask the application to make it’s window the active one?


#2

Wow , that’s strange, you can use spy++ to easily see which windows are open and who owns them. maybe that will shed some light on this issue…

BTW: which OS are you using?


#3

OSX 10.7 … this was a problem in 10.6 as well though.

I come back to it every once in a while and try some new things, plus see if I can get a better handle on what’s happening, but this one’s got me stumped for the moment.


#4

And the culprit is …

Label->showEditor()

which was being mistakenly called in a constructor … creating a modal dialog and giving it focus (though it never actually gets to be visible).

tada!