ButtonControlChecked (C++)

From RAD Studio Code Examples
Jump to: navigation, search


This example requires a PageControl with no pages created and a TCheckBox. During the form creation, a series of tabs that exceed the Page Control's width will be created on the Page Control. When the Check Box control is clicked, the setting of the MultiLine property is toggled, alternately stacking the tabs vertically, or along a single line horizontally.


void __fastcall TForm1::CheckBox1Click(TObject *Sender)
  PageControl1->MultiLine = CheckBox1->Checked;

__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
  CheckBox1->Caption = "Stack Tabs?";
  for (int i = 0; i < 20; i++)
	TTabSheet *pPage = new TTabSheet(PageControl1); // PageControl1 is the parent, so it will clean up.
	pPage->PageControl = PageControl1;
	pPage->Caption = String("Page") + IntToStr(i);