Sign in Join
FPDoc Onlineexperiment

TMenuItem class

In unit Menus

Represents a menu item displayed in a menu.

Declaration

pascal
TMenuItem = class(TLCLComponent)

Inheritance

  1. TMenuItem
  2. TLCLComponent
  3. TComponent
  4. TPersistent
  5. TObject

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

Properties

ActionLinkprotectedContains the link to the Action for the menu item.
MergedpublicMenu item where the class instance and its children have been merged.
MergedWithpublicMenu item where the current class instance was merged.
CountpublicNumber of child menu items stored in the Items property.
HandlepublicHandle for the menu item allocated in the widgetset class.
ItemspublicProvides indexed access to the child menu items for the current class instance.
MergedItemspublicReturns the visible and invisible child items taking the merged menu into account.
MenuIndexpublicOrdinal position for the menu item in its Parent.
MenupublicMenu where the menu item is displayed.
ParentpublicThe parent menu item for the class instance.
MergedParentpublicThe parent menu item for the class instance taking the merged menu into account.
CommandpublicNumeric command for the menu item as assigned in the widgetset class.
ActionpublishedAction is the default action associated with the menu item.
AutoCheckpublishedIndicates whether the menu item automatically toggles the value in Checked when executed.
AutoLineReductionpublishedIndicates the method used to perform line reduction for the menu item and optionally for its child Items.
CaptionpublishedThe caption text displayed for the menu item.
CheckedpublishedIndicates whether a check mark is displayed beside the menu item.
DefaultpublishedIndicates if the menu item is the default selection.
EnabledpublishedIndicates if the menu item can be selected and executed.
BitmappublishedBitmap image (glyph) displayed for the menu item.
GroupIndexpublishedGroupIndex: the sequence number in a group of mutually exclusive RadioItem choices.
GlyphShowModepublishedIndicates the display behavior for the glyph (or Bitmap) on the menu item.
HelpContextpublishedIndex to the context-sensitive help string used for the menu item (context ID).
HintpublishedContains hint text displayed for the menu item.
ImageIndexpublishedOrdinal position in the list of images for the glyph displayed on the menu item.
RadioItempublishedIndicates if the menu item is displayed as a radio button.
RightJustifypublishedIndicates if the menu item caption is displayed with right-justification.
ShortCutpublishedAccelerator key sequence to be used in selecting this menu item.
ShortCutKey2publishedSecondary shortcut (accelerator) key for the menu item.
ShowAlwaysCheckablepublishedShowAlwaysCheckable - if True, Item is always shown as checkable.
SubMenuImagespublishedSubMenuImages indicates if images are shown for sub-menu items as well as the main item.
SubMenuImagesWidthpublishedWidth for the bitmaps in the SubMenuImages property.
VisiblepublishedIndicates whether the menu item is visible ( True) or hidden ( False).

Methods

