TabSheetCaption (Delphi)
Description
This example requires a TPageControl populated by several TabSheets, a TEdit, and a TButton. When the button is clicked, the caption of the active tab changes to that of the TEdit.
These lines of code could also be written:
PageControl1.ActivePage.Caption := Edit1.Text;
This would preclude the need for a TTabSheet variable, since PageControl1.ActivePage is already of type TTabSheet.
Code
procedure TForm1.Button1Click(Sender: TObject);
var
sheet: TTabSheet;
begin
sheet := PageControl1.ActivePage;
sheet.Caption := Edit1.Text;
end;
Uses
- Vcl.Controls.TControl.Caption ( fr | de | ja )
- Vcl.ComCtrls.TPageControl.ActivePage ( fr | de | ja )