IRibbonElementsCollection.Add

Fore Syntax

Add(Element: IBaseRibbonElement);

Fore.NET Syntax

Add(Element: Prognoz.Platform.Interop.Forms.IBaseRibbonElement);

Parameters

Element. The control element that should be included in the collection.

Description

The Add method adds the specified control element to the collection.

Comments

If the control element is created dynamically, it should be added to the ribbon after creation. To do this, it should be included into a collection using the Add or Insert method. The Add method adds an element to the end of the collection. Parameters of the control elements 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 control element is moved from one collection to another, it should 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:

IRibbonElementsCollection