Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionType Tnombredeclic= Array [0..3] of Integer; TProduits = Array [0..3] of String[20];//de zéro a trois car j’ai quatre checkbox var Form2: TForm2; I:Integer; nombredeclic :Tnombredeclic ; Produits : TProduits; implementation uses Unit1, Unit3, Unitfin; {$R *.dfm} //_______________FormCreate__________ // Array : Apres avoir cliquer une fois , y’a un texte qui s’affiche dans le mémo procedure TForm2.FormCreate(Sender: TObject); var I : integer; begin for I:=0 to 3 do Nombredeclic[i]:=0; Produits[0] := 'LoveHearts'; Produits[1] := 'Cadre'; Produits [2] := 'Tasse'; Produits [3] := 'fleurs'; end; // Plusieurs fonctions sur ce bouton procedure TForm2.ButtonTotalClick(Sender: TObject); var Total : Real; // Pour faire la somme I:Integer; // Pour le Array // ___________Debut pour la somme____________ Begin Total :=0; if checkbox1.Checked = true then Total := Total + 12.90; if checkbox2.Checked = true then Total := Total + 14.90 ; if checkbox3.Checked = true then Total := Total + 9.90 ; if checkbox4.Checked = true then Total := Total + 39.90; LabelTotal.caption :=FloatToStr(Total); // end de la somme ButtonConfirmer.Enabled:=True ; // ________Debut Array________ begin MemoTop.Lines.Clear;// ceci fait en sorte que quand on décoche et coche le texte ne s’affiche pas plusieurs fois dans le mémo !! If Checkbox1.checked=True Then Nombredeclic[0]:= Nombredeclic [0] +1; If Checkbox2.checked=True Then Nombredeclic [1]:= Nombredeclic [1] +1; If Checkbox3.checked=True Then Nombredeclic [2]:= Nombredeclic [2] +1; If Checkbox4.checked=True Then Nombredeclic [3]:= Nombredeclic [3] +1; // debut for to do For i := 0 to 3 do If Nombredeclic [i] >= 1 then// après avoir cliquer une fois sur le boutton total le même enregistre les checkbox cocher et note les dans le mémo memoTop.lines.add(Produits[i] + ' est votre choix'); end; end;