From 39f989086445a024c9c08efe1eec20fe4f0ee98c Mon Sep 17 00:00:00 2001 From: wp Date: Mon, 21 Sep 2020 12:10:31 +0000 Subject: [PATCH] LCL/Combobox: Fix hehavior when ESC or ENTER are pressed in dropped-down state. Issue #37674. Patch by jamie philbrook. git-svn-id: trunk@63903 - --- lcl/interfaces/win32/win32wsstdctrls.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lcl/interfaces/win32/win32wsstdctrls.pp b/lcl/interfaces/win32/win32wsstdctrls.pp index 30f326ba33..e099c5ac86 100644 --- a/lcl/interfaces/win32/win32wsstdctrls.pp +++ b/lcl/interfaces/win32/win32wsstdctrls.pp @@ -1200,7 +1200,7 @@ class procedure TWin32WSCustomComboBox.SetDroppedDown( const ACustomComboBox: TCustomComboBox; ADroppedDown: Boolean); var aSelStart, aSelLength: Integer; - aText: string; + aText: string = ''; Editable: Boolean; OldItemIndex: Integer; begin @@ -1217,7 +1217,8 @@ begin OldItemIndex := GetItemIndex(ACustomComboBox); SendMessage(ACustomComboBox.Handle, CB_SHOWDROPDOWN, WPARAM(ADroppedDown), 0); - SetItemIndex(ACustomComboBox, OldItemIndex); + if GetKeyState(VK_RETURN) < 0 then + SetItemIndex(ACustomComboBox, OldItemIndex); if Editable then begin