Don't use ListView_CancelEditLabel() as it doesn't work as expected.
ListView_CancelEditLabel() doesn't revert the controls value to the original text as expected, so don't use it and revert to sending VK_ESCAPE to the in-place edit control instead under all versions of Windows. See #7663. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69894 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1490,21 +1490,15 @@ bool wxListCtrl::EndEditLabel(bool cancel)
|
|||||||
if ( !hwnd )
|
if ( !hwnd )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Newer versions of Windows have a special message for cancelling editing,
|
// Newer versions of Windows have a special ListView_CancelEditLabel()
|
||||||
// use it if available.
|
// message for cancelling editing but it, rather counter-intuitively, keeps
|
||||||
#ifdef ListView_CancelEditLabel
|
// the last text entered in the dialog while cancelling as we do it below
|
||||||
if ( cancel && (wxApp::GetComCtl32Version() >= 600) )
|
// restores the original text which is the more expected behaviour.
|
||||||
{
|
|
||||||
ListView_CancelEditLabel(GetHwnd());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif // ListView_CancelEditLabel
|
|
||||||
{
|
|
||||||
// We shouldn't destroy the control ourselves according to MSDN, which
|
// We shouldn't destroy the control ourselves according to MSDN, which
|
||||||
// proposes WM_CANCELMODE to do this, but it doesn't seem to work so
|
// proposes WM_CANCELMODE to do this, but it doesn't seem to work so
|
||||||
// emulate the corresponding user action instead.
|
// emulate the corresponding user action instead.
|
||||||
::SendMessage(hwnd, WM_KEYDOWN, cancel ? VK_ESCAPE : VK_RETURN, 0);
|
::SendMessage(hwnd, WM_KEYDOWN, cancel ? VK_ESCAPE : VK_RETURN, 0);
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user