Sign in Join
FPDoc Onlineexperiment

Menus unit

Implements menus used in forms created with the Lazarus IDE.

menus.pp contains classes, types, and routines used to implement menus used on TForm instances in the Lazarus Component Library ( LCL).

Authors: Shane Miller and Marc Weustink

The following components are added to the Lazarus IDE component palette:

Standard Tab

  • TMainMenu
  • TPopupMenu

Registered but not displayed:

  • TMenuItem

Classes and records

EMenuErrorclassException raised when an error occurs while accessing a menu item.
TMainMenuclassTMainMenu - the Main Menu that appears at the top of most windows.
TMenuclassTMenu - a menu appearing in a form. Base class for TMainMenu or TPopupMenu.
TMenuActionLinkclassTMenuActionLink: defines the link between a selected menu item and its corresponding action.
TMenuItemclassRepresents a menu item displayed in a menu.
TMenuItemEnumeratorclassImplements an enumerator for child menu items in the specified TMenuItem instance.
TMenuItemsclassImplements a list used to store TMenuItem instances with a given parent.
TMergedMenuItemsclassImplements a container for menu items merged into a parent menu or menu item.
TPopupMenuclassImplements a menu panel that pops up on the screen when the right mouse button is clicked.

Procedures and functions

NewItemfunctionCreates and configures a new menu item instance.
NewLinefunctionCreates and configures a menu item displayed as a separator line.
NewMenufunctionCreates and configures a new menu instance with the specified menu items.
NewPopupMenufunctionCreates and configures a new pop-up menu with the specified menu items.
NewSubMenufunctionCreates and configures a new sub-menu with the specified child menu items.
RegisterprocedureRegisters components for use in the Lazarus IDE.
ShortCutfunctionConverts a virtual key code and modifier to a shortcut value.
ShortCutToKeyprocedureConverts a shortcut value to a virtual key code and modifier.
StripHotkeyfunctionRemoves the hot key (accelerator) prefix from the specified text.

Types

TFindItemKindenumerationTFindItemKind - enumerated type for kind of item in search operation: a command, a handle or a shortcut.
TGlyphShowModeenumerationTGlyphShowMode indicates if the glyph image for a menu or button should be shown, and in which circumstances.
TMenuActionLinkClasstypeClass type used to create new instances of TMenuActionLink.
TMenuAutoFlagtypeRange type which represents the valid TMenuItemAutoFlag values for TMenu instances.
TMenuChangeEventprocedure typeSpecifies an event handler signalled when a menu or menu item is changed.
TMenuDrawItemEventprocedure typeSpecifies an event handler signalled to draw a menu item on the given canvas.
TMenuItemAutoFlagenumerationRepresents line reduction modes available for menu items.
TMenuItemClasstypeClass type used to create new TMenuItem instances.
TMenuItemHandlerTypeenumerationEnumerated type which represents the available menu item handler types.
TMenuMeasureItemEventprocedure typeSpecifies an event handler signalled to get the width and height for a menu item.
TPopupAlignmentenumerationAn enumerated type to describe the position of pop-up menu relative to the pop-up coordinates.
TTrackButtonenumerationTTrackButton - enumerated type described which mouse buttons can be used to activate (click) menu items.

Constants

cDialogSuffixconstantNot used in the current LCL implementation.
cHotkeyPrefixconstantPrefix used in a menu item caption to identify a hot key (accelerator).
cLineCaptionconstantCaption used for a menu item displayed as a separator line.
ValidMenuHotkeysconstantContains characters that can be used as accelerator keys in menus and menu items.

Variables

ActivePopupMenuvariableUnit global variable which represents the active pop-up menu.
OnDesignerMenuItemClickvariableUnit global variable with the event handler signalled when a menu item is clicked at design-time.
OnMenuPopupHandlervariableUnit global variable with the event handler signalled when a pop-up menu is displayed.

Topics

HowToUseMenustopicHowToUseMenus - hints for creating Menus for your Forms.

Uses

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.