LCL-Win32: Implement native Combobox.TextHint support for Windows.

git-svn-id: trunk@63735 -
This commit is contained in:
juha 2020-08-14 14:35:53 +00:00
parent dc8ca7a17f
commit 52a2cdbb1b

View File

@ -100,6 +100,7 @@ type
class procedure SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;
class procedure SetStyle(const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle); override;
class procedure SetReadOnly(const ACustomComboBox: TCustomComboBox; NewReadOnly: boolean); override;
class procedure SetTextHint(const ACustomComboBox: TCustomComboBox; const ATextHint: string); override;
class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; override;
class procedure Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean); override;
@ -1128,6 +1129,15 @@ begin
SendMessage(info.hwndItem, EM_SETREADONLY, WParam(NewReadOnly), 0);
end;
class procedure TWin32WSCustomComboBox.SetTextHint(
const ACustomComboBox: TCustomComboBox; const ATextHint: string);
const
CB_SETCUEBANNER = (CBM_FIRST + 3); // Same as EM_SETCUEBANNER for TEdit
begin
if not WSCheckHandleAllocated(ACustomComboBox, 'SetTextHint') then Exit;
SendMessage(ACustomComboBox.Handle, CB_SETCUEBANNER, 1, {%H-}LParam(PWideChar(UTF8ToUTF16(ATextHint))));
end;
class function TWin32WSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox): integer;
begin
Result := SendMessage(ACustomComboBox.Handle, CB_GETCURSEL, 0, 0);