Bonjour
voici le code initial
Je cherche à remplacer mon repeat par un bouton suivant qui donc me lirai pas à pas le contenu de la boucle "repeat".
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
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74 procedure TFormSDFTest.BtOKClick(Sender: TObject); var MySDF: SDFmini; MyMol,lne: TStringList; NAtom,NBond: integer; i,j, a, lidx,Aidx: Integer; somme,dxA,dyA,dxB,dyB,dx,dy, vx ,vy: double; ix,iy, IxT, iyT : integer; MyFPMol: TMolecule; PAt: PRAtom; PBd: PRBond; mdl: TCFR; frg: LRDsc; ddx : double; // w: TArcCost; s,t,lgth: Node; v: TNodeCost; p,pth: TNodeInfo; frgstr: string; aid: AtomID; bid: BondID; pdsc: PRDsc; CMax, dxmin, dxmax, dymin, dymax: double; xg , yg, alphax, alphay, alpha : double ; mox, moy: double; cliquez :Integer; begin (* MySDF:=SDFmini.Create(EditSDFfile.Text);*) MySDF:=SDFCret(EditSDFfile); //MyFPMol:=TMolecule.Create; MyFPMol:=MyFP(); lne:=lne2(w); //Lecture dule ISIDA mdl:=mdlCret(EditISIDAfile); frg:=frg2(mdl); Refresh1.Enabled:=true; repeat MyMol:=suivantsdf(MySDF,MyFPMol); lne.DelimitedText:=MyMol[3]; lne.Clear; stockage(MyFPMol,MyMol,lne); initpoidsliaison(MyFPMol); MyFPMol :=miseenforme(MyFPMol, PaintBox1); affichagesymbole(MyFPMol, PaintBox1); extractpaths(MyFPMol,frg); tracageliaison(MyFPMol, PaintBox1); MyFPMol.Clear; until (MySDF.fend) liberer(MySDF,lne,MyFPMol, mdl); end;
J'ai creer un bouton suivant avec l'action OnClick et j'ai copier le contenu de repeat dedans de ce type
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
19 TApplication.HandleException Access violation Stack trace: $082924B3 SDFMINI__NEXTTMOL, line 61 of basicsdf.pas $08089A1D TFORMSDFTEST__SUIVANTSDF, line 194 of unitsdftest.pas $08089C6E TFORMSDFTEST__SUIVANTCLICK, line 326 of unitsdftest.pas $081773A4 TCONTROL__CLICK, line 2227 of ./include/control.inc $081B82FF TBUTTONCONTROL__CLICK, line 72 of ./include/buttoncontrol.inc $081B88E5 TCUSTOMBUTTON__CLICK, line 164 of ./include/buttons.inc $081B8E41 TBUTTON__CLICK, line 331 of ./include/buttons.inc $081B819A TBUTTONCONTROL__WMDEFAULTCLICKED, line 26 of ./include/buttoncontrol.inc $08069879 $0816DA82 TWINCONTROL__WNDPROC, line 4920 of ./include/wincontrol.inc $081F3617 DELIVERMESSAGE, line 111 of lclmessageglue.pas $08287100 GTK2WSBUTTON_CLICKED, line 1853 of gtk2wsstdctrls.pp $00FCE9FC $00FC1072 $00FD67A8 $00FD7B2D $00FD7FB6
Bref ici n'est pas la question
En gros ca marche pas...
J'ai penser utiliser une interruption avec ce code la
avec une procédure de Suivant.tag à 1 lors du click
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
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77 procedure TFormSDFTest.BtOKClick(Sender: TObject); var MySDF: SDFmini; MyMol,lne: TStringList; NAtom,NBond: integer; i,j, a, lidx,Aidx: Integer; somme,dxA,dyA,dxB,dyB,dx,dy, vx ,vy: double; ix,iy, IxT, iyT : integer; MyFPMol: TMolecule; PAt: PRAtom; PBd: PRBond; mdl: TCFR; frg: LRDsc; ddx : double; // w: TArcCost; s,t,lgth: Node; v: TNodeCost; p,pth: TNodeInfo; frgstr: string; aid: AtomID; bid: BondID; pdsc: PRDsc; CMax, dxmin, dxmax, dymin, dymax: double; xg , yg, alphax, alphay, alpha : double ; mox, moy: double; cliquez :Integer; begin (* MySDF:=SDFmini.Create(EditSDFfile.Text);*) MySDF:=SDFCret(EditSDFfile); //MyFPMol:=TMolecule.Create; MyFPMol:=MyFP(); lne:=lne2(w); //Lecture dule ISIDA mdl:=mdlCret(EditISIDAfile); frg:=frg2(mdl); Refresh1.Enabled:=true; repeat MyMol:=suivantsdf(MySDF,MyFPMol); lne.DelimitedText:=MyMol[3]; lne.Clear; stockage(MyFPMol,MyMol,lne); initpoidsliaison(MyFPMol); MyFPMol :=miseenforme(MyFPMol, PaintBox1); affichagesymbole(MyFPMol, PaintBox1); extractpaths(MyFPMol,frg); tracageliaison(MyFPMol, PaintBox1); MyFPMol.Clear; Suivant.tag :=0 repeat until( Suivant.tag :=1) until (MySDF.fend) liberer(MySDF,lne,MyFPMol, mdl); end;
Je rentre dans la boucle mais je ne ressort jamais.
Je bloque je n'ai pas d'autre solution.
A savoir que sans la boucle repeat, il me lit 1 fois le code (normal)
J'avais penser bloquer chaque repeat par une
Mais la méthode n'est la bonne
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Application.ProcessMessages; ShowMessage('Clickez pour continuer');
Partager