1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
unit ReadFloat;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, RXSpin;
type
TReadFloatForm = class(TForm)
OKBtn: TButton;
ReadFloatLabel: TLabel;
ReadFloatEdit: TRxSpinEdit;
function GetFloat(lStr: string; lMin,lDefault,lMax: double): double;
procedure OKBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ReadFloatForm: TReadFloatForm;
implementation
{$R *.DFM}
function TReadFloatForm.GetFloat(lStr: string; lMin,lDefault,lMax: double): double;
begin
//result := lDefault;
ReadFloatLabel.caption := lStr+' ['+floattostr(lMin)+'..'+floattostr(lMax)+']';
ReadFloatEdit.MinValue := lMin;
ReadFloatEdit.MaxValue := lMax;
ReadFloatEdit.Value := lDefault;
ReadFloatForm.ShowModal;
result := ReadFloatEdit.Value;
end;
procedure TReadFloatForm.OKBtnClick(Sender: TObject);
begin
ReadFloatForm.ModalResult := mrOK;
end;
end.
|