Sign in Join
FPDoc Onlineexperiment

TMenuItem.DoMeasureItem function

Member of TMenuItemprotectedIn unit Menus

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

Declaration

pascal
function 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.

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