00 Votes

Delphi/Lazarus: Change Order of TabSheets on PageControl at runtime

Tip by Delphian | 2013-10-29 at 15:55

Question: We have a TPageControl, on which there are positioned some TabSheets. At the start of the program, those tabs have a specific arrangement and we would like to change this arrangement or the order of the tabs during the runtime of our program.

Solution: Via the property PageIndex, it is possible to determine the position of each TabSheet on a PageControl.

procedure TForm1.Button1Click(Sender: TObject);
begin
  TabSheet3.PageIndex:=0;
  TabSheet2.PageIndex:=1;
  TabSheet1.PageIndex:=2;
  TabSheet0.PageIndex:=3;
end; 

In the example, the order of the TabSheets "TabSheet0" to "TabSheet3" is reversed, so that first, "TabSheet0" is located at the first position and after running the code, "TabSheet3" is located at the first position and "TabSheet0" is at the last position.

ReplyPositiveNegative

About the Author

AvatarThe author has not added a profile short description yet.
Show Profile

 

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.