Add(Element: IRibbonPanel);
Element. The panel that must be added to the collection of tab panels.
The Add method adds the specified panel to the collection of tab panels.
If the panel is created dynamically, it must be added to the ribbon after creation. It must be included to 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.
Executing the example requires a form, a button named Button1 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;
Clicking the button creates a new panel in the active tab area. The Start button is available on the button, two other buttons divided with a separator are also added on this panel.
See also: