Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the current page of a TPageControl?

I am using a pagecontrol component and I need to add a button and click it to go to a specified page.

How can I do this please?

like image 860
Satch3000 Avatar asked May 26 '11 08:05

Satch3000


2 Answers

Add a button to the form and write an OnClick event handler like this:

procedure TMyForm.Button1Click(Sender: TObject);
begin
  PageControl1.ActivePage := TabSheet1;
end;
like image 93
David Heffernan Avatar answered Nov 14 '22 01:11

David Heffernan


You can use ActivePageIndex:

procedure TForm1.Button1Click(Sender: TObject);
begin
  PageControl1.ActivePageIndex := 0;
end;
like image 9
Jarek Bielicki Avatar answered Nov 13 '22 23:11

Jarek Bielicki