Code: Select all
void MainFrame::OnSize(wxSizeEvent &event)
{
wxSize size;
Layout();
wxFrame::OnSize(event);
if (m_pSpMain)
{
size = m_pSpMain->GetClientSize();
m_pSpMain->SetSashPosition(size.GetWidth() / 2);
m_pSpMain->UpdateSize();
if (m_pSpPreview)
{
size = m_pSpPreview->GetClientSize();
m_pSpPreview->SetSashPosition(size.GetHeight() - 200);
m_pSpPreview->UpdateSize();
}
if (m_pSpProgram)
{
size = m_pSpProgram->GetClientSize();
m_pSpProgram->SetSashPosition(size.GetHeight() - 200);
m_pSpProgram->UpdateSize();
}
}
}
The problem I am having is that the value returned by GetClientSize() is not correct under Windows. Example: when normalising the application after being maximised, I will get a ClientSize which is 1 pixel smaller than the MAXIMISED size, not the final normalised size. When resizing a window manually (dragging with the mouse), GetClientSize() gets a size 1 pixel larger or smaller than the original size, NOT the final window size.
Strangely, the code works perfectly on Linux.
I am using wxWidgets 2.6.0, MinGW compiler.
Any ideas?