RadioGroupItems (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example requires a radio group box and a scroll bar on a form. When you select one of the radio buttons, the scroll bar changes orientation accordingly.

Code

procedure TForm1.FormCreate(Sender: TObject);
begin
  RadioGroup1.Items.Add('Vertical');
  RadioGroup1.Items.Add('Horizontal');
  RadioGroup1.ItemIndex := 2;
end;

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
  if RadioGroup1.Items[RadioGroup1.ItemIndex] = 'Vertical' then
    ScrollBar1.Kind := sbVertical;
  if RadioGroup1.Items[RadioGroup1.ItemIndex] = 'Horizontal' then
    ScrollBar1.Kind := sbHorizontal;
end;

Uses