Insert(Index: Integer; Value: IBaseRibbonElement);
Insert(Index: Integer; Value: Prognoz.Platform.Interop.Forms.IBaseRibbonElement);
Index. It is a position in which it is inserted.
Value. It is a control element that should be inserted in the Index position.
The Insert method inserts the specified control element in the specified position in the collection.
If the control element is created dynamically, it should be added to the ribbon after creation. It should be included in any collection using the Add or Insert method. Then parameters of the control elements 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 element is moved within one collection, it should 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: