6 CustomDataEditClass
, FunctionsClass
, ResourcesClass
,
7 Classes
, Controls
, Forms
, Graphics
, StdCtrls
;
13 TFLoatEdit
= class(TCustomDataEdit
)
15 pChange
, pCancel
: TButton
;
17 pFloatEdit
, pHexEdit
: TEdit
;
18 pFloatLabel
, pHexLabel
: TLabel
;
22 procedure pFloatChange(Sender
: TObject
); virtual;
23 procedure pHexChange(Sender
: TObject
); virtual;
24 procedure pOnShow(Sender
: TObject
); virtual;
26 constructor Create(AOwner
: TComponent
); override;
27 function ShowBox(Input
: Pointer; Size
: Integer): Boolean; overload
; override;
28 function ShowBox(Input
: Pointer; Size
: Integer; var Check
: Boolean): Boolean; reintroduce
; overload
; virtual;
33 // ************************************************************************** //
34 // * TFLoatEdit implementation * //
35 // ************************************************************************** //
37 procedure TFLoatEdit
.pFloatChange(Sender
: TObject
);
39 if not pUserChange
then Exit
;
41 CustomStrToFloat(pFloatEdit
.Text, pFP
, pSize
);
42 pHexEdit
.Text := CustomDataToHex(pFP
, pSize
);
46 procedure TFLoatEdit
.pHexChange(Sender
: TObject
);
48 if not pUserChange
then Exit
;
50 CustomHexToData(pHexEdit
.Text, pFP
, pSize
);
51 pFloatEdit
.Text := CustomFloatToStr(pFP
, pSize
);
55 procedure TFLoatEdit
.pOnShow(Sender
: TObject
);
58 pFloatEdit
.Text := CustomFloatToStr(pFP
, pSize
);
59 pHexEdit
.Text := CustomDataToHex(pFP
, pSize
);
65 constructor TFLoatEdit
.Create(AOwner
: TComponent
);
67 inherited Create(AOwner
);
70 BorderStyle
:= bsDialog
;
72 pChange
:= TButton
.Create(Self
);
73 pFloatEdit
:= TEdit
.Create(Self
);
81 OnChange
:= pFloatChange
;
83 pHexEdit
:= TEdit
.Create(Self
);
91 OnChange
:= pHexChange
;
93 pCheckBox
:= TCheckBox
.Create(Self
);
97 Caption
:= FL_EDIT_MODIFY_TAG
;
106 Caption
:= FL_EDIT_OK
;
114 pCancel
:= TButton
.Create(Self
);
118 Caption
:= FL_EDIT_CANCEL
;
123 ModalResult
:= mrCancel
;
126 pFloatLabel
:= TLabel
.Create(Self
);
130 Caption
:= FL_EDIT_FLOAT
;
136 pHexLabel
:= TLabel
.Create(Self
);
140 Caption
:= FL_EDIT_HEX
;
149 function TFLoatEdit
.ShowBox(Input
: Pointer; Size
: Integer): Boolean;
154 Result
:= ShowBox(Input
, Size
, lcheck
);
157 function TFLoatEdit
.ShowBox(Input
: Pointer; Size
: Integer; var Check
: Boolean
166 pCheckBox
.Checked
:= True;
167 pCheckBox
.Visible
:= True;
174 pCheckBox
.Visible
:= False;
177 if (Size
in [4, 8, 10]) then
180 if (ShowModal
= mrOk
) then Result
:= True;
181 Check
:= pCheckBox
.Checked
;