Adding a Pop-up Menu to a FireMonkey Control

From Appmethod Topics
Jump to: navigation, search

Go Up to Using Menus in a FireMonkey Application


You can add a pop-up menu to a FireMonkey control by setting the PopupMenu property in the Object Inspector. The pop-up menu appears when you right-click the control at run time.

To add a pop-up menu to a FireMonkey control:

  1. Open a FireMonkey Desktop Application.
  2. From the Tool Palette, add to the form a TPopupMenu.
    • Double click the pop-up menu to add items to it. If you leave the popup menu empty, nothing happens at run time when you right-click the associated control.
  3. From the Tool Palette, add to the form a FireMonkey control, such as FMX.StdCtrls.TButton or FMX.Colors.TColorQuad.
    • Note that the control you are using must support the PopupMenu property.
  4. In the Object Inspector, set the control's PopupMenu property to the existing pop-up menu component. (You can select the name of the pop-up menu component after you click the down-arrow ProjectOptionsDownArrow2.jpg for the PopupMenu property.)
  5. Build and run the application.
  6. Right-click the control to see the pop-up menu displayed on the mouse position.

See Also