IRibbonContexts.Add

Syntax

Add(Element: IRibbonContext);

Parameters

Element. A context tab that must be added to the collection.

Description

The Add method adds the specified context tab to the collection.

Comments

If the context tab is created dynamically, it must be added to the ribbon after creation. To do this, include the tab to the collection by means of the Add or IRibbonContexts.Insert method. The Add method adds a tab to the end of the collection. Parameters of the context tab can be changed after addition.

Example

Executing the example requires a form, a button with the Button1 name on it and the Ribbon component with the Ribbon1 name.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    RContext: IRibbonContext;
    ChildCategory: IRibbonCategory;
    ChildPanel: IRibbonPanel;
Begin
    RContext := New RibbonContext.Create;
    Ribbon1.Contexts.Add(RContext);
    RContext.Text := "Table";
    RContext.Visible := True;
    ChildCategory := RContext.Categories.Item(0);
    ChildCategory.Text := "Data";
    ChildPanel := New RibbonPanel.Create;
    ChildCategory.Panels.Add(ChildPanel);
    ChildPanel.Text := "Clipboard";
End Sub Button1OnClick;

Clicking the button creates a context tab on the ribbon. A panel will be created in the area of the child tab that is automatically created for the context tab.

See also:

IRibbonContexts