Recent

Author Topic: TImage.BringToFront does not work as expected  (Read 2613 times)

FrankBKK

  • New Member
  • *
  • Posts: 31
TImage.BringToFront does not work as expected
« on: June 26, 2021, 02:50:08 pm »
I have a simple Form with a TImage on the top and a TPageControl on the bottom of the window.

OnImageDoubleClick  the Picture will be enlarged to the size of the form and  shown over the the PageControl.

The resizing part works fine, but an  Image.BringToFront  does not work - the Image is still behind the PageControl.

PageControl.SendToBack  has no effect either.

How can I fix this ?
« Last Edit: June 26, 2021, 02:52:57 pm by FrankBKK »

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: TImage.BringToFront does not work as expected
« Reply #1 on: June 26, 2021, 04:33:45 pm »
Hi!

I don't know where the  problem with bringToFront is.
But as a workaround you can use

Code: Pascal  [Select][+][-]
  1. PageControl.visible := false;

and later switch it on again.

Winni

alpine

  • Hero Member
  • *****
  • Posts: 1064
Re: TImage.BringToFront does not work as expected
« Reply #2 on: June 26, 2021, 09:21:22 pm »
TImage is not a real "widget", it is a descendant of TGraphicControl. Put the image on a TPanel and bring him to front.
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: TImage.BringToFront does not work as expected
« Reply #3 on: June 26, 2021, 09:32:59 pm »
I have a simple Form with a TImage on the top and a TPageControl on the bottom of the window.

OnImageDoubleClick  the Picture will be enlarged to the size of the form and  shown over the the PageControl.
Don't do this. Even if the Image would cover the PageControl, the controls on the Pagecontrol are still active and can receive user keyboard input. Much better to follow winni's approach to hide the PageControl when you don't want to see it.

 

TinyPortal © 2005-2018