Using Menus in a FireMonkey Application
Go Up to FireMonkey Application Design
FireMonkey supports both lightweight styled menus displayed on the form, and native menus.
Traditional desktop-OS drop-down menus are hosted in a TMenuBar, a fully styled control. It acts as the root of a tree of TMenuItem objects. The first generation of children are visible in the menu bar. Second generation items are displayed under their parent when the parent item is clicked. Later generations are displayed as sub-menus to the right.
Menu items have label Text and an optional Bitmap image. Items can be checked through the IsChecked trigger property. Setting AutoCheck to True will automatically toggle IsChecked every time the item is clicked. A group of menu items can be designated so that only one item at most is checked, by setting RadioItem to True on each item, and GroupIndex to the same arbitrary value.
To create a menu separator item, set the Text to a single hyphen-minus character (Unicode code point U+002D, ASCII 45).
Creating Menus for OS X and Windows
Use the correct control for your target system (OS X vs. Windows).
- For Windows applications, use the TMenuBar control:
- The main menu is placed in the client area of the form (standard for Windows).
- The menu items are not on the Mac OS X menu bar (nonstandard for OS X).
- For Mac OS X applications, use the TMainMenu component:
- The main menu is placed in the non-client area of the Windows form (nonstandard for Windows).
- Menu items are placed on the Mac OS X menu bar (standard for OS X).