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 54 55 56 57 58 59 60 61 62 63 64
|
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons,
StdCtrls, IniFiles;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
nbct, poids:string;
FichierIni : TiniFile;
begin
FichierIni := TIniFile.Create(ExtractFilePath(Application.ExeName)+'surveyor.ini');
FichierIni.WriteString('Informations','Nombre de cartons,Edit1.Text);
FichierIni.WriteString('Informations','Poids',Edit2.Text);
nbct:=FichierIni.ReadString('Informations','Nombre de cartons','');
poids:= FichierIni.ReadString('Informations','Poids','');
FichierIni.free;
showmessage('Vous avez enregistré ' + nbct + ' cartons.' + #13#10 + 'Pour un poids total de ' + poids + '.');
end;
initialization
{$I unit1.lrs}
end. |
Partager