ButtonControlChecked (C++)

From RAD Studio Code Examples
Revision as of 20:06, 3 November 2011 by L10nBot (talk | contribs) (normalized vcl links)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Description

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.


Code

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);
  }
}

Uses