File: ReadFloat.pas

package info (click to toggle)
mricron 0.20140804.1~dfsg.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,480 kB
  • ctags: 8,011
  • sloc: pascal: 114,853; sh: 49; makefile: 32
file content (53 lines) | stat: -rwxr-xr-x 1,141 bytes parent folder | download | duplicates (4)
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
46
47
48
49
50
51
52
53
unit ReadFloat;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
  Spin;

type

  { TReadFloatForm }

  TReadFloatForm = class(TForm)
    ReadFloatEdit: TFloatSpinEdit;
    OKBtn: TButton;
    ReadFloatLabel: TLabel;
    procedure OKBtnClick(Sender: TObject);
 function GetFloat(lStr: string; lMin,lDefault,lMax: double): double;
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  ReadFloatForm: TReadFloatForm;

implementation

{ TReadFloatForm }
 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;

initialization
  {$I ReadFloat.lrs}

end.