Skip to main content
Table of Contents

TTMSFNCToolBar.OptionsMenu Property

Options that control the appearance and behavior of the overflow (options) menu button shown when buttons overflow.

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

Syntax

FMX.TMSFNCToolBar.hppPascalC++
property OptionsMenu: TTMSFNCToolBarOptionsMenu;
__property TTMSFNCToolBarOptionsMenu* OptionsMenu = {read=FOptionsMenu, write=SetOptionsMenu};

Usage examples

Customize the toolbar options (overflow) menu

Configures the options menu appearance and handles customize, can-show, and item-click events.

Customize the toolbar options (overflow) menuPascalC++
procedure TForm1.ConfigureOptionsMenu;
begin
  // Always show the overflow button, with bitmaps and text on each item.
  TMSFNCToolBar1.OptionsMenu.ShowButton := True;
  TMSFNCToolBar1.OptionsMenu.ShowItemBitmap := True;
  TMSFNCToolBar1.OptionsMenu.ShowItemText := True;

  TMSFNCToolBar1.OnOptionsMenuCustomize := OptionsMenuCustomize;
  TMSFNCToolBar1.OnOptionsMenuItemCanShow := OptionsMenuItemCanShow;
  TMSFNCToolBar1.OnOptionsMenuItemClick := OptionsMenuItemClick;
end;

procedure TForm1.OptionsMenuCustomize(Sender: TObject; APopupMenu: TPopupMenu);
begin
  { Add your own items to APopupMenu before the overflow menu is shown. }
end;

procedure TForm1.OptionsMenuItemCanShow(Sender: TObject; AControl: TControl;
  var ACanShowItem: Boolean);
begin
  // Keep a specific command out of the overflow menu.
  ACanShowItem := AControl <> DebugButton;
end;

procedure TForm1.OptionsMenuItemClick(Sender: TObject; AControl: TControl;
  AMenuItem: TMenuItem; var AExecuteDefaultAction: Boolean);
begin
  // AControl is the toolbar element the menu item represents. Set
  // AExecuteDefaultAction := False to suppress the element's own click.
end;
void __fastcall TForm1::ConfigureOptionsMenu()
{
  // Always show the overflow button, with bitmaps and text on each item.
  TMSFNCToolBar1->OptionsMenu->ShowButton = true;
  TMSFNCToolBar1->OptionsMenu->ShowItemBitmap = true;
  TMSFNCToolBar1->OptionsMenu->ShowItemText = true;

  TMSFNCToolBar1->OnOptionsMenuCustomize = OptionsMenuCustomize;
  TMSFNCToolBar1->OnOptionsMenuItemCanShow = OptionsMenuItemCanShow;
  TMSFNCToolBar1->OnOptionsMenuItemClick = OptionsMenuItemClick;
}

void __fastcall TForm1::OptionsMenuCustomize(TObject *Sender, TPopupMenu *APopupMenu)
{
  // Add your own items to APopupMenu before the overflow menu is shown.
}

void __fastcall TForm1::OptionsMenuItemCanShow(TObject *Sender, TControl *AControl,
  bool &ACanShowItem)
{
  // Keep a specific command out of the overflow menu.
  ACanShowItem = AControl != DebugButton;
}

void __fastcall TForm1::OptionsMenuItemClick(TObject *Sender, TControl *AControl,
  TMenuItem *AMenuItem, bool &AExecuteDefaultAction)
{
  // AControl is the toolbar element the menu item represents. Set
  // AExecuteDefaultAction = false to suppress the element's own click.
}

Read the related guide