Checked: Boolean;
Checked: Boolean;
The Checked property determines state of the control radio button.
If the property is set to True, the current radio button is selected.
If the radio button is selected, all the other radio buttons in the same group are deselected.
Executing the example requires a form, a button named Button1 on it and the Ribbon component named Ribbon1. A tab and a panel are created on the ribbon of the Ribbon1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
RPanel: IRibbonPanel;
RGroup1, RGroup2: IRibbonGroup;
RRadioBtn1, RRadioBtn2, RRadioBtn3, RRadioBtn4: IRibbonRadioButton;
Begin
RPanel := Ribbon1.ActiveCategory.Panels.Item(0);
//Groups for radio buttons
RGroup1 := New RibbonGroup.Create;
RGroup2 := New RibbonGroup.Create;
RPanel.Elements.Add(RGroup1);
RPanel.Elements.Add(RGroup2);
//Radio buttons
RRadioBtn1 := New RibbonRadioButton.Create;
RRadioBtn2 := New RibbonRadioButton.Create;
RRadioBtn3 := New RibbonRadioButton.Create;
RRadioBtn4 := New RibbonRadioButton.Create;
RGroup1.Elements.Add(RRadioBtn1);
RGroup1.Elements.Add(RRadioBtn2);
RGroup2.Elements.Add(RRadioBtn3);
RGroup2.Elements.Add(RRadioBtn4);
//Radio button parameters
RRadioBtn1.Text := "Variant 1";
RRadioBtn1.Checked := True;
RRadioBtn2.Text := "Variant 2";
RRadioBtn3.Text := "Factor 1";
RRadioBtn3.GroupIndex := 1;
RRadioBtn3.Checked := True;
RRadioBtn4.Text := "Factor 2";
RRadioBtn4.GroupIndex := 1;
End Sub Button1OnClick;
Clicking the button creates two radio button groups on the ribbon panel. Some text is set for each of the radio buttons, the first radio button in each group is selected.
See also: