TMenuItem class
Represents a menu item displayed in a menu.
Declaration
TMenuItem = class(TLCLComponent)Inheritance
Description
TMenuItem is a
TLCLComponent descendant which represents
a menu item displayed on a
TMenu instance, or one of its derived
classes like
TMainMenu and
TPopUpMenu.
TMenuItem has properties which define the behavior and display attributes for
the menu item, such as whether it is displayed as a radio button and whether it
automatically checked when the menu item is clicked. It allows accelerator keys
to be defined in the Caption for an item displayed on a main menu.
An image can be displayed for a menu item - whether assigned to the menu item
or in the image list for a parent menu or menu item. Event handlers are also
provided which perform actions needed when the menu item is measured, drawn, or
clicked.
TMenuItem instances are normally created at design-time using the menu editor for a menu component, but they can also be created and configured at run-time.
TMenuItem is the type maintained in both the TMenu.Items and
TMenuItem.Items properties.
See also
- Caption
- ShortCut
- ShortCutKey2
- RadioItem
- GroupIndex
- Action
- AutoCheck
- Bitmap
- ImageIndex
- Items
- Menu
- Parent
- OnClick
- OnDrawItem
- OnMeasureItem
- Items
Properties
ActionLink | protected | Contains the link to the Action for the menu item. |
Merged | public | Menu item where the class instance and its children have been merged. |
MergedWith | public | Menu item where the current class instance was merged. |
Count | public | Number of child menu items stored in the Items property. |
Handle | public | Handle for the menu item allocated in the widgetset class. |
Items | public | Provides indexed access to the child menu items for the current class instance. |
MergedItems | public | Returns the visible and invisible child items taking the merged menu into account. |
MenuIndex | public | Ordinal position for the menu item in its Parent. |
Menu | public | Menu where the menu item is displayed. |
Parent | public | The parent menu item for the class instance. |
MergedParent | public | The parent menu item for the class instance taking the merged menu into account. |
Command | public | Numeric command for the menu item as assigned in the widgetset class. |
Action | published | Action is the default action associated with the menu item. |
AutoCheck | published | Indicates whether the menu item automatically toggles the value in Checked when executed. |
AutoLineReduction | published | Indicates the method used to perform line reduction for the menu item and optionally for its child Items. |
Caption | published | The caption text displayed for the menu item. |
Checked | published | Indicates whether a check mark is displayed beside the menu item. |
Default | published | Indicates if the menu item is the default selection. |
Enabled | published | Indicates if the menu item can be selected and executed. |
Bitmap | published | Bitmap image (glyph) displayed for the menu item. |
GroupIndex | published | GroupIndex: the sequence number in a group of mutually exclusive RadioItem choices. |
GlyphShowMode | published | Indicates the display behavior for the glyph (or Bitmap) on the menu item. |
HelpContext | published | Index to the context-sensitive help string used for the menu item (context ID). |
Hint | published | Contains hint text displayed for the menu item. |
ImageIndex | published | Ordinal position in the list of images for the glyph displayed on the menu item. |
RadioItem | published | Indicates if the menu item is displayed as a radio button. |
RightJustify | published | Indicates if the menu item caption is displayed with right-justification. |
ShortCut | published | Accelerator key sequence to be used in selecting this menu item. |
ShortCutKey2 | published | Secondary shortcut (accelerator) key for the menu item. |
ShowAlwaysCheckable | published | ShowAlwaysCheckable - if True, Item is always shown as checkable. |
SubMenuImages | published | SubMenuImages indicates if images are shown for sub-menu items as well as the main item. |
SubMenuImagesWidth | published | Width for the bitmaps in the SubMenuImages property. |
Visible | published | Indicates whether the menu item is visible ( True) or hidden ( False). |
Methods
WSRegisterClass | protected | Registers this component class with the current WidgetSet. |
ActionChange | protected | Changes the action for the menu item using the value specified in Sender. |
AssignTo | protected | Copies property values from the current class instance to the specified destination. |
GetAutoLineReduction | protected | Indicates whether automatic line reduction is enabled for the menu item. |
BitmapChange | protected | Updates the image associated with the menu item when it has been changed. |
DoDrawItem | protected | Performs actions needed to draw the menu item to the specified Canvas. |
DoMeasureItem | protected | Performs actions needed to get the width and height for the menu item. |
InternalRethinkLines | protected | Indicates whether child menu Items need to be updated to hide leading, trailing, or adjacent separators. |
GetAction | protected | Gets the value for the Action property. |
GetActionLinkClass | protected | Gets the class reference used to create an action link for the class. |
GetHandle | protected | Gets the value for the Handle property. |
DoClicked | protected | DoClicked- process the system message signifying that a click has occurred over this menu item. |
CheckChildrenHandles | protected | Verifies the handles for child menu items on the menu. |
CreateHandle | protected | Creates the Handle for the menu item. |
DestroyHandle | protected | Frees the Handle for the control and any handles allocated for its Items. |
Loaded | protected | Performs actions needed after the component is loaded using LCL streaming. |
Notification | protected | Performs a notification when the menu item is added or removed. |
GetChildren | protected | Performs an operation for a component instance and its Items. |
InitiateActions | protected | Updates Actions in child menu items. |
MenuChanged | protected | Signals the OnChange event handler (when assigned) and optionally rebuilds child menu items. |
SetAction | protected | Sets the value for the Action property. |
SetChildOrder | protected | Moves a menu item to the specified position in a menu. |
SetGroupIndex | protected | Sets the value for the GroupIndex property. |
SetImageIndex | protected | Sets the value for the ImageIndex property. |
SetParentComponent | protected | Ensures that the menu item is parented by the specified menu or menu item. |
SetShortCut | protected | Sets the value for the ShortCut property. |
SetShortCutKey2 | protected | Sets the value for the ShortCutKey2 property. |
SetVisible | protected | Sets the value for the Visible property. |
UpdateWSIcon | protected | Updates the widgetset class with the values in HasIcon and Bitmap. |
ImageListChange | protected | Implements the event handler signalled when SubMenuImages property has been updated. |
Create | public | Constructor for the class instance. |
Destroy | public | Destructor for the class instance. |
Find | public | Find the identity given menu item (named in ACaption). |
GetEnumerator | public | Gets an enumerator for the child menu Items in the class instance. |
GetImageList | public | Gets an image list with the available bitmaps for the menu item. |
GetParentComponent | public | Gets the menu for the Parent component when available. |
GetParentMenu | public | Gets the parent menu to which this menu item belongs. |
GetMergedParentMenu | public | Gets the parent menu to which this menu item belongs taking a merged menu into account. |
GetIsRightToLeft | public | Determines whether right-to-left display is enabled for the menu item. |
HandleAllocated | public | Indicates whether a Handle has been allocated for the menu item. |
HasIcon | public | True when a bitmap is configured and available for the menu item. |
HasParent | public | Indicates if the menu item has a parent menu item. |
InitiateAction | public | Updates the Action in the ActionLink for the menu item. |
IntfDoSelect | public | Performs actions needed when the menu item is selected using the LCL interface. |
IndexOf | public | Gets the ordinal position in Items for the specified menu item. |
IndexOfCaption | public | Gets the ordinal position in Items for the menu item with the specified Caption. |
InvalidateMergedItems | public | Frees the MergedItems property for the menu item. |
VisibleIndexOf | public | Gets the ordinal position for the specified menu item in the list of visible menu items. |
Add | public | Adds item(s) to the menu item. |
AddSeparator | public | Adds a separator line to the child menu items. |
Click | public | Performs actions needed when the menu item is clicked. |
Delete | public | Deletes the child menu item at the specified position in Items. |
HandleNeeded | public | Ensures that a valid Handle exists for the menu item. |
Insert | public | Insert stores the specified menu item at the location indicated by Index. |
RecreateHandle | public | Re-creates the Handle for the menu item. |
Remove | public | Removes the specified menu item from its Parent. |
UpdateImage | public | Updates the image associated with the menu item. |
UpdateImages | public | Update the images for the menu item and its child items. |
IsCheckItem | public | Indicates if the menu item is configured as a check box or a radio button item. |
IsLine | public | True if the menu item is configured as a separator line. |
IsInMenuBar | public | True if the menu item has a TMainMenu instance as its Parent. |
Clear | public | Removes all child menu Items in the class instance. |
HasBitmap | public | Indicates whether a TBitmap instance has been assigned to the Bitmap property. |
GetIconSize | public | Gets the size for the icon (glyph) when used on the menu item. |
RethinkLines | public | Performs actions needed to update the visibility of child menu separators and signal the OnChange event handler for the changes. |
RemoveAllHandlersOfObject | public | Removes all handler routines for the specified object instance from the internal handler lists. |
AddHandlerOnDestroy | public | Adds an OnDestroy event handler to the handlers for the menu item. |
RemoveHandlerOnDestroy | public | Removes the specified OnDestroy event handler from the list of handlers for the menu item. |
AddHandler | public | Adds an event handler routine of the specified type to the menu item. |
RemoveHandler | public | Removes the event handler routine from the specified handler type. |
MenuVisibleIndex | public | MenuVisibleIndex - the index value of the visible menu. |
WriteDebugReport | public | Generates information about the menu item and its child Items for use in the debugger. |
Events
OnClick | published | Event handler signalled to perform the actions needed when the menu item is executed. |
OnDrawItem | published | Event handler signalled to draw the menu item. |
OnMeasureItem | published | Event handler signalled to get the Width and Height for the menu item. |
Fields
FCommand | protected | Stores the numeric command in the widgetset class for the menu item. |
FCompStyle | public | Member used to store style flags for the component. |
Inherited
From TLCLComponent (6)
DecLCLRefCount GetWSComponentClass IncLCLRefCount LCLRefCount NewInstance WidgetSetClass
From TComponent (66)
_AddRef _Release BeforeDestruction CanObserve ChangeName ComObject ComponentCount ComponentIndex Components ComponentState ComponentStyle DefineProperties DesignInfo DestroyComponents Destroying ExecuteAction FindComponent FreeNotification FreeOnRelease GetChildOwner GetChildParent GetDeltaStreams GetIDsOfNames GetNamePath GetObservers GetOwner GetTypeInfo GetTypeInfoCount iicrGetComponent InsertComponent Invoke IsImplementorOf Loading Name ObserverAdded Observers OnGetDeltaStreams Owner PaletteCreated QueryInterface ReadDeltaState ReadDeltaStream ReadState ReferenceInterface RemoveComponent RemoveFreeNotification RemoveFreeNotifications SafeCallException SetAncestor SetDesigning SetDesignInstance SetInline SetName SetSubComponent Tag ToString TToStringNameMode UpdateAction Updated UpdateRegistry Updating ValidateContainer ValidateInsert ValidateRename VCLComObject WriteState
From TPersistent (4)
Assign FPOAttachObserver FPODetachObserver FPONotifyObservers
From TObject (36)
AfterConstruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName QualifiedClassName StringMessageTable SystemHasExtendedRTTI UnitName
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
