Discussion:
Drawing over LCL controls
Krzysztof
2012-10-05 15:26:24 UTC
Permalink
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

--
patspiper
2012-10-05 15:48:06 UTC
Permalink
Post by 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
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

--
Krzysztof
2012-10-05 16:49:26 UTC
Permalink
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

--
zeljko
2012-10-05 16:59:42 UTC
Permalink
Post by Krzysztof
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

--
William Oliveira Ferreira
2012-10-05 20:12:15 UTC
Permalink
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
Post by Krzysztof
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
Hans-Peter Diettrich
2012-10-05 23:27:03 UTC
Permalink
Post by Krzysztof
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


--
Krzysztof
2012-10-06 10:59:49 UTC
Permalink
Ok I have done this with text manipulation (on enter, on exit events)

--
William Oliveira Ferreira
2012-10-06 13:29:13 UTC
Permalink
did you tested that link i've send?
Post by Krzysztof
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
Krzysztof
2012-10-06 15:23:37 UTC
Permalink
Post by William Oliveira Ferreira
did you tested that link i've send?
Yes, it is using another TEdit as a cover

--

Continue reading on narkive:
Loading...