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

# TMenuMeasureItemEvent

Specifies an event handler signalled to get the width and height for a menu item.

## Declaration

Source position: menus.pp line 119

`type TMenuMeasureItemEvent = procedure(`
`Sender: TObject;`
`ACanvas: TCanvas;`
`var AWidth: Integer;`
`var AHeight: Integer`
`) of object;`

## Arguments

`Sender` |  | Object (TMenuItem) for the event notification.
`ACanvas` |  | Canvas where the menu item is drawn.
`AWidth` |  | Width needed for the menu item.
`AHeight` |  | Height needed for the menu item.

## Description

TMenuMeasureItemEvent is an object procedure type which specifies an event handler signalled to get the width and height for a menu item.

Cast the value in Sender (when assigned) to a TMenuItem type to access properties and methods for the menu item.

Use ACanvas to access values for the TCanvas instance where the menu item is drawn.

AWidth and AHeight are variable arguments updated in the event handler with the dimensions for the menu item.

TMenuMeasureItemEvent is the type used to implement the OnMeasureItem property in TMenu and TMenuItem.

## See also

TMenu.OnMeasureItem |  | Event handler signalled to get the width and height for a menu item on the menu.
TMenuItem.OnMeasureItem |  | Event handler signalled to get the Width and Height for the menu item.