Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-06

Paint over TEdit control

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys
to Krzysztof: Is it possible to paint over TEdit control? I need this for windows and linux (qt, gtk).…
Krzysztof wrote
Is it possible to paint over TEdit control? I need this for windows and linux (qt, gtk). For now I need only draw text

You can't. The stock LCL controls are not meant for customisation - they are for native look only and for adhering to the underlying widgetset's themes. If you want customisation, use custom drawn components instead.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Jürgen Hestermann
to Graeme Geldenhuys
Graeme Geldenhuys wrote 7 lines
On 2014-06-18 17:37, Krzysztof wrote: > Is it possible to paint over TEdit control? I need this for windows and > linux (qt, gtk). For now I need only draw text You can't. The stock LCL controls are not meant for customisation - they are for native look only and for adhering to the underlying widgetset's themes. If you want customisation, use custom drawn components instead.

I am also fighting with multicolor text in TLabels etc. Currently I am simply painting into the form which works reasonable (and is asonishing fast) but then I have to do all the other things like anchoring, repainting, storing displayed text etc. myself too. Can you name some custom drawn compontents that could replace for example a TLabel component.

And another aim I am trying to achive is an edit compontent with (self drawn) multi color text. Is there one?

Reply by email

Graeme Geldenhuys
to Jürgen Hestermann
J?rgen Hestermann wrote 5 lines
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.

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.

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. Or do you simply mean the whole text must be one color or another (the latter I think is possible with LCL). Either way, with fpGUI that is easily accomplish because fpGUI is a 100% custom drawn toolkit (fully implemented in Object Pascal), so you have full control over the look and feel. That is actually the main reason I developed fpGUI, because LCL couldn't cater for Corporate Branding I needed to apply in a specific app.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Jürgen Hestermann
to Graeme Geldenhuys
Graeme Geldenhuys wrote 8 lines
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).

Reply by email

Graeme Geldenhuys
to Jürgen Hestermann
J?rgen Hestermann wrote
But that means that I have to abandon the LCL, correct?

Hence I asked if it is a new project or has a well abstracted user interface.

Or can I mix LCL and fpGUI?

No, not in the user interface. But you can use some base LCL (mainly non-GUI) units in a fpGUI application.

Yes. I want to display file paths where the delimiters (\ or /) are displayed in a different color than the directory/file names between them.

OK, that's what I thought you meant.

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.

You could always create your own widget - but sometimes that is also more work than expected.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email