X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f7ad3cd30b06dc80786a656ca05bd9c98dacc7c9..2add9e3c2f07bdb9234fbf3b84dda6b04d5ed598:/contrib/src/gizmos/editlbox.cpp?ds=sidebyside diff --git a/contrib/src/gizmos/editlbox.cpp b/contrib/src/gizmos/editlbox.cpp index 4f489d5746..a9315781de 100644 --- a/contrib/src/gizmos/editlbox.cpp +++ b/contrib/src/gizmos/editlbox.cpp @@ -7,10 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ - #pragma implementation "editlbox.h" -#endif - // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -41,7 +37,7 @@ public: const wxSize &size = wxDefaultSize, long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, - const wxString &name = _T("listctrl")) + const wxString &name = wxListCtrlNameStr) : wxListCtrl(parent, id, pos, size, style, validator, name) { CreateColumns(); @@ -222,12 +218,18 @@ void wxEditableListBox::OnNewItem(wxCommandEvent& WXUNUSED(event)) void wxEditableListBox::OnEndLabelEdit(wxListEvent& event) { if ( event.GetIndex() == m_listCtrl->GetItemCount()-1 && - !event.GetText().IsEmpty() ) + !event.GetText().empty() ) { // The user edited last (empty) line, i.e. added new entry. We have to // add new empty line here so that adding one more line is still // possible: m_listCtrl->InsertItem(m_listCtrl->GetItemCount(), wxEmptyString); + + // Simulate a wxEVT_COMMAND_LIST_ITEM_SELECTED event for the new item, + // so that the buttons are enabled/disabled properly + wxListEvent selectionEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED, m_listCtrl->GetId()); + selectionEvent.m_itemIndex = event.GetIndex(); + m_listCtrl->GetEventHandler()->ProcessEvent(selectionEvent); } }