View Issue Details

IDProjectCategoryView StatusLast Update
0035967LazarusWidgetsetpublic2020-08-16 11:11
ReporterCudaText man Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionwon't fix 
Product Version2.0.3 (SVN) 
Summary0035967: TMemo.TextHint don't work on Win32
Descriptionsubj. It works ok on Linux, but TextHint is always hidden on win32. Whether control focused or not focused.
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0037553 closedJuha Manninen after rev 63725 not work memo.lines.add 

Activities

jamie philbrook

2019-08-15 22:58

reporter   ~0117692

Works here with 2.0.4 Lazarus.

CudaText man

2019-08-18 12:39

reporter   ~0117724

I tested r61720 on two PCs. win10.

Serge Anvarov

2019-08-21 00:20

reporter   ~0117755

In Win32, the TextHint property has built-in support, but not for multiline edit (TMemo): https://docs.microsoft.com/en-us/windows/win32/controls/em-setcuebanner

jamie philbrook

2019-08-21 01:50

reporter   ~0117757

@Serge Anvarov
   Those are CUE BANNERS, they are not the same as HintText. Although they kind of work the same way in general.

   He asked for Hint TExt, it works on my end, he claims it does not for a memo

   I also just tested it on my old W2K using Delphi, it works there, too.

 So maybe he should clarify his statement a little more.

CudaText man

2019-08-22 11:34

reporter   ~0117781

I wrote about TextHint property

Bart Broersma

2019-08-22 22:18

developer   ~0117785

Confirmed.
I'm not sure wether this is by design or not.
On Windows TextHint is set by the WS, which AFAIK does not support that for a memo?

Dmitry Boyarintsev

2019-08-22 22:59

developer   ~0117786

Last edited: 2019-08-22 22:59

View 2 revisions

@jamie philbrook
do you have a screen shot of working TextHint for TMemo on Windows?

as Serge Anvarov states the TextHint is not supported for TMemo by WinAPI.

jamie philbrook

2019-08-23 00:26

reporter   ~0117787

The issue here is it's improperly named, it should of been named "CueBanner" which is what it is..

  I was using the published Hint and of course that works. But this TextHint isn't published in Tmemo, at least its not on my system and most likely for good reason.
  
 Texthint (CueBanner) Works only in non-multiline Edit controls and if you use a TEDIT the property is published and it does work.

 I don't know what to tell you, ether don't worry about it and wait for windows to support it or emulate it ?

Serge Anvarov

2019-08-23 16:16

reporter   ~0117798

I don't see a good solution other than {$IFDEF WINDOWS} to use withing some methods.

In your program you can do so:
[code]
//...uses ..., LCLType,...
type
  TMemo = class(StdCtrls.TMemo)
  protected
    function CanShowEmulatedTextHint: Boolean; override;
    procedure InitializeWnd; override;
    procedure SetTextHint(const AValue: TTranslateString); override;
  end;

  TForm1 = class(TForm)
//...
uses Win32Proc;
//...
function TMemo.CanShowEmulatedTextHint: Boolean;
var
  SaveComCtlVersion: Cardinal;
begin
  SaveComCtlVersion := ComCtlVersion;
  ComCtlVersion := 0;
  try
    Result := inherited;
  finally
    ComCtlVersion := SaveComCtlVersion;
  end;
end;
//...
[/code]
And in the same way to write all three methods.
Reset variable ComCtlVersion force LCL to believe that the system doesn't support property TextHint and will be used an emulation.

Juha Manninen

2020-08-13 16:11

developer   ~0124843

Last edited: 2020-08-13 18:12

View 3 revisions

I first wrote Serge Anvarov's comment makes no sense, but it does.

function TWin32WidgetSet.GetLCLCapability tests for ComCtlVersion :
  ...
    lcTextHint:
    begin
      if (ComCtlVersion >= ComCtlVersionIE6) then
        Result := LCL_CAPABILITY_YES
      else
        Result := LCL_CAPABILITY_NO;
    end;

and function TCustomEdit.CanShowEmulatedTextHint calls GetLCLCapability.

Juha Manninen

2020-08-16 11:07

developer   ~0124918

Last edited: 2020-08-16 11:11

View 3 revisions

I resolve this as "won't fix".
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.

Emulated TextHint is now disabled for TMemo. See function TCustomMemo.CanShowEmulatedTextHint.
It did not work when lines were added to a Memo by code. See the related 0037553 for details.
It means Serge Anvarov's changes have no effect now.

If somebody does the required refactoring and testing, please reopen and provide a patch.

Issue History

Date Modified Username Field Change
2019-08-15 21:44 CudaText man New Issue
2019-08-15 22:58 jamie philbrook Note Added: 0117692
2019-08-18 12:39 CudaText man Note Added: 0117724
2019-08-21 00:20 Serge Anvarov Note Added: 0117755
2019-08-21 01:50 jamie philbrook Note Added: 0117757
2019-08-22 11:34 CudaText man Note Added: 0117781
2019-08-22 22:18 Bart Broersma Status new => confirmed
2019-08-22 22:18 Bart Broersma LazTarget => -
2019-08-22 22:18 Bart Broersma Note Added: 0117785
2019-08-22 22:59 Dmitry Boyarintsev Note Added: 0117786
2019-08-22 22:59 Dmitry Boyarintsev Note Edited: 0117786 View Revisions
2019-08-23 00:26 jamie philbrook Note Added: 0117787
2019-08-23 16:16 Serge Anvarov Note Added: 0117798
2020-08-12 10:32 Juha Manninen Relationship added related to 0037553
2020-08-13 16:11 Juha Manninen Note Added: 0124843
2020-08-13 16:12 Juha Manninen Note Edited: 0124843 View Revisions
2020-08-13 18:12 Juha Manninen Note Edited: 0124843 View Revisions
2020-08-16 11:07 Juha Manninen Assigned To => Juha Manninen
2020-08-16 11:07 Juha Manninen Status confirmed => resolved
2020-08-16 11:07 Juha Manninen Resolution open => won't fix
2020-08-16 11:07 Juha Manninen Widgetset Win32/Win64 => Win32/Win64
2020-08-16 11:07 Juha Manninen Note Added: 0124918
2020-08-16 11:09 Juha Manninen Note Edited: 0124918 View Revisions
2020-08-16 11:11 Juha Manninen Note Edited: 0124918 View Revisions