ButtonControlChecked (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example requires a PageControl with no pages created and a TCheckBox. While the form is being created, a series of tabs is created on the Page Control. The space used to display the tabs exceeds the space allocated 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

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  PageControl1.MultiLine := CheckBox1.Checked;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  Checkbox1.Caption := 'Stack Tabs?';
  for i := 0 to 20 do
    with TTabSheet.Create(Self) do
    begin
      PageControl := PageControl1;
      Caption := 'Tab #' + IntToStr(i);
    end;
end;

Uses