Home > Software engineering >  How to change order of TTabSheets in an inherited TPageControl?
How to change order of TTabSheets in an inherited TPageControl?

Time:02-04

Usually what I do to change the order of TabSheets in a PageControl is:

  1. Right-click on the Form and choose "View as Text"

  2. Manually edit the source DFM to put the TabSheets in the desired order

  3. Right-click on the source and choose "View as Form"

Although it's a hassle, this procedure works.

But now, I have a new situation. I'm using a Form that inherits from another Form that already has a PageControl with 2 TabSheets. I need to add a third tab, but this needs to be the second in order. No matter what I do in the DFM source code, I can't change the second inherited TabSheet to be the third page in the PageControl.

Is there an alternative way to achieve changing the order of TabSheets in a inherited Form?

CodePudding user response:

Probably it's easiest to handle this in code: Set the TabSheet's PageIndex property in the Form's constructor or OnCreate event.

  •  Tags:  
  • Related