(pour ceux qui le veulent, temps internet du spoilertempo : 1258801702)
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, ComCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton; // un bouton
Edit1: TEdit; // une zone de texte éditable
Edit2: TEdit;
Label1: TLabel; // des textes posés sur la fiche
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
ProgressBar1: TProgressBar; // une barre de progression
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var somme,diff : LongInt;
no: Integer;
begin
Label6.Visible:=False;
ProgressBar1.visible:=True;
for no :=0 to 10 do
begin // boucle de la barre de défilement :
ProgressBar1.Position:=10*no; // (purement esthétique)
ProgressBar1.Refresh; // rafraichir la barre.
Sleep (100) // patiente 100 ms.
end;
somme := (StrToInt(Edit1.Text) + StrToInt(Edit2.Text)) ;
somme := somme div 2;
diff := (StrToInt(Edit1.Text) - StrToInt(Edit2.Text)) ;
diff := diff div 2;
Sleep (1000);
Label6.Visible:=True;
Label1.Caption :=IntToStr(somme);
Label2.Caption :=IntToStr(diff)
end;
initialization
{$I unit1.lrs}
end. Utilisateurs parcourant actuellement ce forum : Aucun utilisateur inscrit et 1 invité