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

Mailing lists / lazarus / 2012-10
9 messages · 5 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
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
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
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
Krzysztof wroteI 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
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
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
Ok I have done this with text manipulation (on enter, on exit events)
did you tested that link i've send?
2012/10/6 Krzysztof
2012/10/6 William Oliveira Ferreira :
did you tested that link i've send?
Yes, it is using another TEdit as a cover