bug with lbox recreation fixed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8592 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-10-20 09:16:00 +00:00
parent d55d0aa0f5
commit f104f965eb

View File

@@ -163,6 +163,9 @@ protected:
// the controls // the controls
// ------------ // ------------
// the one to contain them all
wxPanel *m_panel;
// the sel mode radiobox // the sel mode radiobox
wxRadioBox *m_radioSelMode; wxRadioBox *m_radioSelMode;
@@ -339,7 +342,7 @@ LboxTestFrame::LboxTestFrame(const wxString& title)
m_logTarget = (wxLog *)NULL; m_logTarget = (wxLog *)NULL;
wxPanel *panel = new wxPanel(this, -1); m_panel = new wxPanel(this, -1);
/* /*
What we create here is a frame having 3 panes: the explanatory pane to What we create here is a frame having 3 panes: the explanatory pane to
@@ -360,15 +363,15 @@ LboxTestFrame::LboxTestFrame(const wxString& title)
_T("multiple"), _T("multiple"),
}; };
wxStaticBox *box = new wxStaticBox(panel, -1, _T("&Set listbox parameters")); wxStaticBox *box = new wxStaticBox(m_panel, -1, _T("&Set listbox parameters"));
m_radioSelMode = new wxRadioBox(panel, -1, _T("Selection &mode:"), m_radioSelMode = new wxRadioBox(m_panel, -1, _T("Selection &mode:"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(modes), modes, WXSIZEOF(modes), modes,
1, wxRA_SPECIFY_COLS); 1, wxRA_SPECIFY_COLS);
m_chkVScroll = new wxCheckBox(panel, -1, _T("Always show &vertical scrollbar")); m_chkVScroll = new wxCheckBox(m_panel, -1, _T("Always show &vertical scrollbar"));
m_chkHScroll = new wxCheckBox(panel, -1, _T("Show &horizontal scrollbar")); m_chkHScroll = new wxCheckBox(m_panel, -1, _T("Show &horizontal scrollbar"));
m_chkSort = new wxCheckBox(panel, -1, _T("&Sort items")); m_chkSort = new wxCheckBox(m_panel, -1, _T("&Sort items"));
sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
@@ -379,51 +382,51 @@ LboxTestFrame::LboxTestFrame(const wxString& title)
sizerLeft->Add(m_radioSelMode, 0, wxGROW | wxALL, 5); sizerLeft->Add(m_radioSelMode, 0, wxGROW | wxALL, 5);
wxSizer *sizerBtn = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerBtn = new wxBoxSizer(wxHORIZONTAL);
wxButton *btn = new wxButton(panel, LboxTest_Reset, _T("&Reset")); wxButton *btn = new wxButton(m_panel, LboxTest_Reset, _T("&Reset"));
sizerBtn->Add(btn, 0, wxLEFT | wxRIGHT, 5); sizerBtn->Add(btn, 0, wxLEFT | wxRIGHT, 5);
btn = new wxButton(panel, LboxTest_Create, _T("&Create")); btn = new wxButton(m_panel, LboxTest_Create, _T("&Create"));
sizerBtn->Add(btn, 0, wxLEFT | wxRIGHT, 5); sizerBtn->Add(btn, 0, wxLEFT | wxRIGHT, 5);
sizerLeft->Add(sizerBtn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(sizerBtn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(panel, -1, _T("&Change listbox contents")); wxStaticBox *box2 = new wxStaticBox(m_panel, -1, _T("&Change listbox contents"));
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(panel, LboxTest_Add, _T("&Add this string")); btn = new wxButton(m_panel, LboxTest_Add, _T("&Add this string"));
m_textAdd = new wxTextCtrl(panel, LboxTest_AddText, _T("test item 0")); m_textAdd = new wxTextCtrl(m_panel, LboxTest_AddText, _T("test item 0"));
sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textAdd, 1, wxLEFT, 5); sizerRow->Add(m_textAdd, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(panel, LboxTest_AddSeveral, _T("&Insert a few strings")); btn = new wxButton(m_panel, LboxTest_AddSeveral, _T("&Insert a few strings"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(panel, LboxTest_AddMany, _T("Add &many strings")); btn = new wxButton(m_panel, LboxTest_AddMany, _T("Add &many strings"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
sizerRow = new wxBoxSizer(wxHORIZONTAL); sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(panel, LboxTest_Change, _T("C&hange current")); btn = new wxButton(m_panel, LboxTest_Change, _T("C&hange current"));
m_textChange = new wxTextCtrl(panel, LboxTest_ChangeText, _T("")); m_textChange = new wxTextCtrl(m_panel, LboxTest_ChangeText, _T(""));
sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textChange, 1, wxLEFT, 5); sizerRow->Add(m_textChange, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = new wxBoxSizer(wxHORIZONTAL); sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(panel, LboxTest_Delete, _T("&Delete this item")); btn = new wxButton(m_panel, LboxTest_Delete, _T("&Delete this item"));
m_textDelete = new wxTextCtrl(panel, LboxTest_DeleteText, _T("")); m_textDelete = new wxTextCtrl(m_panel, LboxTest_DeleteText, _T(""));
sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textDelete, 1, wxLEFT, 5); sizerRow->Add(m_textDelete, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(panel, LboxTest_DeleteSel, _T("Delete &selection")); btn = new wxButton(m_panel, LboxTest_DeleteSel, _T("Delete &selection"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(panel, LboxTest_Clear, _T("&Clear")); btn = new wxButton(m_panel, LboxTest_Clear, _T("&Clear"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
// right pane // right pane
m_lbox = new wxListBox(panel, LboxTest_Listbox, m_lbox = new wxListBox(m_panel, LboxTest_Listbox,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
0, NULL, 0, NULL,
wxLB_HSCROLL); wxLB_HSCROLL);
@@ -439,16 +442,16 @@ LboxTestFrame::LboxTestFrame(const wxString& title)
// the lower one only has the log listbox and a button to clear it // the lower one only has the log listbox and a button to clear it
wxSizer *sizerDown = new wxStaticBoxSizer wxSizer *sizerDown = new wxStaticBoxSizer
( (
new wxStaticBox(panel, -1, _T("&Log window")), new wxStaticBox(m_panel, -1, _T("&Log window")),
wxVERTICAL wxVERTICAL
); );
m_lboxLog = new wxListBox(panel, -1); m_lboxLog = new wxListBox(m_panel, -1);
sizerDown->Add(m_lboxLog, 1, wxGROW | wxALL, 5); sizerDown->Add(m_lboxLog, 1, wxGROW | wxALL, 5);
wxBoxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(panel, LboxTest_ClearLog, _T("Clear &log")); btn = new wxButton(m_panel, LboxTest_ClearLog, _T("Clear &log"));
sizerBtns->Add(btn); sizerBtns->Add(btn);
sizerBtns->Add(10, 0); // spacer sizerBtns->Add(10, 0); // spacer
btn = new wxButton(panel, LboxTest_Quit, _T("E&xit")); btn = new wxButton(m_panel, LboxTest_Quit, _T("E&xit"));
sizerBtns->Add(btn); sizerBtns->Add(btn);
sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5); sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5);
@@ -461,8 +464,8 @@ LboxTestFrame::LboxTestFrame(const wxString& title)
Reset(); Reset();
m_dirty = FALSE; m_dirty = FALSE;
panel->SetAutoLayout(TRUE); m_panel->SetAutoLayout(TRUE);
panel->SetSizer(sizerTop); m_panel->SetSizer(sizerTop);
sizerTop->Fit(this); sizerTop->Fit(this);
sizerTop->SetSizeHints(this); sizerTop->SetSizeHints(this);
@@ -534,7 +537,7 @@ void LboxTestFrame::CreateLbox()
delete m_lbox; delete m_lbox;
} }
m_lbox = new wxListBox(this, LboxTest_Listbox, m_lbox = new wxListBox(m_panel, LboxTest_Listbox,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
0, NULL, 0, NULL,
flags); flags);