Bonjour,
J'ai créé un formulaire avec 4 checkbox, pour une commande de cadeaux avec prix a côté.
J'ai un bouton total qui affiche le prix total à côté et un mémo qui reprend le détail des produit sélectionné.
Mon problème se situe au niveau de mon mémo, au premier clic sur le bouton total il m'affiche correctement les produits sélectionné,
mais si j'en déselectionne un ce qui à été affiché au premier clic reste affiché.
j'ai éssayé mémo.lines.clear.
pour faire en sorte qu'un texte s'affiche dans le mémo j'ai utilisé un array
comment pourrais-je faire en sorte qu'a chaque foi que je clic sur le bouton mon mémo se vide et affiche la sélection actuel
voici mon code source
[code]Type
Taantalklikken = Array [0..3] of Integer; // de beste artikel
TProducten = Array [0..3] of String[20];
var
Form2: TForm2;
I:Integer;
Aantalklikken :Taantalklikken ;
Producten : TProducten;
implementation
uses Unit1, Unit3, UnitEind;
{$R *.dfm}
//_______________FormCreate__________
// Array : na een keer klikken komt er een message de voorschijn
procedure TForm2.FormCreate(Sender: TObject);
var
I : integer;
begin
for I:=0 to 3 do
AantalKlikken[i]:=0;
Producten[0] := 'LoveHearts';
Producten[1] := 'Kader';
Producten[2] := 'Tas';
Producten[3] := 'Bloemen';
end;
// Meerdere Functies bij deze button
procedure TForm2.ButtonTotaalClick(Sender: TObject);
var
Totaal : Real; // SOM MAKEN
I:Integer; // ARRAY
// ___________Begin Som Maken____________
Begin
Totaal :=0;
if checkbox1.Checked = true
then Totaal := Totaal + 12.90;
if checkbox2.Checked = true
then Totaal := Totaal + 14.90 ;
if checkbox3.Checked = true
then Totaal := Totaal + 9.90 ;
if checkbox4.Checked = true
then Totaal := Totaal + 39.90;
LabelTotaal.caption :=FloatToStr(Totaal);
// end SOM maken
ButtonBevestigen.Enabled:=True ;
// ________Begin Array________
begin
MemoTop.Lines.Clear;
If Checkbox1.checked=True
Then AantalKlikken[0]:= AantalKlikken[0] +1;
If Checkbox2.checked=True
Then AantalKlikken[1]:= AantalKlikken[1] +1;
If Checkbox3.checked=True
Then AantalKlikken[2]:= AantalKlikken[2] +1;
If Checkbox4.checked=True
Then AantalKlikken[3]:= AantalKlikken[3] +1;
// begin for to do
For i := 0 to 3 do
If AantalKlikken[i] >= 1
then// als u bloemen niet aangevink zijn (verchillen van aanvinken)
//dus bij aanklikken memo verschijnen
memoTop.lines.add(Producten[i] + ' is uw gekozen product,');
end;
end;[/code]
Gwenaëlle