Make the initial sash position work in splitter sample.

The initial splitter size must be set correctly when using gravity with
wxSplitterWindow as otherwise the sash would jump on first resize -- which was
exactly what happened in the splitter sample.

Add a SetSize() call to the sample with the comment explaining why is it
needed and also actually make it stick as the cached last size was not updated
before the splitter was split before.

Closes #9821.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-10-30 19:48:44 +00:00
parent c79d40fe1e
commit 853f4764c0
2 changed files with 11 additions and 4 deletions

View File

@@ -257,6 +257,12 @@ MyFrame::MyFrame()
menuBar->Check(SPLIT_LIVE, true);
m_splitter = new MySplitterWindow(this);
// If you use non-zero gravity you must initialize the splitter with its
// correct initial size, otherwise it will change the sash position by a
// huge amount when it's resized from its initial default size to its real
// size when the frame lays it out. This wouldn't be necessary if default
// zero gravity were used (although it would do no harm neither).
m_splitter->SetSize(GetClientSize());
m_splitter->SetSashGravity(1.0);
#if 1