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

# TMenuItem.GetParentMenu

Gets the parent menu to which this menu item belongs.

## Declaration

Source position: menus.pp line 267

`public function TMenuItem.GetParentMenu: TMenu; virtual;`

## Function result

Menu for the top-most unparented menu item in the hierarchy, or Nil when not found.

## Description

GetParentMenu is a TMenu function used to get the menu where the menu item or its Parent menu item is located. GetParentMenu visits each of the Parent menu items. When an item is located without an assigned Parent, its Menu property is used as the return value for the method. The return value is Nil if all menu items in the hierarchy have a Parent menu item.

GetParentMenu is used in methods like GetIsRightToLeft, GetImageList, DoDrawItem, and DoMeasureItem.

## See also

TMenuItem.GetIsRightToLeft |  | Determines whether right-to-left display is enabled for the menu item.
TMenuItem.GetImageList |  | Gets an image list with the available bitmaps for the menu item.
TMenuItem.DoDrawItem |  | Performs actions needed to draw the menu item to the specified Canvas.
TMenuItem.DoMeasureItem |  | Performs actions needed to get the width and height for the menu item.