IRibbonPanels.Add

Fore Syntax

Add(Element: IRibbonPanel);

Fore.NET Syntax

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

Parameters

Element. The panel that should be added to the collection of tab panels.

Description

The Add method added the specified panel to the collection of tab panels.

Comments

If the panel is created dynamically, it should be added to the ribbon after creation. It should be included in the collection using the Add or Insert method. The Add method adds a panel to the end of the collection. Parameters of the panel can be changed after addition.

Example

Executing the example requires a form, a button named Button1 positioned on it and the Ribbon component named Ribbon1. A tab is created on the ribbon of the Ribbon1 component. A source of images is specified in the property of the Images ribbon.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    RCategory: IRibbonCategory;
    RPanel: IRibbonPanel;
    LaunchButton, RButton1, RButton2: IRibbonButton;
    RSeparator: IBaseRibbonElement;
    ChildElements: IRibbonElementsCollection;
Begin
    RCategory := Ribbon1.ActiveCategory;
    RPanel := New RibbonPanel.Create;
    RCategory.Panels.Add(RPanel);
    RPanel.CenterColumnsVertically := True;
    RPanel.ImageIndex := 0;
    RPanel.Keys := "P";
    RPanel.LaunchButtonEnabled := True;
    LaunchButton := RPanel.LaunchButton;
    LaunchButton.Hint := "Configure panel contents";
    LaunchButton.Name := "PanelParameters";
    ChildElements := RPanel.Elements;
    RButton1 := New RibbonButton.Create;
    RSeparator := New RibbonSeparator.Create;
    RButton2 := New RibbonButton.Create;
    ChildElements.Add(RButton1);
    ChildElements.Add(RSeparator);
    ChildElements.Add(RButton2);
    RButton1.Text := "Open";
    RButton2.Text := "Close";
End Sub Button1OnClick;

On clicking the button a new panel is created in the active tab area. The Start button is available on the button, also two other buttons divided with a separator are added on this panel.

See also:

IRibbonPanels