INavigationBar.Pads

Syntax

Pads: INavigationBarPads;

Description

The Pads property returns the collection of tabs of the navigation bar.

Example

Executing the example requires a form with the NavigationBar component on it named NavigationBar1 and the ImageList component named ImageList1. Minimum two images are loaded to the ImageList1 component. Repository also contains forms with the following identifiers: F_BASE_PARAMS, F_ADDITION_PARAMS, F_TABLE and F_DIAGRAM. These forms contain different groups of settings and will be connected to the tab bars of the NavigationBar1 component.

Class TESTForm: Form
    NavigationBar1: NavigationBar;
    ImageList1: ImageList;

    Sub TESTFormOnCreate(Sender: Object; Args: IEventArgs);
    Var
        Pads: INavigationBarPads;
        Pad: INavigationBarPad;
    Begin
        Pads := NavigationBar1.Pads;
        NavigationBar1.BeginUpdate;
        //First tab
        Pad := New NavigationBarPad.Create;
        Pads.Add(Pad);
        Pad.Header.Title := Main;
        Pad.Content.MetabaseObject := "F_BASE_PARAMS";
        //Second tab
        Pad := New NavigationBarPad.Create;
        Pads.Add(Pad);
        Pad.Header.Title := Additional;
        Pad.Header.Content := NavigationBarHeaderContent.CheckBox;
        Pad.Header.Value := True;
        Pad.Content.MetabaseObject := "F_ADDITION_PARAMS";
        //Third tab
        Pad := New NavigationBarPad.Create;
        Pads.Add(Pad);
        Pad.Header.Title := Table;
        Pad.Header.Content := NavigationBarHeaderContent.Custom;
        Pad.Header.CustomContent := CreateButton(0);
        Pad.Content.MetabaseObject := "F_TABLE";
        //Fourth tab
        Pad := New NavigationBarPad.Create;
        Pads.Add(Pad);
        Pad.Header.Title := Chart;
        Pad.Header.Content := NavigationBarHeaderContent.Custom;
        Pad.Header.CustomContent := CreateButton(1);
        Pad.Content.MetabaseObject := "F_DIAGRAM";
        //Active tab
        NavigationBar1.ActivePad := Pads.Item(0);
        //Component border
        NavigationBar1.Border := ControlBorderType.Left Or ControlBorderType.Right;
        NavigationBar1.EndUpdate;
    End Sub TESTFormOnCreate;

    Function CreateButton(Index: Integer): IImageButton;
    Var
        Img: IImageButton;
    Begin
        Img := New ImageButton.Create;
        Img.Parent := NavigationBar1;
        Img.Enabled := False;
        Img.DrawFocus := False;
        Img.Images := ImageList1;
        Img.NormalLook.ImageIndex := Index;
        Img.Text := "";
        Img.Height := 20;
        Img.Width := 20;
        Return Img;
    End Function CreateButton;

End Class TESTForm;

The NavigationBar1 tab collection is configured at the form launch. Four tabs are created in the collection and for each of them the header and the panel are configured. The ImageButton components are displayed in the titles for the last two tabs. First tab is active. Also the boards are changed for the component.

An approximate form available for the form after configuration of the NavigationBar1 component:

See also:

INavigationBar