setUsingNativeTitleBar() focus on startup


#1

If my main window id a document window with a setUsingNativeTitleBar(true); then when i start it it does not show up as a new window, it’s somewhere in the back i need to click it on the task bar to activate it, that does not happen when i do setUsingNativeTitleBar(false), i noticed that also with the new jucer, same behavior.


#2

Sounds like something the OS is doing - what OS is it, and how are you launching the app?


#3

I had this same problem under Windows 7, running from the debugger. I solved it by calling the DocumentWindow constructor with addToDesktop set to false, and then adding the thing to the desktop myself AFTER changing setUsingNativeTitleBar():

MainWindow::MainWindow( VisCore& visCore )
: DocumentWindow (JUCE_T("JuceApp")
, Colours::black
, DocumentWindow::allButtons
, false )
{
  MainPanel* const p = new MainPanel( visCore );

  setOpaque( true );
  setResizable( true, false );
  setUsingNativeTitleBar( true );
  setDropShadowEnabled( false );
  setMenuBar( &m_mainMenu );

  Component::addToDesktop (getDesktopWindowStyleFlags()); // must happen AFTER setUsingNativeTitleBar()

  setContentComponent (p, true, true);

  setConstrainer( p );

  centreWithSize (getWidth(), getHeight());

  setVisible (true);
}

#4

it’s windows7 x64.


#5

Did you try my change? It directly addresses your issue…


#6

Wow, interesting suggestion.
However is there any other solution to this issue without setUsingNativeTitleBar(true)?
In my application I use my own title bar and this won’t work for me


#7

[quote=“serhiy.semenyuk”]However is there any other solution to this issue without setUsingNativeTitleBar(true)?
In my application I use my own title bar and this won’t work for me[/quote]

Is the issue affecting you? I haven’t seen any problem with non-native title bars (i.e. custom drawn title bars, like the Juce default).

The above all applies to Windows 7 64-bit.


#8

yeah,
it is affecting me under Win XP if I set no titlebars, or draw my owm


#9

[quote=“serhiy.semenyuk”]yeah,
it is affecting me under Win XP if I set no titlebars, or draw my owm[/quote]

Well, pass false for the “addToDesktop” parameter in the DocumentWindow constructor, do all of your initialization, and then call addToDesktop yourself at the end of your constructor and see if that fixes it.