Fix recently broken (re-)layout in the listctrl sample
This completes changes of 0873abb836
which
replaced manual layout code with sizers, but broke layout after
recreating the control in the process.
This change notably fixes the control becoming invisible, due to having
the default too small size, in non-report modes.
This commit is contained in:
@@ -110,8 +110,6 @@ bool MyApp::OnInit()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
EVT_SIZE(MyFrame::OnSize)
|
|
||||||
|
|
||||||
EVT_MENU(LIST_QUIT, MyFrame::OnQuit)
|
EVT_MENU(LIST_QUIT, MyFrame::OnQuit)
|
||||||
EVT_MENU(LIST_ABOUT, MyFrame::OnAbout)
|
EVT_MENU(LIST_ABOUT, MyFrame::OnAbout)
|
||||||
EVT_MENU(LIST_LIST_VIEW, MyFrame::OnListView)
|
EVT_MENU(LIST_LIST_VIEW, MyFrame::OnListView)
|
||||||
@@ -449,13 +447,23 @@ void MyFrame::RecreateList(long flags, bool withText)
|
|||||||
(m_listCtrl->GetWindowStyleFlag() & wxLC_VIRTUAL)) )
|
(m_listCtrl->GetWindowStyleFlag() & wxLC_VIRTUAL)) )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
delete m_listCtrl;
|
wxListCtrl* const old = m_listCtrl;
|
||||||
|
|
||||||
m_listCtrl = new MyListCtrl(m_panel, LIST_CTRL,
|
m_listCtrl = new MyListCtrl(m_panel, LIST_CTRL,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
flags |
|
flags |
|
||||||
wxBORDER_THEME | wxLC_EDIT_LABELS);
|
wxBORDER_THEME | wxLC_EDIT_LABELS);
|
||||||
|
|
||||||
|
if ( old )
|
||||||
|
{
|
||||||
|
wxSizer* const sizer = m_panel->GetSizer();
|
||||||
|
sizer->Replace(old, m_listCtrl);
|
||||||
|
|
||||||
|
delete old;
|
||||||
|
|
||||||
|
sizer->Layout();
|
||||||
|
}
|
||||||
|
|
||||||
switch ( flags & wxLC_MASK_TYPE )
|
switch ( flags & wxLC_MASK_TYPE )
|
||||||
{
|
{
|
||||||
case wxLC_LIST:
|
case wxLC_LIST:
|
||||||
|
Reference in New Issue
Block a user