Sign in Join
FPDoc Onlineexperiment

TCalculatorDialog.Execute function

Member of TCalculatorDialogpublicIn unit ExtDlgs

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

Declaration

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

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