[Lazarus] Paint over TEdit control

Jürgen Hestermann juergen.hestermann at gmx.de
Sat Jun 21 12:01:25 CEST 2014


Am 2014-06-20 20:47, schrieb Graeme Geldenhuys:
> On 2014-06-20 18:09, Jürgen Hestermann wrote:
>> I am also fighting with multicolor text in TLabels etc.
>> ...
>> And another aim I am trying to achive is an edit compontent
>> with (self drawn) multi color text. Is there one?
>
> You can try the LCL-CustomDrawn widgets, but last I checked they were
> still in alpha state, and not ready for prime usage.

Thanks, I will have a look at it.


> If it's a new project, or you have the UI well abstracted, you could
> always give fpGUI Toolkit (see my signature) a go. Adding the
> functionality you require into fpGUI will take about 15 minutes.

But that means that I have to abandon the LCL, correct?
Or can I mix LCL and fpGUI?


> By the way, when you say multi-color text in a TEdit, do you mean some
> parts of the text is one color, and other parts another etc.

Yes. I want to display file paths where the delimiters (\ or /) are displayed in a different
color than the directory/file names between them.
This works already fine when using LCLintf.drawtext and canvas.fillrect (at the end).
Though it took me a while to find out that drawtext does not overwrite the whole rect
area and I needed to place a fillrect in the paint routine of the form.

And the handling when drawing directly on the form is arkward because I have to do
everything on my own. No automatics like anchoring, repainting, etc. are available.
What I need is a TLabel, where I can draw the text on my on (but everything else
should be available) and an TEdit component where I can draw the text myself
*and* I also want to do the keyboard handling myself (i.e., when typing backspace
while the text is still highlighted it should *not* delete the whole highlight but
only delete the last character).








More information about the Lazarus mailing list