Lazarus

Using the Lazarus IDE => Designer => Topic started by: heebiejeebies on June 02, 2021, 08:53:19 am

Title: Z-order won't play nicely with PageControl
Post by: heebiejeebies on June 02, 2021, 08:53:19 am
Hi all,

My app consists of a large number of screens, which the user can flick between using a PageControl.  At times I will need to display a banner at the top of the screen that covers the page beneath it, regardless of which tab the user is on.  I have tried making a banner out of a TStaticText and a TLabel and moving them to the front of the Z-order.  Nothing doing - it covers the tabs of the PageControl, but not the content of the individual page.  :(  The banner is a child of the form, of course - not of the Pagecontrol.

How do I get it to properly respect the Z-order and show the banner in front of everything at all times?

Thanks!
Title: Re: Z-order won't play nicely with PageControl
Post by: balazsszekely on June 02, 2021, 02:54:46 pm
TLabel is inherited from TGraphicControl, so you cannot change the Z order, which only works for TWinControls. As an alternative solution, put the label inside a panel then:
Code: Pascal  [Select][+][-]
  1. XY.SendToBack;
  2. Panel.BringToFront;
 
Title: Re: Z-order won't play nicely with PageControl
Post by: wp on June 02, 2021, 03:00:39 pm
Use a TNotebook which covers the entire form. Add two pages. The first page contains the pagecontrol and the rest, the second page contains the banner. When you want to show the banner, set Notebook.Pageindex to 1 (the index of the banner), when you want to hide it reset the PageIndex back 0. Use the object tree above the object inspector to navigate between the notebook pages.
Title: Re: Z-order won't play nicely with PageControl
Post by: heebiejeebies on June 03, 2021, 02:31:04 am
TLabel is inherited from TGraphicControl, so you cannot change the Z order, which only works for TWinControls. As an alternative solution, put the label inside a panel then:
Code: Pascal  [Select][+][-]
  1. XY.SendToBack;
  2. Panel.BringToFront;


Thank you.  It didn't work.  Same result - it still only covers the tabs, not the content.  :(
Title: Re: Z-order won't play nicely with PageControl
Post by: heebiejeebies on June 03, 2021, 02:34:45 am
Use a TNotebook which covers the entire form. Add two pages. The first page contains the pagecontrol and the rest, the second page contains the banner. When you want to show the banner, set Notebook.Pageindex to 1 (the index of the banner), when you want to hide it reset the PageIndex back 0. Use the object tree above the object inspector to navigate between the notebook pages.

Thank you!  But surely that will mean I see nothing but the banner when I set the notebook to 1?
Title: Re: Z-order won't play nicely with PageControl
Post by: heebiejeebies on June 04, 2021, 07:59:38 am
Should I submit a bug report for this?
Title: Re: Z-order won't play nicely with PageControl
Post by: balazsszekely on June 04, 2021, 09:49:57 am
Quote
Should I submit a bug report for this?
I'm not sure it's a bug(maybe it is), but even if you create a bug report, you must attach a project where the issue is clearly reproducible. So perhaps you can start here with a test project?
TinyPortal © 2005-2018