22 Votes

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

Tip by Delphian | Last update on 2023-12-03 | Created on 2013-10-29

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

Solution: Via the property PageIndex, it is possible to determine and set 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 previously, "TabSheet0" is located at the first position and after running this code, "TabSheet3" is at the first position while  "TabSheet0" is at the last position on the PageControl.

ReplyPositiveNegative

About the Author

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

 

Related Topics

VirtualBox: Change Date and Time

Tutorial | 10 Comments

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.