fixed memory leak in the sample and simplified wxCheckListBox creation code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37528 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-02-12 12:54:19 +00:00
parent 3ff260ae2c
commit 9002a61c32

View File

@@ -264,14 +264,27 @@ public:
#if wxUSE_CHECKLISTBOX #if wxUSE_CHECKLISTBOX
static const wxChar *aszChoices[] = static const wxChar *aszChoices[] =
{ _T("Zeroth"), _T("First"), _T("Second"), _T("Third"), _T("Fourth"), _T("Fifth"), _T("Sixth"), _T("Seventh"), _T("Eighth"), _T("Nineth") }; {
wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)]; _T("Zeroth"),
unsigned int ui; _T("First"),
for ( ui = 0; ui < WXSIZEOF(aszChoices); ui++ ) _T("Second"),
astrChoices[ui] = aszChoices[ui]; _T("Third"),
_T("Fourth"),
_T("Fifth"),
_T("Sixth"),
_T("Seventh"),
_T("Eighth"),
_T("Nineth")
};
m_checklistbox = new wxCheckListBox(this, wxID_ANY, wxDefaultPosition, wxSize(100,100), m_checklistbox = new wxCheckListBox
WXSIZEOF(aszChoices), astrChoices); (
this,
wxID_ANY,
wxDefaultPosition,
wxSize(100,100),
wxArrayString(WXSIZEOF(aszChoices), aszChoices)
);
mainSizer->Add( mainSizer->Add(
m_checklistbox, m_checklistbox,