RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TToolButton.MenuItem Property

Specifies the menu item corresponding to the button.

Pascal
property MenuItem: TMenuItem;
C++
__property TMenuItem MenuItem;

Use MenuItem to get or set the menu item corresponding to the button.

Note: To use the tool button as a menu item, the Style property must be tbsDropDown. If you are using multiple drop-down tool buttons, set the Grouped property to true.
 

C++ Examples: 

 

/*
To create a toolbar that corresponds to an existing menu:

1   Drop a ToolBar on the form and add a ToolButton for each
  top-level menu item you wish to create.
2   Set the MenuItem property of each ToolButton to correspond
  to the top level menu items.
3   Set the Grouped property of each ToolButton to true.
4   Clear the Menu property of the Form (if it is assigned)
5   Set the Visible property on the ToolBar and ToolButtons to
  true.
6   Set the ShowCaptions property on the ToolBar to true.
7   Set the MenuItem | Visible property of each ToolButton to
  true.
*/

 

Delphi Examples: 

{
To create a toolbar that corresponds to an existing menu:

1   Drop a ToolBar on the form and add a ToolButton for each top-level menu item you wish to create.
2   Set the MenuItem property of each ToolButton to correspond to the top level menu items.
3   Set the Grouped property of each ToolButton to true.
4   Clear the Menu property of the Form (if it is assigned)
5   Set the Visible property on the ToolBar and ToolButtons to true.
6   Set the ShowCaptions property on the ToolBar to true.
7   Set the MenuItem | Visible property of each ToolButton to true.
}

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!