diff --git a/include/wx/generic/choicdgg.h b/include/wx/generic/choicdgg.h index 553381b050..7dbf48525a 100644 --- a/include/wx/generic/choicdgg.h +++ b/include/wx/generic/choicdgg.h @@ -64,13 +64,10 @@ public: long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); - void SetSelection(int sel) ; + void SetSelection(int sel); int GetSelection() const { return m_selection; } wxString GetStringSelection() const { return m_stringSelection; } - // get client data associated with selection - void *GetClientData() const { return m_clientData; } - // obsolete function (NB: no need to make it return wxChar, it's untyped) char *GetSelectionClientData() const { return (char *)m_clientData; } diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index 8b7e5bc941..560eee9c2b 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -233,8 +233,6 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), const wxPoint& WXUNUSED(pos) ) { m_selection = 0; - m_clientData = NULL; - m_stringSelection = wxT(""); m_dialogStyle = style; @@ -290,7 +288,8 @@ void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { m_selection = m_listbox->GetSelection(); m_stringSelection = m_listbox->GetStringSelection(); - m_clientData = m_listbox->GetClientData(m_selection); + if ( m_listbox->HasClientUntypedData() ) + SetClientData(m_listbox->GetClientData(m_selection)); EndModal(wxID_OK); } @@ -299,7 +298,8 @@ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event)) { m_selection = m_listbox->GetSelection(); m_stringSelection = m_listbox->GetStringSelection(); - m_clientData = m_listbox->GetClientData(m_selection); + if ( m_listbox->HasClientUntypedData() ) + SetClientData(m_listbox->GetClientData(m_selection)); EndModal(wxID_OK); } diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index ae049dada8..9027f25b83 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -310,8 +310,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, gtk_widget_show( GTK_WIDGET(m_list) ); wxSize newSize = size; - if (newSize.x == -1) newSize.x = 100; - if (newSize.y == -1) newSize.y = 110; + if (newSize.x == -1) + newSize.x = 100; + if (newSize.y == -1) + newSize.y = 110; SetSize( newSize.x, newSize.y ); if ( style & wxLB_SORT ) @@ -319,6 +321,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, // this will change DoAppend() behaviour m_strings = new wxSortedArrayString; } + else + { + m_strings = (wxSortedArrayString *)NULL; + } for (int i = 0; i < n; i++) { diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index ae049dada8..9027f25b83 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -310,8 +310,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, gtk_widget_show( GTK_WIDGET(m_list) ); wxSize newSize = size; - if (newSize.x == -1) newSize.x = 100; - if (newSize.y == -1) newSize.y = 110; + if (newSize.x == -1) + newSize.x = 100; + if (newSize.y == -1) + newSize.y = 110; SetSize( newSize.x, newSize.y ); if ( style & wxLB_SORT ) @@ -319,6 +321,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, // this will change DoAppend() behaviour m_strings = new wxSortedArrayString; } + else + { + m_strings = (wxSortedArrayString *)NULL; + } for (int i = 0; i < n; i++) {