From 8d041e943387d0af26a39f983a0cd2b5b01db033 Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Fri, 11 Oct 2013 20:57:14 +0800 Subject: [PATCH] Fixed a layout problem when resizing --- src/insertpanel.cpp | 26 +++++++++----------------- src/locationpanel.cpp | 14 +++++--------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/insertpanel.cpp b/src/insertpanel.cpp index cc0720f..64aa466 100755 --- a/src/insertpanel.cpp +++ b/src/insertpanel.cpp @@ -63,7 +63,7 @@ InsertPanel::InsertPanel ( wxLB_SORT | wxLB_HSCROLL ); sizer->Add ( edit, 0, wxGROW | wxTOP, 0 ); - sizer->Add ( list, 0, wxGROW | wxTOP, 0 ); + sizer->Add ( list, 1, wxGROW | wxTOP, 0 ); sizer->Layout(); list->Show ( false ); } @@ -105,15 +105,11 @@ void InsertPanel::update ( for ( it = entitySet.begin(); it != entitySet.end(); it++ ) list->Append ( *it ); list->Show ( true ); - - wxSize clientSize = GetClientSize(); - wxSize editSize = edit->GetSize(); - wxSize listSize = - wxSize ( clientSize.GetWidth(), clientSize.GetHeight() - editSize.GetHeight() ); - list->SetSize ( listSize ); +#if wxCHECK_VERSION(2,9,0) list->Update(); - - //sizer->Layout(); +#else + sizer->Layout(); +#endif return; } @@ -146,15 +142,11 @@ void InsertPanel::update ( for ( it = elementSet.begin(); it != elementSet.end(); it++ ) list->Append ( *it ); list->Show ( true ); - - wxSize clientSize = GetClientSize(); - wxSize editSize = edit->GetSize(); - wxSize listSize = - wxSize ( clientSize.GetWidth(), clientSize.GetHeight() - editSize.GetHeight() ); - - if ( clientSize.IsFullySpecified() && editSize.IsFullySpecified() ) - list->SetSize ( listSize ); +#if wxCHECK_VERSION(2,9,0) list->Update(); +#else + sizer->Layout(); +#endif } void InsertPanel::OnEnter ( wxCommandEvent& event ) diff --git a/src/locationpanel.cpp b/src/locationpanel.cpp index 3d4e577..5fcbbb1 100755 --- a/src/locationpanel.cpp +++ b/src/locationpanel.cpp @@ -61,7 +61,7 @@ LocationPanel::LocationPanel ( wxWindow *parentWindowParameter, int id ) : structureEdit->SetIndentationGuides ( true ); sizer->Add ( edit, 0, wxGROW | wxTOP, 0 ); - sizer->Add ( structureEdit, 0, wxGROW | wxTOP, 0 ); + sizer->Add ( structureEdit, 1, wxGROW | wxTOP, 0 ); sizer->Layout(); structureEdit->Show ( false ); } @@ -91,15 +91,11 @@ void LocationPanel::update ( structureEdit->SetReadOnly ( false ); structureEdit->SetText ( structure ); structureEdit->SetReadOnly ( true ); - - wxSize clientSize = GetClientSize(); - wxSize editSize = edit->GetSize(); - wxSize structureSize = - wxSize ( clientSize.GetWidth(), clientSize.GetHeight() - editSize.GetHeight() ); - - if ( clientSize.IsFullySpecified() && editSize.IsFullySpecified() ) - structureEdit->SetSize ( structureSize ); +#if wxCHECK_VERSION(2,9,0) structureEdit->Update(); +#else + sizer->Layout(); +#endif } else {