WSRegisterClassprotectedRegisters this component class with the current WidgetSet.
ActionChangeprotectedChanges the action for the menu item using the value specified in Sender.
AssignToprotectedCopies property values from the current class instance to the specified destination.
GetAutoLineReductionprotectedIndicates whether automatic line reduction is enabled for the menu item.
BitmapChangeprotectedUpdates the image associated with the menu item when it has been changed.
DoDrawItemprotectedPerforms actions needed to draw the menu item to the specified Canvas.
DoMeasureItemprotectedPerforms actions needed to get the width and height for the menu item.
InternalRethinkLinesprotectedIndicates whether child menu Items need to be updated to hide leading, trailing, or adjacent separators.
GetActionprotectedGets the value for the Action property.
GetActionLinkClassprotectedGets the class reference used to create an action link for the class.
GetHandleprotectedGets the value for the Handle property.
DoClickedprotectedDoClicked- process the system message signifying that a click has occurred over this menu item.
CheckChildrenHandlesprotectedVerifies the handles for child menu items on the menu.
CreateHandleprotectedCreates the Handle for the menu item.
DestroyHandleprotectedFrees the Handle for the control and any handles allocated for its Items.
LoadedprotectedPerforms actions needed after the component is loaded using LCL streaming.
NotificationprotectedPerforms a notification when the menu item is added or removed.
GetChildrenprotectedPerforms an operation for a component instance and its Items.
InitiateActionsprotectedUpdates Actions in child menu items.
MenuChangedprotectedSignals the OnChange event handler (when assigned) and optionally rebuilds child menu items.
SetActionprotectedSets the value for the Action property.
SetChildOrderprotectedMoves a menu item to the specified position in a menu.
SetGroupIndexprotectedSets the value for the GroupIndex property.
SetImageIndexprotectedSets the value for the ImageIndex property.
SetParentComponentprotectedEnsures that the menu item is parented by the specified menu or menu item.
SetShortCutprotectedSets the value for the ShortCut property.
SetShortCutKey2protectedSets the value for the ShortCutKey2 property.
SetVisibleprotectedSets the value for the Visible property.
UpdateWSIconprotectedUpdates the widgetset class with the values in HasIcon and Bitmap.
ImageListChangeprotectedImplements the event handler signalled when SubMenuImages property has been updated.
CreatepublicConstructor for the class instance.
DestroypublicDestructor for the class instance.
FindpublicFind the identity given menu item (named in ACaption).
GetEnumeratorpublicGets an enumerator for the child menu Items in the class instance.
GetImageListpublicGets an image list with the available bitmaps for the menu item.
GetParentComponentpublicGets the menu for the Parent component when available.
GetParentMenupublicGets the parent menu to which this menu item belongs.
GetMergedParentMenupublicGets the parent menu to which this menu item belongs taking a merged menu into account.
GetIsRightToLeftpublicDetermines whether right-to-left display is enabled for the menu item.
HandleAllocatedpublicIndicates whether a Handle has been allocated for the menu item.
HasIconpublicTrue when a bitmap is configured and available for the menu item.
HasParentpublicIndicates if the menu item has a parent menu item.
InitiateActionpublicUpdates the Action in the ActionLink for the menu item.
IntfDoSelectpublicPerforms actions needed when the menu item is selected using the LCL interface.
IndexOfpublicGets the ordinal position in Items for the specified menu item.
IndexOfCaptionpublicGets the ordinal position in Items for the menu item with the specified Caption.
InvalidateMergedItemspublicFrees the MergedItems property for the menu item.
VisibleIndexOfpublicGets the ordinal position for the specified menu item in the list of visible menu items.
AddpublicAdds item(s) to the menu item.
AddSeparatorpublicAdds a separator line to the child menu items.
ClickpublicPerforms actions needed when the menu item is clicked.
DeletepublicDeletes the child menu item at the specified position in Items.
HandleNeededpublicEnsures that a valid Handle exists for the menu item.
InsertpublicInsert stores the specified menu item at the location indicated by Index.
RecreateHandlepublicRe-creates the Handle for the menu item.
RemovepublicRemoves the specified menu item from its Parent.
UpdateImagepublicUpdates the image associated with the menu item.
UpdateImagespublicUpdate the images for the menu item and its child items.
IsCheckItempublicIndicates if the menu item is configured as a check box or a radio button item.
IsLinepublicTrue if the menu item is configured as a separator line.
IsInMenuBarpublicTrue if the menu item has a TMainMenu instance as its Parent.
ClearpublicRemoves all child menu Items in the class instance.
HasBitmappublicIndicates whether a TBitmap instance has been assigned to the Bitmap property.
GetIconSizepublicGets the size for the icon (glyph) when used on the menu item.
RethinkLinespublicPerforms actions needed to update the visibility of child menu separators and signal the OnChange event handler for the changes.
RemoveAllHandlersOfObjectpublicRemoves all handler routines for the specified object instance from the internal handler lists.
AddHandlerOnDestroypublicAdds an OnDestroy event handler to the handlers for the menu item.
RemoveHandlerOnDestroypublicRemoves the specified OnDestroy event handler from the list of handlers for the menu item.
AddHandlerpublicAdds an event handler routine of the specified type to the menu item.
RemoveHandlerpublicRemoves the event handler routine from the specified handler type.
MenuVisibleIndexpublicMenuVisibleIndex - the index value of the visible menu.
WriteDebugReportpublicGenerates information about the menu item and its child Items for use in the debugger.

Events

OnClickpublishedEvent handler signalled to perform the actions needed when the menu item is executed.
OnDrawItempublishedEvent handler signalled to draw the menu item.
OnMeasureItempublishedEvent handler signalled to get the Width and Height for the menu item.

Fields

FCommandprotectedStores the numeric command in the widgetset class for the menu item.
FCompStylepublicMember 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.