From: Vadim Zeitlin Date: Wed, 23 Jun 2004 18:26:49 +0000 (+0000) Subject: fixed sending 2 events (normal and bogus cancel one) when ending to edit a tree ctrl... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2b4f324ae2c1e5f12e6e639694b21f76d5b49625 fixed sending 2 events (normal and bogus cancel one) when ending to edit a tree ctrl item (patch 978403) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27979 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index d6a9c14aeb..5dede2bf17 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -407,12 +407,14 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event ) switch ( event.m_keyCode ) { case WXK_RETURN: - if ( !AcceptChanges() ) + if ( AcceptChanges() ) { - // vetoed by the user, don't disappear - break; + // Close the text control, changes were accepted + Finish(); } - //else: fall through + // else do nothing, do not accept and do not close + + break; case WXK_ESCAPE: Finish();