Add(Element: IBaseRibbonElement);
Element. The control that must be included to the collection.
The Add method adds the specified control to the collection.
If the control is created dynamically, it must be added to the ribbon after creation. To do this, it must be included to the collection using the Add or Insert method. The Add method adds an element to the end of the collection. Parameters of the controls can be changed after addition.
RButton: RibbonButton;
//...
Var
RPanel: IRibbonPanel;
Begin
//...
RPanel := Ribbon1.ActiveCategory.Panels.Item(0);
RButton := New RibbonButton.Create;
RPanel.Elements.Add(RButton);
RButton.Text := ...
//...
When the control is moved from one collection to another, it must be removed beforehand from the source collection.
RButton: RibbonButton;
//...
Sub Sample;
Var
RPanel1, RPanel2: IRibbonPanel;
Begin
//...
RPanel1 := Ribbon1.ActiveCategory.Panels.Item(0);
RPanel2 := Ribbon1.ActiveCategory.Panels.Item(1);
//...
RPanel1.Elements.Remove(RButton);
RPanel2.Elements.Add(RButton);
//...
See also: