home *** CD-ROM | disk | FTP | other *** search
- unit Floats;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls;
-
- type
- TFloatForm = class(TForm)
- ValueEdit: TComboBox;
- FormatEdit: TComboBox;
- ResultEdit: TEdit;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- FloatForm: TFloatForm;
-
- implementation
-
- {$R *.DFM}
-
- procedure TFloatForm.Button1Click(Sender: TObject);
- begin
- ResultEdit.Text := FormatFloat(FormatEdit.Text, StrToFloat(ValueEdit.Text));
- end;
-
- procedure TFloatForm.FormCreate(Sender: TObject);
- begin
- with ValueEdit.Items do
- begin
- Add('1234' + DecimalSeparator + '56');
- Add('-12345' + DecimalSeparator + '678901');
- Add('0');
- Add('-1');
- Add('1234567890' + DecimalSeparator + '12');
- Add('123e14');
- Add('-123e-8');
- end;
- ValueEdit.Text := ValueEdit.Items[0];
- end;
-
- end.
-