bonjour,
donc j'ai un problème de type il me marque : <<types incompatibles: 'tlabel' et 'string'>>.
voici une capture .
voici mon code en entier:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
boxargent: TGroupBox;
boxrecommencer: TGroupBox;
boxboutique: TGroupBox;
boxchamp: TGroupBox;
boxnotification: TGroupBox;
euro: TLabel;
logoeuro: TLabel;
recommencer: TButton;
textverification: TEdit;
boutiqueterre1: TButton;
boutiqueterre2: TButton;
boutiqueterre3: TButton;
boutiqueterre4: TButton;
plante1: TButton;
plante2: TButton;
plante3: TButton;
plante4: TButton;
plante6: TButton;
boutiqueterre5: TButton;
notification: TLabel;
plante5: TButton;
notification2: TLabel;
Timer1: TTimer;
planteterre1: TLabel;
planteterre2: TLabel;
planteterre3: TLabel;
planteterre4: TLabel;
planteterre5: TLabel;
planteterre6: TLabel;
procedure textverificationChange(Sender: TObject);
procedure recommencerClick(Sender: TObject);
procedure boutiqueterre1Click(Sender: TObject);
procedure boutiqueterre2Click(Sender: TObject);
procedure boutiqueterre3Click(Sender: TObject);
procedure boutiqueterre4Click(Sender: TObject);
procedure boutiqueterre5Click(Sender: TObject);
procedure plante1Click(Sender: TObject);
procedure plante2Click(Sender: TObject);
procedure plante3Click(Sender: TObject);
procedure plante4Click(Sender: TObject);
procedure plante5Click(Sender: TObject);
procedure plante6Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
bat, pta, ptb, ptc, ptd, pte, ptf: integer;
implementation
{$R *.dfm}
procedure TForm1.textverificationChange(Sender: TObject);
begin
if(textverification.Text = 'recommencer' )
then
begin
recommencer.Enabled:=true;
end
else
recommencer.Enabled:=false;
end;
procedure TForm1.recommencerClick(Sender: TObject);
begin
bat:=euro.HelpContext;
euro.Caption:=IntToStr(bat);
boutiqueterre1.Enabled:=true;
boutiqueterre2.Enabled:=true;
boutiqueterre3.Enabled:=true;
boutiqueterre4.Enabled:=true;
boutiqueterre5.Enabled:=true;
plante2.Enabled:=false;
plante3.Enabled:=false;
plante4.Enabled:=false;
plante5.Enabled:=false;
plante6.Enabled:=false;
textverification.Text:='';
notification2.Caption:=notification.Caption;
notification.Caption:='jeu recommencer';
end;
procedure TForm1.boutiqueterre1Click(Sender: TObject);
begin
if(euro.Caption >= '1')
then
begin
plante2.Enabled:=true;
bat:=bat-1;
euro.Caption:=IntToStr(bat);
boutiqueterre1.Enabled:=false;
notification2.Caption:=notification.Caption;
notification.Caption:='terre 2 débloquer';
end
else
notification2.Caption:=notification.Caption;
notification.Caption:='argent manquant';
end;
procedure TForm1.boutiqueterre2Click(Sender: TObject);
begin
if(euro.Caption >= '2')
then
begin
plante2.Enabled:=true;
bat:=bat-2;
euro.Caption:=IntToStr(bat);
boutiqueterre1.Enabled:=false;
notification2.Caption:=notification.Caption;
notification.Caption:='terre 3 débloquer';
end
else
notification2.Caption:=notification.Caption;
notification.Caption:='argent manquant';
end;
procedure TForm1.boutiqueterre3Click(Sender: TObject);
begin
if(euro.Caption >= '3')
then
begin
plante2.Enabled:=true;
bat:=bat-3;
euro.Caption:=IntToStr(bat);
boutiqueterre1.Enabled:=false;
notification2.Caption:=notification.Caption;
notification.Caption:='terre 4 débloquer';
end
else
notification2.Caption:=notification.Caption;
notification.Caption:='argent manquant';
end;
procedure TForm1.boutiqueterre4Click(Sender: TObject);
begin
if(euro.Caption >= '4')
then
begin
plante2.Enabled:=true;
bat:=bat-4;
euro.Caption:=IntToStr(bat);
boutiqueterre1.Enabled:=false;
notification2.Caption:=notification.Caption;
notification.Caption:='terre 5 débloquer';
end
else
notification2.Caption:=notification.Caption;
notification.Caption:='argent manquant';
end;
procedure TForm1.boutiqueterre5Click(Sender: TObject);
begin
if(euro.Caption >= '5')
then
begin
plante2.Enabled:=true;
bat:=bat-5;
euro.Caption:=IntToStr(bat);
boutiqueterre1.Enabled:=false;
notification2.Caption:=notification.Caption;
notification.Caption:='terre 6 débloquer';
end
else
notification2.Caption:=notification.Caption;
notification.Caption:='argent manquant';
end;
procedure TForm1.plante1Click(Sender: TObject);
begin
planteterre1.Caption:='8';
pta:=pta+8;
plante1.Enabled:=false;
end;
procedure TForm1.plante2Click(Sender: TObject);
begin
planteterre2.Caption:='8';
ptb:=ptb+8;
plante2.Enabled:=false;
end;
procedure TForm1.plante3Click(Sender: TObject);
begin
planteterre3.Caption:='8';
ptc:=ptc+8;
plante3.Enabled:=false;
end;
procedure TForm1.plante4Click(Sender: TObject);
begin
planteterre4.Caption:='8';
ptd:=ptd+8;
plante4.Enabled:=false;
end;
procedure TForm1.plante5Click(Sender: TObject);
begin
planteterre5.Caption:='8';
pte:=pte+8;
plante5.Enabled:=false;
end;
procedure TForm1.plante6Click(Sender: TObject);
begin
planteterre6.Caption:='8';
ptf:=ptf+8;
plante6.Enabled:=false;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if(planteterre1.Caption <> 'rien')
then
begin
pta:=pta-1;
planteterre1:=IntToStr(pta);
end;
if(planteterre2.Caption <> 'rien')
then
begin
ptb:=ptb-1;
planteterre2:=IntToStr(ptb);
end;
if(planteterre3.Caption <> 'rien')
then
begin
ptc:=ptc-1;
planteterre3:=IntToStr(ptc);
end;
if(planteterre4.Caption <> 'rien')
then
begin
ptd:=ptd-1;
planteterre4:=IntToStr(ptd);
end;
if(planteterre5.Caption <> 'rien')
then
begin
pte:=pte-1;
planteterre5:=IntToStr(pte);
end;
if(planteterre6.Caption <> 'rien')
then
begin
ptf:=ptf-1;
planteterre6:=IntToStr(ptf);
end;
end;
end.
merci pour toutes réponse.