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
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.
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";
}