home *** CD-ROM | disk | FTP | other *** search
- unit fmt;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls;
-
- type
- TForm1 = class(TForm)
- inted: TEdit;
- outputed: TEdit;
- ComboBox1: TComboBox;
- floated: TEdit;
- ComboBox2: TComboBox;
- procedure ComboBox1Change(Sender: TObject);
- procedure ComboBox2Change(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- const
- DEFAULTSTR = 'Result is: [ % ]';
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.dfm}
-
- procedure TForm1.ComboBox1Change(Sender: TObject);
- var
- s : string;
- begin
- s := DEFAULTSTR;
- Insert( ComboBox1.Text, s, Pos('%', DEFAULTSTR )+1);
- Caption := 'Format string = "'+s+'"';
- outputed.Text := Format(s,[StrToInt(inted.Text)]);
- end;
-
- procedure TForm1.ComboBox2Change(Sender: TObject);
- var
- s : string;
- begin
- s := DEFAULTSTR;
- Insert( ComboBox2.Text, s, Pos('%', DEFAULTSTR )+1);
- Caption := 'Format string = "'+s+'"';
- outputed.Text := Format(s,[StrToFloat(floated.Text)]);
- end;
-
- end.
-