Drawing on TEdit canvas lazarus / 31-LCL ---------------------------------------------------------------------- Mando · 2015-03-30 10:03 Hi. I want to do a TEdit descendant that be able to draw on its canvas. I tried WM_PAINT message but doesn't work. The message only fires when parent form redraws. I want to achieve is that when the control text is empty, displays a text indicating what the usiario should write . For example: A Tedit used to introduce a user, must display " User" another to enter the password , you must show "Password" when the text is empty. Any idea how to achieve it ? regards ---------------------------------------------------------------------- Mando · 2015-03-30 10:33 That is I want: ---------------------------------------------------------------------- zeljko · 2015-03-30 11:03 You can achieve that without painting. Look how it is done in TreeViewEditFilter (or similar name in IDE ..... eg for OI). ---------------------------------------------------------------------- Mando · 2015-03-30 11:21 Hi, zeljko: Thanks for your answer. But I need to draw some glyps also. regards ---------------------------------------------------------------------- zeljko · 2015-03-30 11:34 Ah, I've answered via phone, so that's why it wasn't bull eye hit. Now I see image at the left of text. Thought that you need only grayed text. With qtlcl it can be achieved , but don't know how to do that under win32. Under qt you can add child control (eg. flat TBitBtn at the left + glyph). ---------------------------------------------------------------------- typo · 2015-03-30 12:15 You could try to use a TControlCanvas. ---------------------------------------------------------------------- Bart · 2015-03-30 14:59 There is a feature request in the bugtracker for TextHint support. I tried to implement it, but got stuck with Z-order problems on GTK2. Bart ---------------------------------------------------------------------- zeljko · 2015-03-30 18:01 Quote from: Bart on March 30, 2015, 04:59:34 pmThere is a feature request in the bugtracker for TextHint support. I tried to implement it, but got stuck with Z-order problems on GTK2. It is problematic even with pure gtk2 application. In gtk3 there's possibility to have an image inside GtkEdit (stupid, they can set it up as container for any gtkwidget eg. gtkbutton....) ---------------------------------------------------------------------- skalogryz · 2015-03-30 18:25 I wonder if this non-composting approach works for you. (composting approach would be adding TLabel and TImage to TEdit instead of painting them) ---------------------------------------------------------------------- rvk · 2015-03-30 18:36 There is mention here that when the control has focus but empty the grey hint shouldn't be displayed. Is that not inconvenient? When I create a login dialog and the first control (Username) has focus the user can't see he has to type the username. Better would be to just keep showing the grey hint and only remove it when the user starts typing. Am I alone in thinking that? How does this work in Delphi? (I know some DB controls have a NullText which keep showing until changed regardless of focus) Code: [Select]if (text='') { and not Focused } then begin ---------------------------------------------------------------------- skalogryz · 2015-03-30 18:47 Quote from: rvk on March 30, 2015, 08:36:10 pmAm I alone in thinking that? You're probably right. Just remove the code. ---------------------------------------------------------------------- skalogryz · 2015-03-30 19:22 now this one looks eye-candy on windows. ---------------------------------------------------------------------- Mando · 2015-03-31 09:25 Thanks to all, specially to skalogryz. All I needed to change in my control was the message WM_PAINT by LM_PAINT. regards ---------------------------------------------------------------------- McClane · 2019-08-13 16:45 TestMando.zip works on windows but not on linux. Is there some another way to make it work? Thanks in advance. ---------------------------------------------------------------------- ASerge · 2019-08-13 21:02 Quote from: McClane on August 13, 2019, 06:45:47 pmIs there some another way to make it work? Example attached (tested on Windows only). Advantage - only standard components, no complex code. Disadvantage - the active edit field is not highlighted by the border color. ---------------------------------------------------------------------- McClane · 2019-08-14 04:36 Hi aSerge, thanks for your reply. I got Bitmapadv property not found on uMain.lfm, but I adited the ImageList with two of my icons and it worked. You're a genius, thank you