Bonjour,
Sur mon form je voudrais faire la chose suivante:
si mon comboBox vaut X, alors s'affiche des champs A,B,C
si mon comboBox vaut Y, alors s'affiche des champs D,E,F
Avez vous une idee? Merci,
Version imprimable
Bonjour,
Sur mon form je voudrais faire la chose suivante:
si mon comboBox vaut X, alors s'affiche des champs A,B,C
si mon comboBox vaut Y, alors s'affiche des champs D,E,F
Avez vous une idee? Merci,
En prenant les mots de ta question à la lettre cela donne ceci :Citation:
Sur mon form je voudrais faire la chose suivante:
si mon comboBox vaut X, alors s'affiche des champs A,B,C
si mon comboBox vaut Y, alors s'affiche des champs D,E,F
... et si cela ne convient pas c'est que ta question est mal posée.;)Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 begin if comboBox.text='X' then begin labelDaffichageChampA.visible:=true; labelDaffichageChampB.visible:=true; labelDaffichageChampC.visible:=true; end else if comboBox.text='Y' then begin labelDaffichageChampD.visible:=true; labelDaffichageChampE.visible:=true; labelDaffichageChampF.visible:=true; end else begin labelDaffichageChampA.visible:=false; labelDaffichageChampB.visible:=false; labelDaffichageChampC.visible:=false; labelDaffichageChampD.visible:=false; labelDaffichageChampE.visible:=false; labelDaffichageChampF.visible:=false; end; end;
Rien de plus facile
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13 // Evenement à vérifier, si onClick ... procedure TForm.ComboChange(Sender: TObject); begin if Sender is TComboBox then begin ComponentA.Visible := (Sender as TComboBox).Text := 'X' ; ComponentB.Visible := (Sender as TComboBox).Text := 'X' ; ComponentC.Visible := (Sender as TComboBox).Text := 'X' ; ComponentD.Visible := (Sender as TComboBox).Text := 'Y' ; ComponentE.Visible := (Sender as TComboBox).Text := 'Y' ; ComponentF.Visible := (Sender as TComboBox).Text := 'Y' ; end: end;
j'ai trouve la reponse entre temps, mais merci quand meme