Sign in Join
FPDoc Onlineexperiment

TMenuMeasureItemEvent procedure type

In unit Menus

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

Declaration

pascal
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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.