Recent

Author Topic: SOLVED: Bring TImage to front of TEdit  (Read 302 times)

SaraT

  • Jr. Member
  • **
  • Posts: 54
  • A little student
SOLVED: Bring TImage to front of TEdit
« on: February 13, 2020, 09:33:40 pm »
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.
« Last Edit: February 14, 2020, 02:08:43 am by SaraT »

winni

  • Hero Member
  • *****
  • Posts: 888
Re: Bring TImage to front of TEdit
« Reply #1 on: February 13, 2020, 10:05:34 pm »
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

  • Jr. Member
  • **
  • Posts: 54
  • A little student
Re: Bring TImage to front of TEdit
« Reply #2 on: February 13, 2020, 10:09:08 pm »
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

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

  • Hero Member
  • *****
  • Posts: 3466
    • Lainz
Re: Bring TImage to front of TEdit
« Reply #3 on: February 13, 2020, 10:24:38 pm »
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

  • Hero Member
  • *****
  • Posts: 888
Re: Bring TImage to front of TEdit
« Reply #4 on: February 13, 2020, 10:36:02 pm »
So put you magnifyer in a second mini form and show it.

Winni

lucamar

  • Hero Member
  • *****
  • Posts: 2383
Re: Bring TImage to front of TEdit
« Reply #5 on: February 13, 2020, 10:45:00 pm »
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 ...
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.4/2.0.6  - FPC 3.0.4 on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

korba812

  • Full Member
  • ***
  • Posts: 116
Re: Bring TImage to front of TEdit
« Reply #6 on: February 13, 2020, 10:48:33 pm »
You can try to compose such component using standard controls. See the attached example.

SaraT

  • Jr. Member
  • **
  • Posts: 54
  • A little student
Re: Bring TImage to front of TEdit
« Reply #7 on: February 14, 2020, 01:22:29 am »
You 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

  • Hero Member
  • *****
  • Posts: 888
Re: Bring TImage to front of TEdit
« Reply #8 on: February 14, 2020, 01:46:50 am »
@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

  • Jr. Member
  • **
  • Posts: 54
  • A little student
Re: Bring TImage to front of TEdit
« Reply #9 on: February 14, 2020, 02:07:26 am »
You 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  8)
You can see it in action in the gif below.


skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2358
    • havefunsoft.com
Re: SOLVED: Bring TImage to front of TEdit
« Reply #10 on: February 14, 2020, 05:10:46 am »
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)
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz