Menus to be used in Forms created with the Lazarus IDE
TMenu
- a menu appearing in a form. Base class for TMainMenu or TPopupMenu

TMenu : 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

EMenuError

- Exception handler for error in Menu access
TMenuChangeEvent
- generic event handling procedure for a change in a menu
TMenuActionLink
: defines the link between a selected menu item and its corresponding action

TMenuActionLink defines the link between a selected menu item and its corresponding action. Properties are protected and not readily accessible by application programmers.

FClient
- local variable holding the MenuItem to which this action link applies
IsAutoCheckLinked
- returns True if the client's AutoCheck property is linked
IsOnExecuteLinked
always returns true in TBasicActionLink. Descendent classes can override this method to provide a different result.
SetAutoCheck
- specifies whether AutoCheck is to apply
SetCaption
- specifies the caption for the linked MenuItem
SetChecked
- specifies whether the Item is checked
SetEnabled
- specifies whether the action is enabled
SetHelpContext
- specifies the Help context
SetHint
- specifies the Hint string
SetImageIndex
- specifies the index of the associated image
SetShortCut
- specifies the ShortCut for the Item and action
SetVisible
- specifies if item is to be visible
TMenuActionLinkClass
- class of TMenuActionLink
TMenuItem

- The base structure of each item in a Menu.

TMenuItem

- The base structure of each item in a Menu.

This Component does the hard work of processing the Items found in the various types of menus. It defines a lot of the properties and methods used in the various sorts of menu, including TMainMenu, TMenu and TPopUpMenu

ActionChange
- changes the action associated with this menu item to a new action
ActionChange
- changes the action associated with this menu item to a new action, provided Sender is of type TCustomAction
GetAction
- find the action associated with this menu item
GetActionLinkClass
- find out what class of action link is associated with this menu item
GetHandle
- get the operating system handle for the menu to which this item belongs
DoClicked
- process the system message signifying that a click has ocurred over this menu item
CreateHandle
- create an operating system handle for this item
DestroyHandle
- destroy the operating system handle and free space on the heap
InitiateActions
- start the initiation phase of the actions associated with the menu item
MenuChanged
- rebuild it if True
SetAction
- setup a new action associated with the menu item
SetGroupIndex
- write the index value for group to this item belongs (may write a new group)
SetImageIndex
- gives the item an index value for its associated image
SetShortCut
- sets up the keyboard shortcut for this item
SetVisible
- sets up whether the item is to be visible
UpdateImages
- update all images associated with the item
ImageListChange
- change the image list if commanded by the Sender
ActionLink
- a link to the action for this menu item
FCompStyle
- local variable holding value of CompStyle
Create
- constructor for TMenuItem: calls inherited Create then intialises a large number of local variables
TComponent.Create
Destroy
- destructor for TMenuItem: releases bitmaps, handles, imagelists, actionlinks and parent controls, then calls inherited Destroy and
TComponent.Destroy
GetImageList
- Get the list of images for this menu, from which the image for the current item will be selected
GetParentMenu
- returns the parent menu to which this menu item belongs
HandleAllocated
- has an operating system handle been allocated?
HasIcon
- is there an icon associated with this menu item?
InitiateAction
- start th einitiation phase of an action associated with the menu item
IndexOf
- the index value of this item
IndexOfCaption
- the index value of the caption for this item
VisibleIndexOf
- the index of this item within the list of visible items
IsCheckItem
- is there a check-box associated with this item?
Add
- an item to the menu
AddSeparator
(a line) to the menu
Click
- simulate the OnClick event
Delete
this item from the menu
HandleNeeded
- tell the operating system that a handle is needed for this item
Insert
a new item at the location marked by Index
RecreateHandle
from the operating system
Remove
this item from the menu
IsInMenuBar
- this item appears in the main menu bar
Clear
- removes the contents of the item, but leaves the item in place
HasBitmap
- determines whether there is a Bitmap for this item
GetIconSize
- finds the size of the icon for this item
Count
- number of items
Handle
- the operating system handle for this item
Items
- the indexed list of menu items to which this item belongs
MenuIndex
- the index value of the menu to which this item belongs
The Parent MenuItem from which this item is derived
Command
- the entry from the Command list to which this item refers
MenuVisibleIndex
- the index value of the visible menu
Action

- the default action associated with this Menu Item
AutoCheck

: Whether a check mark is automatically added when the item is selected
Caption

: The text that appears on the Menu Bar at run-time
Checked

: whether a check mark appears on the Menu Bar
Default

: is this option the default selection? If so, it usually appears in Bold and is selected by hitting ENTER
Enabled

: can this option be selected? If Not Enabled, usually 'greyed-out'
BitMap

: an optional picture beside the MenuItem Caption
GroupIndex

: the sequence number in a group of mutually exclusive RadioItem choices
HelpContext

- an index to the context-sensitive help string to be used
Hint

: a pop-up help message that appears when the mouse hovers over an item.
ImageIndex

- number in a list of images for use in illustrating menu items
RadioItem

: whether the item is part of a group of mutually exclusive choices.
RightJustify

: the position of the Caption in the Menu Panel. Default (False) is Left Justify
ShortCut

- the quick key sequence to be used in selecting this menu item

ShortCut

- the quick key sequence to be used in selecting this menu item

If you select this property in the Object Inspector, a list-box will appear with choices for various key-combinations to be used. The chosen key-sequence will be displayed, at run-time, on the menu drop-down next to the caption for the menu item.

ShowAlwaysCheckable
- if True, Item is always shown as checkable
SubMenuImages

- will images be shown for sub-menu items as well as the main item?
Visible

- can the item be seen?
OnClick

- event handler for selection of this menu item
TFindItemKind
- enumerated type for kind of item in search operation: a command, a handle or a shortcut
TMenu

: The base class for all menus

TMenu

: 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

CreateHandle
- method for creating handle
DoChange
- perform the OnChange event, completely rebuilding the Source menuitem if Rebuild is true
GetHandle
- returns the handle for this Menu
MenuChanged
- method to signal that a menu has been changed
OnChange
- event handler for a change to the menu
UpdateItems
- implement all pending changes to Items
FCompStyle
- local variable holding value of CompStyle
Create
- constructor for TMenu: creates menuitems and links, sets some defaults then calls inherited Create
TComponent.Create
Destroy
- destructor for TMenu: frees items and links, then calls inherited Destroy
TComponent.Destroy
DestroyHandle
- method for destroying handle
FindItem
- returns the menuitem corresponding to the supplied value or kind
HandleAllocated
- returns True if a handle has been allocated
IsRightToLeft
- returns True if Right to Left mode is being used (eg for Hebrew or Arabic languages)
HandleNeeded
- method to signal that a handle is required
DispatchCommand
- returns True if the supplied command is a dispatch command
Handle
- the Operating System Handle for this Menu
The Parent component for this Menu
Items

- a list of Menu Items to be included in the menu display
Images

- a list of images from which entries can be selected to illustrate menu choices
TMainMenu

- the Main Menu that appears at the top of most windows

TMainMenu

- the Main Menu that appears at the top of most windows; form designers can customise by choosing various menu items.

Main Menu is a non-visible component : that is, if the icon is selected from the Component Pallete and placed on the Form, it will not appear at Run-time. Instead, a Menu bar with a structure defined by the Menu Editor will appear.

To see the Menu Editor, right-click on the Main Menu icon on your Form.

ItemChanged
- method to deal with a changed Item
Create
- constructor for TMainMenu: sets style to MainMenu then calls inherited Create
TMenu.Create
OnChange
- event handler for a change in the Menu
TPopupMenu

- a menu panel that pops up on the desktop when the right mouse button is clicked

TPopupMenu

: a menu panel that pops up on the desktop when the right mouse button is clicked.

Inherits all the properties of TMenu (including the properties of TMenuItem), but has some new properties (procedure PopUp and procedure Close) that define its behaviour when actually invoked.

PopupPoint defines the position of the Popup menu, usually at the current cursor position.

To use a Popup menu, first create it with the MenuEditor. Then with the Object Inspector for the control that needs to use the Popup, select the property named PopupMenu, and a listbox will appear with the names of the available Menus - choose the Popup name you want

DoPopup
perform the popup method
Create
- constructor for TPopupMenu: calls inherited Create, sets style to PopupMenu, sets AutoPopup to True
TMenu.Create
Destroy
- destructor for TPopupMenu: closes window then calls inherited Destroy
TMenu.Destroy
PopUp
- sofware emulation of the OnPopup event
PopupComponent
- the Component to which this popup applies
PopupPoint
- the position at which the Popup is to appear
Close
- software emulation of the OnClose event, to shut down the Popup
DoClose
- perform the Close method
AutoPopup
- if True, the Popup window automatically appears when the mouse hovers over the relevant object
OnPopup
- event handler for a requirement for a popup menu
OnClose
- event handler for closing down the popup
You can delete menu items here. But if you delete the clicked menu item on OnClose the OnClick will not follow under Windows.
HowToUseMenus

