[Lazarus] How to create hints in the IDE
Bernd Kreuss
prof7bit at googlemail.com
Sun Jul 25 12:23:52 CEST 2010
Mattias Gaertner wrote:
> It's a THintWindow, but with a control inside.
> See TSourceNotebook.ActivateHint how to use it.
> Code is in helpmanager.pas
Ok, I think I found the reason and have a new question:
in TIDEHelpManager.CreateHint (in helpmanager.pas at line 1265)
which will be called somewhere later during the hint creation there is
the following:
IsHTML:=SysUtils.CompareText(copy(TheHint,1,6),'<HTML>')=0;
I did not have the html tag at the first position so this method thought
it was plaintext and used a plaintext label. But the same thing happens
also whenever you are debugging an application and then create a hint.
There will be information from the debugger at the fist part of TheHint
and the normal hint text (with the tags) follows at the end and so it
will not recognize the HTML and use a plaintext label. Debug an
application and hover the mouse over an identifier with fpdoc and you
will see ugly tags in the hint.
I understand that a HTML control would not be able to interpret the line
breaks in the debugger output and also in the debugger output there
could be html tags as variable contents so they could not just easily be
all stripped from the text, but I think there still should be some
elegant way found to handle or avoid this mixed plaintext/html
situation. Maybe TIDEHelpManager.GetHintForSourcePosition() should be
given the ability to automatically return a stripped version whenever
the debugger is running or alternatively always format the debugger
output or even *anything* that goes into such hints *always* into nice
and proper html after escaping all occurrences of < and > with
htmlentities and then always use the HTML label.
More information about the Lazarus
mailing list