diff options
Diffstat (limited to 'unit1.pas')
-rw-r--r-- | unit1.pas | 44 |
1 files changed, 26 insertions, 18 deletions
@@ -28,6 +28,8 @@ type procedure FormDestroy(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
+ procedure iterationsCallBack(Sender: TObject);
+ procedure loesungsCallBack(Sender: TObject);
private
{ private declarations }
public
@@ -43,6 +45,8 @@ implementation {$R *.lfm}
+uses unit3;
+
{ TForm1 }
procedure TForm1.FormResize(Sender: TObject);
@@ -75,7 +79,7 @@ begin ListBox1.Items.Clear;
ListBox2.Items.Clear;
- loesungen:=bruteForcen(tps,hps,thps,Cs,Rs,20,@FormClick);
+ loesungen:=bruteForcen(tps,hps,thps,Cs,Rs,20,@iterationsCallBack,@loesungsCallBack);
loesungen.indexVeroeffentlichen(Listbox1.Items);
hps.free;
@@ -83,28 +87,32 @@ begin thps.free;
end;
+procedure TForm1.FormClick(Sender: TObject);
+begin
+ form2.showModal;
+end;
+
const
c1: longint = 0;
c2: longint = 0;
-procedure TForm1.FormClick(Sender: TObject);
+procedure TForm1.iterationsCallBack(Sender: TObject);
+begin
+ inc(c1);
+ if c1 > 1000000 then begin
+ c1:=0;
+ Form1.Caption:=inttostr(c2)+' '+(sender as tLoesung).dumpWeite;
+ Application.ProcessMessages;
+ end;
+end;
+
+procedure TForm1.loesungsCallBack(Sender: TObject);
begin
- if assigned(sender) and
- (sender is tLoesung) then begin
- inc(c1);
- if c1>=1000000 then begin
- c1:=0;
- Form1.Caption:=inttostr(c2)+' '+(sender as tLoesung).dumpWeite;
- Application.ProcessMessages;
- end;
- end
- else begin
- inc(c2);
- if c2 mod 100 = 0 then begin
- Form1.Color:=random($1000000);
- Form1.Caption:=inttostr(c2)+' '+rightstr(Form1.Caption,length(Form1.Caption)-pos(' ',Form1.Caption));
- Application.ProcessMessages;
- end;
+ inc(c2);
+ if c2 mod 100 = 0 then begin
+ Form1.Color:=random($1000000);
+ Form1.Caption:=inttostr(c2)+' '+rightstr(Form1.Caption,length(Form1.Caption)-pos(' ',Form1.Caption));
+ Application.ProcessMessages;
end;
end;
|