View Issue Details

IDProjectCategoryView StatusLast Update
0030682LazarusLCLpublic2020-08-16 11:00
Reportersilvioprog Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version1.7 (SVN) 
Summary0030682: [FEATURE REQUEST] Add TextHint to TComboBox and TMemo
DescriptionHello,

It would be nice to add the TextHint support to the inputs ComboBox and Memo. :-)
TagsNo tags attached.
Fixed in Revisionr63731, r63734, r63745
LazTarget-
Widgetset
Attached Files

Relationships

related to 0021307 resolvedBart Broersma Lazarus TextHint support 
has duplicate 0036000 closedJuha Manninen Lazarus Feature req: TCombobox.TextHint support 
related to 0030671 closedJuha Manninen Lazarus [PATCH] Add new Delphi compatibility feature: MultiPaste dialog 
related to 0023194 assignedFelipe Monteiro de Carvalho Patches CDEdit - HintEx patch 
related to 0037553 closedJuha Manninen Lazarus after rev 63725 not work memo.lines.add 

Activities

Juha Manninen

2020-08-13 13:32

developer   ~0124837

I added TextHint to TComboBox in r63731. QT5 now works with native TextHint, GTK2 with emulated one.
Native support for Win32 is not implemented yet. Somebody else must do it.
Please test.

TextHint in TMemo works only with widgetset's native support. It works with QT5 but not with GTK2.
The emulation for TMemo turned out to be tricky. It may never be implemented, unless somebody provides a patch of course.

Serge Anvarov

2020-08-14 23:46

reporter   ~0124887

Added support for the TextHint property even if the combo box has focus (see attach).
ComboBoxTextHint.diff (1,081 bytes)   
Index: lcl/interfaces/win32/win32wsstdctrls.pp
===================================================================
--- lcl/interfaces/win32/win32wsstdctrls.pp	(revision 63737)
+++ lcl/interfaces/win32/win32wsstdctrls.pp	(working copy)
@@ -1133,9 +1133,20 @@
   const ACustomComboBox: TCustomComboBox; const ATextHint: string);
 const
   CB_SETCUEBANNER = (CBM_FIRST + 3); // Same as EM_SETCUEBANNER for TEdit
+var
+  Msg: UINT = CB_SETCUEBANNER;
+  Wnd: HWND;
+  Info: TComboboxInfo;
 begin
   if not WSCheckHandleAllocated(ACustomComboBox, 'SetTextHint') then Exit;
-  SendMessage(ACustomComboBox.Handle, CB_SETCUEBANNER, 1, {%H-}LParam(PWideChar(UTF8ToUTF16(ATextHint))));
+  Info.cbSize := SizeOf(Info);
+  Wnd := ACustomComboBox.Handle;
+  if Win32Extra.GetComboBoxInfo(Wnd, @Info) and (Info.hwndItem <> 0) then
+  begin
+    Wnd := Info.hwndItem;
+    Msg := EM_SETCUEBANNER;
+  end;
+  SendMessage(Wnd, Msg, 1, {%H-}LParam(PWideChar(UTF8ToUTF16(ATextHint))));
 end;
 
 class function TWin32WSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox): integer;
ComboBoxTextHint.diff (1,081 bytes)   

Juha Manninen

2020-08-15 12:27

developer   ~0124897

@Serge Anvarov, I guess your patch adds support for older versions of Windows. Applied, thanks!

Juha Manninen

2020-08-16 11:00

developer   ~0124917

I resolve this now.
TextHint for Combobox works now, both native and emulated.
Only native TextHint works for TMemo. The emulated version is tricky. LCL binding code for TMemo has 2 internal TStrings, one of them in widgetset code. Adding notifications for them requires studying and refactoring the code.

Issue History

Date Modified Username Field Change
2016-10-02 22:52 silvioprog New Issue
2016-10-03 15:57 Bart Broersma LazTarget => -
2016-10-03 15:57 Bart Broersma Summary [FEATURE REQUEST] Add TextHint => [FEATURE REQUEST] Add TextHint to TComboBox and TMemo
2017-08-28 09:43 Juha Manninen Relationship added related to 0030671
2017-10-08 13:39 Juha Manninen Relationship added related to 0023194
2017-10-08 15:38 Juha Manninen Relationship added related to 0021307
2020-08-12 10:29 Juha Manninen Relationship added has duplicate 0036000
2020-08-12 10:31 Juha Manninen Relationship added related to 0037553
2020-08-13 13:25 Juha Manninen Assigned To => Juha Manninen
2020-08-13 13:25 Juha Manninen Status new => assigned
2020-08-13 13:32 Juha Manninen Note Added: 0124837
2020-08-14 23:46 Serge Anvarov Note Added: 0124887
2020-08-14 23:46 Serge Anvarov File Added: ComboBoxTextHint.diff
2020-08-15 12:27 Juha Manninen Fixed in Revision => r63731, r63734, r63745
2020-08-15 12:27 Juha Manninen Note Added: 0124897
2020-08-16 11:00 Juha Manninen Status assigned => resolved
2020-08-16 11:00 Juha Manninen Resolution open => fixed
2020-08-16 11:00 Juha Manninen Note Added: 0124917