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:
parent
3a95f73c00
commit
9d79c17697
@ -1490,21 +1490,15 @@ bool wxListCtrl::EndEditLabel(bool cancel)
|
||||
if ( !hwnd )
|
||||
return false;
|
||||
|
||||
// Newer versions of Windows have a special message for cancelling editing,
|
||||
// use it if available.
|
||||
#ifdef ListView_CancelEditLabel
|
||||
if ( cancel && (wxApp::GetComCtl32Version() >= 600) )
|
||||
{
|
||||
ListView_CancelEditLabel(GetHwnd());
|
||||
}
|
||||
else
|
||||
#endif // ListView_CancelEditLabel
|
||||
{
|
||||
// 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
|
||||
// emulate the corresponding user action instead.
|
||||
::SendMessage(hwnd, WM_KEYDOWN, cancel ? VK_ESCAPE : VK_RETURN, 0);
|
||||
}
|
||||
// Newer versions of Windows have a special ListView_CancelEditLabel()
|
||||
// message for cancelling editing but it, rather counter-intuitively, keeps
|
||||
// the last text entered in the dialog while cancelling as we do it below
|
||||
// restores the original text which is the more expected behaviour.
|
||||
|
||||
// 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
|
||||
// emulate the corresponding user action instead.
|
||||
::SendMessage(hwnd, WM_KEYDOWN, cancel ? VK_ESCAPE : VK_RETURN, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user