// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
- #pragma implementation "editlbox.h"
-#endif
-
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
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();
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);
}
}