[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Menus' (#lcl)

# TMenu

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TMenu - a menu appearing in a form. Base class for TMainMenu or TPopupMenu.

## Declaration

Source position: menus.pp line 362

`type TMenu = class(TLCLComponent)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`procedure BidiModeChanged; virtual;` |  | Performs actions needed when the value in BiDiMode has been changed.
`procedure CreateHandle; virtual;` |  | Creates the Handle for the menu.
`procedure DoChange(); virtual;` |  | Performs actions needed when the specified menu item has been changed.
`function GetHandle; virtual;` |  | Gets the value for the Handle property.
`procedure GetChildren(); override;` |  | Calls the specified process for the Items in the menu control.
`procedure MenuChanged(); virtual;` |  | Implements the OnChange event handler assigned to menu items in the menu.
`procedure AssignTo(); override;` |  | Copies property values from the class instance to the specified persistent object.
`procedure Notification(); override;` |  | Handles a notification when a component is added to or removed from the control.
`procedure ParentBidiModeChanged();` |  | Performs action when ParentBiDiMode has been changed.
`procedure SetChildOrder(); override;` |  | Sets the order for the menu item specified in Child.
`procedure UpdateItems;` |  | UpdateItems has an empty implementation in the current LCL version.
`property OnChange: TMenuChangeEvent; [rw]` |  | Event handler signalled when a menu item in Items has been changed.
`public`
`FCompStyle: LongInt;` |  | Stores component style flags.
`constructor Create(); override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`procedure DestroyHandle; virtual;` |  | Frees the Handles for the items on the menu.
`function FindItem();` |  | Gets the menu item with the specified value in a given property.
`function GetHelpContext();` |  | Gets the numeric help context for the menu item with the specified handle or command.
`function IsShortcut();` |  | Indicates if the specified control message contains a shortcut (accelerator) key used in the menu.
`function HandleAllocated;` |  | Returns True if a Handle has been allocated for the menu.
`function IsRightToLeft; virtual;` |  | Indicates if Right-to-Left text display is used in the menu.
`function UseRightToLeftAlignment; virtual;` |  | UseRightToLeftAlignment - returns True if Right-to-Left alignment is being used.
`function UseRightToLeftReading; virtual;` |  | Indicates if right-to-left reading is used for the menu.
`procedure HandleNeeded;` |  | Ensures that a Handle has been allocated for the menu.
`function DispatchCommand();` |  | Executes the menu item with the specified numeric Command value.
`property Handle: HMENU; [r]` |  | Handle for the menu allocated in the widgetset class.
`property Parent: TComponent; [rw]` |  | Parent component for the menu.
`property ShortcutHandled: Boolean; [rw]` |  | Indicates whether the shortcut key for a menu item is used in the menu.
`published`
`property AutoLineReduction: TMenuAutoFlag; [rw]` |  | Indicates the method used to perform line reduction for the menu and optionally for its child Items.
`property BidiMode: TBidiMode; [rws]` |  | Indicates whether Bi-directional text mode is implemented allowing use with languages like Arabic or Hebrew.
`property ParentBidiMode: Boolean; [rw]` |  | The BiDiMode value for the parent component.
`property Items: TMenuItem; [r]` |  | Contains the menu items displayed on the menu.
`property Images: TCustomImageList; [rw]` |  | The image list with bitmaps used as glyphs for the menu items.
`property ImagesWidth: Integer; [rw]` |  | Width for the bitmaps in the Images property.
`property OwnerDraw: Boolean; [rw]` |  | Indicates if the menu items are drawn using the OnDrawItem event handler.
`property OnDrawItem: TMenuDrawItemEvent; [rw]` |  | Event handler signalled to draw a menu item on the menu.
`property OnMeasureItem: TMenuMeasureItemEvent; [rw]` |  | Event handler signalled to get the width and height for a menu item on the menu.
`end;`

## Inheritance

`TMenu` |  | TMenu - a menu appearing in a form. Base class for TMainMenu or TPopupMenu.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TMenu is the base class for all menus.

The class definition contains very few public or published properties or methods accessible to the application programmer, but contains the entry Items which points to the Menu Items that appear in the menu displays.

## See also

How To Use Menus |  | HowToUseMenus - hints for creating Menus for your Forms.
TMainMenu |  | TMainMenu - the Main Menu that appears at the top of most windows.
TPopupMenu |  | Implements a menu panel that pops up on the screen when the right mouse button is clicked.
TMenuItem |  | Represents a menu item displayed in a menu.