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

# TMenuItem.DoMeasureItem

Performs actions needed to get the width and height for the menu item.

## Declaration

Source position: menus.pp line 232

`protected function TMenuItem.DoMeasureItem(`
`ACanvas: TCanvas;`
`var AWidth: Integer;`
`var AHeight: Integer`
`):Boolean; virtual;`

## Arguments

`ACanvas` |  | Canvas used to get size information for the menu item.
`AWidth` |  | Calculated width for the menu item.
`AHeight` |  | Calculated height for the menu item.

## Function result

True if the size was calculated using an OnMeasureItem event handler.

## Description

DoMeasureItem is a method used to perform actions needed to get the width and height for the menu item. DoMeasureItem signals the OnMeasureItem event handler (when assigned) to calculate the values in AWidth and AHeight. The TCanvas instance in ACanvas is used to get the text metrics for the Caption.

If the OnMeasureItem event handler has not been for the menu item, the OnMeasureItem event handler in the Parent menu is used.

The return value is set to True after the selected event handler is successfully executed.

DoMeasureItem is called from the MeasureItem method in the TMenuItemHelper class helper. This class helper is implemented for the Windows platform only.