From 49266c6b4589932c01336641365163238ad8dd58 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 9 Jul 2007 15:00:42 +0000 Subject: [PATCH] generate wxEVT_COMMAND_LIST_END_LABEL_EDIT event even if label didn't change [backport of rev 47265 from trunk] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47266 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/generic/listctrl.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 06d3ea135e..18dbb35f87 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -131,6 +131,7 @@ wxGTK: - Don't unconditionally add wxCAPTION style to wxMiniFrame. - Fixed crash in file and dir pickers for GTK+ < 2.6 if compiled with GTK+ >= 2.6. +- Generate wxEVT_COMMAND_LIST_END_LABEL_EDIT event even if label didn't change wxMac: diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index dfb59b2ea7..bc8b0f291b 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2160,16 +2160,17 @@ bool wxListTextCtrlWrapper::AcceptChanges() { const wxString value = m_text->GetValue(); - if ( value == m_startValue ) - // nothing changed, always accept - return true; - + // notice that we should always call OnRenameAccept() to generate the "end + // label editing" event, even if the user hasn't really changed anything if ( !m_owner->OnRenameAccept(m_itemEdited, value) ) + { // vetoed by the user return false; + } - // accepted, do rename the item - m_owner->SetItemText(m_itemEdited, value); + // accepted, do rename the item (unless nothing changed) + if ( value != m_startValue ) + m_owner->SetItemText(m_itemEdited, value); return true; }