Sign in Join

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

Mailing lists / lazarus / 2012-10

Drawing over LCL controls

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Krzysztof

Hi,

Can I draw something on standard lazarus controls (e.g TEdit)? I created new control which inherit from TEdit and override PaintWindow method but is is never fired

Regards

Reply by email

patspiper
to Krzysztof
Krzysztof wrote 5 lines
Hi, Can I draw something on standard lazarus controls (e.g TEdit)? I created new control which inherit from TEdit and override PaintWindow method but is is never fired

I am not sure if what you are looking for is like TButtonEdit in LCL. It anchors a TSpeedButton to the TEdit. It is not the ideal solution, but it works. Some of the disadvantages are:

- The need for glue code that handles anchoring, freeing, visibility, readonly, etc...
- The width/height of the component are those of the TEdit itself
- The needed button's events must be explicitly exposed

Maybe a special component anchor control can be devised to provide the functionality?

Stephano

Reply by email

Krzysztof
to patspiper

I want draw hint text over edit like "search" which disappear when control get focus. I have already done it by changing text in DoEnter and DoExit methods (like in lazarus control TTreeFilterEdit), but I'm just curious if it is possible do the same thing by drawing text

Reply by email

zeljko
to Krzysztof
Krzysztof wrote
I want draw hint text over edit like "search" which disappear when control get focus. I have already done it by changing text in DoEnter and DoExit methods (like in lazarus control TTreeFilterEdit), but I'm just curious if it is possible do the same thing by drawing text

No, widgetsets does not allow painting over TEdit control. Maybe you can use customdrawn TCDEdit for that purpose, also there are solutions with TEdit which can help you. OnChange of tedit set gray color of text and set text to search when it's really empty, when user starts to type then remove "search" completely and change text color to clDefault or whatever.

zeljko

Reply by email

William Oliveira Ferreira
to Krzysztof: I want draw hint text over edit like "search" which disappear when control get focus. I…

If there?s no problem, you can use LazSolutions Component Pack https://github.com/silvioprog/lazsolutions

It has a TEdit with the placeholder property that does exactly what you need

2012/10/5 Krzysztof

Show quoted text 11 lines
I want draw hint text over edit like "search" which disappear when control get focus. I have already done it by changing text in DoEnter and DoExit methods (like in lazarus control TTreeFilterEdit), but I'm just curious if it is possible do the same thing by drawing text -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
________________________________ William de Oliveira Ferreira -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121005/6e0801a7/attachment.html>

Reply by email

Hans-Peter Diettrich
to Krzysztof: Can I draw something on standard lazarus controls (e.g TEdit)? I created new control…
Can I draw something on standard lazarus controls (e.g TEdit)? I created new control which inherit from TEdit and override PaintWindow method but is is never fired

This depends on the widgetset behaviour - which one do you use?

A Windows EDIT control does its own painting when focused, no chance to override that behaviour, even not in Delphi :-(

DoDi

Reply by email

William Oliveira Ferreira
to Krzysztof

did you tested that link i've send?

2012/10/6 Krzysztof

Show quoted text 8 lines
Ok I have done this with text manipulation (on enter, on exit events) -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
________________________________ William de Oliveira Ferreira -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121006/8e1c0222/attachment.html>

Reply by email