Recent

Author Topic: Z-order won't play nicely with PageControl  (Read 3541 times)

heebiejeebies

  • Jr. Member
  • **
  • Posts: 70
Z-order won't play nicely with PageControl
« 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!
Ubuntu 18.04/Lazarus 2.0.10 FPC 3.2.0

GetMem

  • Hero Member
  • *****
  • Posts: 3457
Re: Z-order won't play nicely with PageControl
« Reply #1 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;
 

wp

  • Hero Member
  • *****
  • Posts: 8752
Re: Z-order won't play nicely with PageControl
« Reply #2 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.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

heebiejeebies

  • Jr. Member
  • **
  • Posts: 70
Re: Z-order won't play nicely with PageControl
« Reply #3 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.  :(
Ubuntu 18.04/Lazarus 2.0.10 FPC 3.2.0

heebiejeebies

  • Jr. Member
  • **
  • Posts: 70
Re: Z-order won't play nicely with PageControl
« Reply #4 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?
Ubuntu 18.04/Lazarus 2.0.10 FPC 3.2.0

heebiejeebies

  • Jr. Member
  • **
  • Posts: 70
Re: Z-order won't play nicely with PageControl
« Reply #5 on: June 04, 2021, 07:59:38 am »
Should I submit a bug report for this?
Ubuntu 18.04/Lazarus 2.0.10 FPC 3.2.0

GetMem

  • Hero Member
  • *****
  • Posts: 3457
Re: Z-order won't play nicely with PageControl
« Reply #6 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