Skip to main content
Table of Contents

TTMSFNCToolBar.AddCustomControlClass Method

Creates a new control of the specified class, adds it to the toolbar, and returns the new instance.

API unit family: TMSFNCToolBar Declaring type: TTMSFNCToolBar Inherited from: TTMSFNCCustomToolBar

Syntax

FMX.TMSFNCToolBar.hppPascalC++
function AddCustomControlClass(AControlClass: TControlClass; AIndex: Integer = -1): TControl; virtual;
virtual Fmx::Controls::TControl* __fastcall AddCustomControlClass(TControlClass AControlClass, int AIndex = 0xffffffff);

Parameters

Name Description
AControlClass The class of control to create.
AIndex Zero-based insertion index, or -1 to append.

Returns

The newly created and inserted control.

Usage examples

Add a custom edit control to the toolbar

Creates a framework edit control inside the toolbar and initializes its text.

Add a custom edit control to the toolbarPascalC++
procedure TForm1.AddSearchEditToToolbar;
var
  Edit: TEdit;
begin
  Edit := TMSFNCToolBar1.AddCustomControlClass(TEdit) as TEdit;
  Edit.Width := 180;
  Edit.Text := 'Search';
end;
void __fastcall TForm1::AddSearchEditToToolbar()
{
  TEdit *Edit = static_cast<TEdit *>(TMSFNCToolBar1->AddCustomControlClass(__classid(TEdit)));
  Edit->Width = 180;
  Edit->Text = "Search";
}

Read the related guide