SOLVED: Bring TImage to front of TEdit lazarus / 39-Graphics ---------------------------------------------------------------------- SaraT · 2020-02-13 20:33 Hi friends Is there a way to bring an Image control to front? This doesn't work: Image1.BringToFront; neither Z-order property. Please, can you provide me a new trick? See the attached image. ---------------------------------------------------------------------- winni · 2020-02-13 21:05 Hi! I am not a visionary! Image1 is maginifier?? What is the other component? Are you in a loop while you do: Image1.BringToFront - then you should insert Application.ProcessMessages to let the Image some time to breath - or let's say: to handle all events in the queu. Winni Need some more info or source. Winni ---------------------------------------------------------------------- SaraT · 2020-02-13 21:09 Quote from: winni on February 13, 2020, 10:05:34 pmHi! I am not a visionary! Image1 is maginifier?? What is the other component? Are you in a loop while you do: Image1.BringToFront - then you should insert Application.ProcessMessages to let the Image some time to breath - or let's say: to handle all events in the queu. Winni Need some more info or source. Winni The components are: TEdit and TImage I have tried with Z-order and Image.BringToFront but don't work :/ I need another idea. Thanks ---------------------------------------------------------------------- lainz · 2020-02-13 21:24 Is not possible. TImage is TGraphicControl descendant and TEdit is TWinControl desdendant and doesn't accept to put controls (any) in top of it, at least is what I know. TGraphicControl are drawn in top of a Canvas, like a Panel or a Form. ---------------------------------------------------------------------- winni · 2020-02-13 21:36 So put you magnifyer in a second mini form and show it. Winni ---------------------------------------------------------------------- lucamar · 2020-02-13 21:45 Maybe too obvious but, have you tried sending the TEdit to the back instead? I mean, using: MyEdit.SendToBack I'm not sure at all  whether that will work but it's worth a try ... ---------------------------------------------------------------------- korba812 · 2020-02-13 21:48 You can try to compose such component using standard controls. See the attached example. ---------------------------------------------------------------------- SaraT · 2020-02-14 00:22 Quote from: korba812 on February 13, 2020, 10:48:33 pmYou can try to compose such component using standard controls. See the attached example. Thanks, but unable to open the project. It is blank I dont know why. ---------------------------------------------------------------------- winni · 2020-02-14 00:46 @SaraT Yes, you are right: "The project has no main source file" - after opening the unit manual. What is your goal with the Edit component and the magnifier? Winni ---------------------------------------------------------------------- SaraT · 2020-02-14 01:07 Quote from: korba812 on February 13, 2020, 10:48:33 pmYou can try to compose such component using standard controls. See the attached example. Thanks guys I was able to do it with this sample. The project is blank but you can open the .pas file ans see how it works. Many thanks again  You can see it in action in the gif below. ---------------------------------------------------------------------- skalogryz · 2020-02-14 04:10 oddly enough "embedding buttons into controls" is following me lately. anyways, Lazarus provides a default solution for such task: TEditButton (can be found at TEditButton) (see "Misc" tab) doesn't look as fancy, but it does the job. (and is used throughout IDE itself) ---------------------------------------------------------------------- El Salvador · 2020-07-18 09:59 So, you have only this possibility to make a TEdit component with left/right buttons embedding in it? I'm trying make a TCustomEdit based with buttons in it, following this tip https://wiki.lazarus.free pascal.org/TEdit#Embedding_Button.2FOther_Controls_in_TEdit, but I have repainting issues (especially when I select text). ---------------------------------------------------------------------- PascalDragon · 2020-07-18 11:51 Quote from: SaraT on February 14, 2020, 01:22:29 amQuote from: korba812 on February 13, 2020, 10:48:33 pmYou can try to compose such component using standard controls. See the attached example. Thanks, but unable to open the project. It is blank I dont know why. It is blank because the author used Lazarus 2.1 and forgot to enable "Increase compatibility of project" so that it is stored in a format that is useable by Lazarus 2.0 as well. ---------------------------------------------------------------------- flowCRANE · 2020-07-18 16:48 If you can't get Edit to embed an image/button component, there's always another trick. Take a Panel, turn off its border and in the OnPaint event paint it like Edit — just use ThemeServices. Then take Edit, turn off its border and embed it in the panel. Next to Edit, place the component with the image (button or whatever you like) and also embed it in the panel. And that's it — everything looks like it should and has appropriate margins, thanks to which the image will not cover the text. In this way you can embed what you need and where you need. ---------------------------------------------------------------------- dtamadeEx · 2020-07-23 17:58 Rewriting a text box might be a better solution