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

# TCalculatorDialog.Execute

Creates, configures, and displays the form for the calculator dialog.

## Declaration

Source position: extdlgs.pas line 171

`public function TCalculatorDialog.Execute: Boolean; override;`

## Function result

True when the modal result for the form is mrOk.

## Description

Execute is an overridden Boolean function used to create, configure, display, and capture the result from the form for the calculator dialog. Execute calls CreateCalculatorForm to create the TCalculatorForm in the DlgForm property, and sets the event handlers for the form to methods defined in the class instance. For example:

DlgForm.OnCalcKey
  Set to the CalcKey method
DlgForm.OnDisplayChange
  Set to the DisplayChange method
DlgForm.OnShow
  Set to the DialogShow method
DlgForm.OnClose
  Set to the DialogClose method
DlgForm.OnCloseQuery
  Set to the DialogCloseQuery method

When DialogScale contains any value other than 100, the scaling percentage is applied to DlgForm.

The value in DialogPosition is stored in DlgForm as well. At design-time, the dialog position is always aligned to the center of the screen (or current monitor). When DialogPosition is poDesigned, the form coordinates in DlgForm are set to the values in the Left and Top properties. The content stored in the Title, Memory, Precision, and Value properties are copied into the corresponding properties in DlgForm.

Execute calls the ShowModal method in DlgForm to display the modal calculator dialog form. The return value for the method is set to True when the modal result from the form is mrOk. When the result is True, the Memory and Value properties are updated with the values form the dialog form. The Change method is called when the Value property has been altered.

The coordinates for the form are captured on exit, and stored in the Left and Top properties. The dimensions for the form (Width and Height) are also stored.

Execute frees the resources allocated to the DlgForm property prior to exit from the method.

## See also

TCalculatorDialog.Title |  | The Title or Caption displayed for the dialog.
TCalculatorDialog.Memory |  | Memory - the value stored in the calculator's memory.
TCalculatorDialog.Precision |  | Precision - the level of precision to be used in calculations; default is set by DefCalcPrecision.
TCalculatorDialog.Value |  | Value - the numeric value (result) returned by the calculator.
TExtCommonDialog.DialogPosition |  | Specifies the position where the dialog is displayed.
TExtCommonDialog.Left |  | Contains the left coordinate for the dialog form.
TExtCommonDialog.Top |  | Contains the top coordinate for the dialog form.
CreateCalculatorForm |  | Creates, configures, and returns a new TCalculatorForm instance.
TCalculatorForm |  | Implements the form used to display a calculator for a TCalculatorDialog instance.
TCommonDialog.Execute |  | Displays the dialog and captures the result.