TabSheetCaption (C++)

From RAD Studio Code Examples
Jump to: navigation, search


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.


void __fastcall TForm1::Button1Click(TObject *Sender)
  TTabSheet *sheet = PageControl1->ActivePage;
  sheet->Caption = Edit1->Text;