Frame doesn't show Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
leiradella
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Sun Sep 07, 2008 9:49 pm
Location: Rio de Janeiro, Brazil

Frame doesn't show

Post by leiradella »

Hi All,

My application, which used to run just fine, now doesn't show before entering the event loop.

Stepping in the debugger, I can see that frame->Show is being called:

Code: Select all

bool Application::OnInit()
{
  shader = new Shader(); // This is a wxFrame
  shader->SetIcon(wxIcon(icon_xpm));
  shader->Show(true);
  return true;
}

// Back to int wxEntryReal(int& argc, wxChar **argv)
// it calls wxTheApp->OnRun()

int Application::OnRun()
{
  return wxApp::OnRun();
}

// wxApp::OnRun() calls m_mainLoop->Run() which
// then executes the event loop without showing
// the frame. If I use the taskbar button to close
// the app, it closes just file.
I've tried both wxWidgets 2.8.9 and 2.8.10.

Any ideas?

Thanks in advance,

Andre
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Post by doublemax »

Do you save and restore the wxFrame position? Maybe the frame is opened off-screen.

On MSW minimized windows have a position of (-32000, -32000), so if you save the position in this state, this could be the reason.
Use the source, Luke!
leiradella
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Sun Sep 07, 2008 9:49 pm
Location: Rio de Janeiro, Brazil

Post by leiradella »

This is what Shader's constructor does:

Code: Select all

Shader::Shader()
  : wxFrame(NULL, wxID_ANY, wxT("igFragmentShader"))
{
  BuildMenu();
  AddStatusBar();
  LoadConfig();
  m_Timer.SetOwner(this);
  m_Timer.Start(1000, wxTIMER_CONTINUOUS);
}
BuildMenu just creates a wxMenuBar, adds some wxMenus to it and then sets it as the frame's menu with this->SetMenuBar(m_MenuBar)

AddStatusBar just creates a wxStatusBar and sets it as the frame's status bar with this->SetStatusBar(m_StatusBar)

LoadConfig just reads some configuration values form wxConfigBase.
leiradella
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Sun Sep 07, 2008 9:49 pm
Location: Rio de Janeiro, Brazil

Post by leiradella »

Thanks doublemax!

LoadConfig reads the frame's position and size and it was reading -32000 for both x and y.

The frame appears just fine now.

Cheers,

Andre
Post Reply