- hints for creating Menus for your Forms

HowToUseMenus

- hints for creating Menus for your Forms

TMainMenu

is the Main Menu that appears at the top of most forms; form designers can customise by choosing various menu items. TPopupMenu is a menu window that pops up with pertinent, usually context-sensitive, details and choices when the right mouse button is clicked near a control

Main Menu is a non-visible component : that is, if the icon is selected from the Component Palette and placed on the Form, it will not appear at Run-time. Instead, a Menu bar with a structure defined by the Menu Editor will appear. Popup menus, placed on the form by selecting the icon from the Component Palette, do not appear at all unless the right mouse button is clicked on a control that owns such a menu.

To see the Menu Editor, right-click on the Main Menu or Popup Menu icon on your Form. A pop-up box appears, that invites you to enter items into the Menu bar.

An Edit box is displayed, containing a Button labelled New Item1. If you right-click on that box, a pop-up menu is displayed that allows you to add a new item before or after (along the same level) or create a sub-menu with the opportunity to add further items below (or above) the new item in a downward column.

Any or all of the MenuItems that you add can be configured using the Object Inspector.

At the least you should give each item a Caption which will appear on the Menu Bar (you may also wish to give it a more meaningful Name). The caption should indicate the activity to be selected, such as "File Open" or "Close", "Run" or "Quit"

If you want a particular letter in the Caption to be associated with a shortcut key, that letter should be preceded by an ampersand. The Menu item at run-time will appear with the shortcut letter underlined, and hitting that letter key will have the same effect as selecting the menu item. Alternatively you can choose a shortcut key sequence (such as Ctrl-C for Copy or Ctrl-V for Paste - the standard Keyboard shortcuts) with the ShortCut property of the MenuItem.

It is often helpful to use the Menu controls in conjuction with an ActionList which contains a series of standard or customised Actions. Menu Items can be linked in the Object Inspector to Actions on the list, and the same actions can be linked to Buttons, ToolBar Buttons, SpeedButtons etc. It is obviously economic of effort to re-use the same code to respond to the various events, rather than writing separate OnClick event handlers for each individual control.

By default a number of standard actions is pre-loaded from StdActns or, if DataAware controls are being used, from DBActns, and these can be chosen using the ActionList editor which appears when you right-click on the ActionList icon on the Form Designer.

BitmapChange
- update the image associated with the menu item when the Bitmap has been changed
UpdateImage
- freshen the image associated with the menu item, particularly if it has changed
UpdateWSIcon
- update the icon in the current Widget Set for this menu item
Find
the identity given menu item (named in ACaption)
GetIsRightToLeft
- find the value of the property determining whether right-to-left read/write is enabled
IsLine
- if true, this item is a line (separator) on the menu
Menu
- the menu to which this item belongs
WriteDebugReport
- used in debugging
IntfDoSelect
- perform the selection using the interface
AddHandlerOnDestroy
- add a handler for the OnDestroy event
RemoveHandlerOnDestroy
- remove a handler for the OnDestroy event
AddHandler
- method to add a handler
RemoveHandler
- method for removing a handler
TMenuItemClass
- class of TMenuItem
BidiModeChanged
- method for dealing with changed Bi-directional mode
ParentBidiModeChanged
- procedure to deal with a change in the Parent Bi-directional mode
IsShortcut
- returns True if the specified message key represents a shortcut
UseRightToLeftAlignment
- returns True if Right-Left alignment is being used
UseRightToLeftReading
- returns True if reading from Right to Left
ShortcutHandled
- if True, the shortcut for the menu is properly handled
BidiMode
- whether Bi-directional mode is implemented, allowing use with languages like Arabic or Hebrew
ParentBidiMode
- the BidiMode of the parent
TMenuItemHandlerType
- enumerated type for menu item handlers
Currently has only one member - mihtDestroy
TrackButton
- defines which mouse button(s) are allowed to activate menu items
TPopupAlignment
- enumerated type to describe the position of popup menu relative to the popup coordinate

    paLeft - position popup menu so it left corner is at the popup coordinate
        paRight - position popup menu menu so it right corner is at the popup corrdinate
        paCenter - center popup menu around popup corrdinate

TTrackButton
- enumerated type described which mouse buttons can be used to activate (click) menu items

    tbRightButton - both left and right buttons are used to activate a menu item
    tbLeftButton - only left button is used to activate a menu item

Alignment
- determines the position of popup menu relative to the popup coordinate