salut J'ai cinq composants frxReport1 de fastreport dans la form1
Et tous ces composants ont été utilisés dans son événement OnGetValue
le mème code suivant (sauf: frxReport4 , frxReport5 Ils contiennent le même code et plus d'autres codes en dessous):
Comment puis-je convertir ce code en procedure nous mettons un événement pour chaque composant frxReport
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 procedure TForm1.frxReport1GetValue(const VarName: String;var Value: Variant); begin if VarName = 'variable_sex' then begin if RadioGroup1.ItemIndex=0 then Value := 'M' else if RadioGroup1.ItemIndex=1 then Value := 'F' end; with FDQuery1 do begin Close; SQL.Clear; SQL.Add('Select code_etudiant from etudiantes'); Open; end; if VarName = 'variable_code_etud' then Value := FDQuery1.FieldByName('code_etudiant').Value; end;
Alors je l'ai mis dans chaque événement
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 procedure TForm1.frxReport1GetValue(const VarName: String;var Value: Variant); begin //appele d'une procedure pour executer le code précédent end;
Partager