TTMSFNCDockPanel.AddToolBar Method
Creates a new TTMSFNCToolBar, adds it to this dock panel, and returns the new toolbar.
API unit family: TMSFNCToolBar
Declaring type: TTMSFNCDockPanel
Inherited from: TTMSFNCCustomDockPanel
Syntax
function AddToolBar(AIndex: Integer = -1): TTMSFNCToolBar;
TTMSFNCToolBar* __fastcall AddToolBar(int AIndex = 0xffffffff);
Parameters
| Name | Description |
|---|---|
AIndex |
Zero-based insertion index, or -1 to append. |
Returns
The newly created toolbar.
Usage examples
Stack multiple toolbars on a dock panel
Adds a file toolbar and a formatting toolbar to a TTMSFNCDockPanel.
procedure TForm1.BuildDockedToolBars;
var
fileBar, formatBar: TTMSFNCToolBar;
begin
TMSFNCDockPanel1.BeginUpdate;
try
TMSFNCDockPanel1.AutoSize := True;
// Each AddToolBar returns a toolbar the dock panel arranges into a row.
fileBar := TMSFNCDockPanel1.AddToolBar;
fileBar.AddButton(-1, -1, '', '', 'New');
fileBar.AddButton(-1, -1, '', '', 'Open');
fileBar.AddButton(-1, -1, '', '', 'Save');
formatBar := TMSFNCDockPanel1.AddToolBar;
formatBar.AddFontNamePicker;
formatBar.AddFontSizePicker;
formatBar.AddColorPicker;
finally
TMSFNCDockPanel1.EndUpdate;
end;
end;
void __fastcall TForm1::BuildDockedToolBars()
{
TTMSFNCToolBar *fileBar, *formatBar;
TMSFNCDockPanel1->BeginUpdate();
try
{
TMSFNCDockPanel1->AutoSize = true;
// Each AddToolBar returns a toolbar the dock panel arranges into a row.
fileBar = TMSFNCDockPanel1->AddToolBar();
fileBar->AddButton(-1, -1, "", "", "New");
fileBar->AddButton(-1, -1, "", "", "Open");
fileBar->AddButton(-1, -1, "", "", "Save");
formatBar = TMSFNCDockPanel1->AddToolBar();
formatBar->AddFontNamePicker();
formatBar->AddFontSizePicker();
formatBar->AddColorPicker();
}
__finally
{
TMSFNCDockPanel1->EndUpdate();
}
}