Insert(Index: Integer; Value: IBaseRibbonElement);
Index. Position, to which it is inserted.
Value. Control that must be inserted to the Index position.
The Insert method inserts the specified control to the specified position in the collection.
If the control is created dynamically, it must be added to the ribbon after creation. It must be included to any collection using the Add or Insert method. Then parameters of the controls can be changed.
RButton: RibbonButton;
//...
Var
RPanel: IRibbonPanel;
Elements: IRibbonElementsCollection;
Begin
//...
RPanel := Ribbon1.ActiveCategory.Panels.Item(0);
Elements := RPanel.Elements;
RButton := New RibbonButton.Create;
Elements.Insert(Elements.Count, RButton);
RButton.Text := ...
//...
When the control is moved within one collection, it must be removed beforehand from the collection.
Var
RPanel: IRibbonPanel;
Elements: IRibbonElementsCollection;
Element: IBaseRibbonElement;
Begin
RPanel := Ribbon1.ActiveCategory.Panels.Item(0);
Elements := RPanel.Elements;
Element := Elements.Item(0);
Elements.Remove(Element);
Elements.Insert(Elements.Count, Element);
See also: