TTMSFNCToolBarPopup.Activate Method
Builds the toolbar from the current buttons and shows the popup at its configured placement.
API unit family: TMSFNCToolBarPopup
Declaring type: TTMSFNCToolBarPopup
Inherited from: TTMSFNCCustomToolBarPopup
Syntax
procedure Activate; virtual;
virtual void __fastcall Activate();
Usage examples
Show a floating popup toolbar of buttons
Fills a TTMSFNCToolBarPopup with buttons, anchors it to a control, handles clicks, and activates it.
procedure TForm1.ShowActionsPopup;
var
btn: TTMSFNCToolBarPopupButton;
begin
TMSFNCToolBarPopup1.Buttons.Clear;
btn := TMSFNCToolBarPopup1.Buttons.Add;
btn.Text := 'Cut';
btn := TMSFNCToolBarPopup1.Buttons.Add;
btn.Text := 'Copy';
btn := TMSFNCToolBarPopup1.Buttons.Add;
btn.Text := 'Paste';
// Anchor the popup near a control, then show it.
TMSFNCToolBarPopup1.PlacementControl := ActionsButton;
TMSFNCToolBarPopup1.Placement := ppBottom;
TMSFNCToolBarPopup1.OnButtonClick := PopupButtonClick;
TMSFNCToolBarPopup1.Activate;
end;
procedure TForm1.PopupButtonClick(Sender: TObject; AButton: TTMSFNCToolBarPopupButton);
begin
// AButton is the clicked item from the Buttons collection.
ShowMessage(AButton.Text + ' clicked');
end;
void __fastcall TForm1::ShowActionsPopup()
{
TMSFNCToolBarPopup1->Buttons->Clear();
Fmx::Tmsfnctoolbarpopup::TTMSFNCToolBarPopupButton *btn = static_cast<Fmx::Tmsfnctoolbarpopup::TTMSFNCToolBarPopupButton *>(TMSFNCToolBarPopup1->Buttons->Add());
btn->Text = "Cut";
btn = static_cast<Fmx::Tmsfnctoolbarpopup::TTMSFNCToolBarPopupButton *>(TMSFNCToolBarPopup1->Buttons->Add());
btn->Text = "Copy";
btn = static_cast<Fmx::Tmsfnctoolbarpopup::TTMSFNCToolBarPopupButton *>(TMSFNCToolBarPopup1->Buttons->Add());
btn->Text = "Paste";
// Anchor the popup near a control, then show it.
TMSFNCToolBarPopup1->PlacementControl = ActionsButton;
TMSFNCToolBarPopup1->Placement = ppBottom;
TMSFNCToolBarPopup1->OnButtonClick = PopupButtonClick;
auto popup = TMSFNCToolBarPopup1;
popup->Activate();
}
void __fastcall TForm1::PopupButtonClick(TObject *Sender, Fmx::Tmsfnctoolbarpopup::TTMSFNCToolBarPopupButton *AButton)
{
// AButton is the clicked item from the Buttons collection.
ShowMessage(AButton->Text + " clicked");
}