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

# TCalculatorDialog

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a pop-up calculator dialog used to perform simple calculations and return the value.

## Declaration

Source position: extdlgs.pas line 138

`type TCalculatorDialog = class(TExtCommonDialog)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`procedure OnDialogClose();` |  | Implements the event handler signalled when the dialog is closed.
`procedure OnDialogShow();`
`procedure OnDialogCloseQuery();`
`procedure Change; virtual;` |  | Change - software emulator for the OnChange event ???
`procedure CalcKey(); virtual;` |  | Implements the event handler signalled to process keys in the dialog.
`function DefaultTitle; override;` |  | Gets the default value used in the Title property for the calculator dialog.
`procedure DisplayChange; virtual;` |  | Implements the event handler signalled when the calculator display has been changed on the dialog form.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`function Execute; override;` |  | Creates, configures, and displays the form for the calculator dialog.
`property CalcDisplay: Double; [r]` |  | CalcDisplay - the current numeric value in the main calculator display.
`property Memory: Double; [r]` |  | Memory - the value stored in the calculator's memory.
`published`
`property BeepOnError: Boolean; [rw]` |  | BeepOnError - if True, beeps when there is an entry error or other calculator error.
`property CalculatorLayout: TCalculatorLayout; [rw]` |  | CalculatorLayout - whether simple or normal.
`property Precision: Byte; [rw]` |  | Precision - the level of precision to be used in calculations; default is set by DefCalcPrecision.
`property Title: TTranslateString;` |  | The Title or Caption displayed for the dialog.
`property Value: Double; [rw]` |  | Value - the numeric value (result) returned by the calculator.
`property OnCalcKey: TKeyPressEvent; [rw]` |  | OnCalcKey - event handler for a key press in the calculator.
`property OnChange: TNotifyEvent; [rw]` |  | OnChange - event handler for any change in the calculator.
`property OnDisplayChange: TNotifyEvent; [rw]` |  | OnDisplayChange - event handler for any change in the calculator display.
`property DialogScale: Integer; [rw]` |  | Scaling percentage applied to the calculator dialog form.
`property ColorBtnDigits: TColor; [rw]` |  | Color for the digit buttons displayed in the calculator dialog.
`property ColorBtnMemory: TColor; [rw]` |  | Color for the Memory button displayed in the calculator dialog.
`property ColorBtnOk: TColor; [rw]` |  | Color for the OK button displayed in the calculator dialog.
`property ColorBtnCancel: TColor; [rw]` |  | Color for the Cancel button displayed in the calculator dialog.
`property ColorBtnClear: TColor; [rw]` |  | Color for the Clear button displayed in the calculator dialog.
`property ColorBtnOthers: TColor; [rw]` |  | Color for other buttons displayed in the calculator dialog.
`property ColorDisplayText: TColor; [rw]` |  | Color for text displayed in the calculator dialog.
`property ColorDisplayBack: TColor; [rw]` |  | Color for background in the display area for the calculator dialog.
`end;`

## Inheritance

`TCalculatorDialog` |  | Implements a pop-up calculator dialog used to perform simple calculations and return the value.
`TExtCommonDialog` |  | The common base class for custom drawn dialogs (Calculator and Calendar).
`TCommonDialog` |  | The base type from which other dialogs are derived.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TCalculatorDialog is a TExtCommonDialog descendant which implements a pop-up calculator dialog used to perform calculations and return the result in the Value property. Value uses the Double type, and can be represented using the number of digits in the Precision property.

TCalculatorDialog uses a TCalculatorForm instance in the DlgForm property which includes separate panels to display the input value, numeric keys, labels, and other buttons on the dialog form. A CalculatorLayout property allows use of a detailed or a simplified view on the form. Properties are provided to set the colors used for components on DlgForm, including:

- ColorBtnDigits
- ColorBtnMemory
- ColorBtnOk
- ColorBtnCancel
- ColorBtnClear
- ColorBtnOthers
- ColorDisplayText
- ColorDisplayBack

Use the Memory property to store or retrieve a value for the calculator dialog.

## See also

TExtCommonDialog |  | The common base class for custom drawn dialogs (Calculator and Calendar).
TCalculatorForm |  | Implements the form used to display a calculator for a TCalculatorDialog instance.