It just doesnt work,
if anyone could help me i would very much appreciate it this is how the code looks:
procedure TForm7.TimerSecTimer(Sender: TObject);
var item : tlistitem; N : integer; randomnr : integer; x : integer; startime : tdatetime; timeleft : tdatetime; lasttime : tdatetime; currenttime : tdatetime;
begin
if i = Listview1.Items.Count -1 then
begin
if checkbox1.Checked = true then
begin
i := 0;
item := listview1.Items[i];
form2.image1.Picture.LoadFromFile(item.Caption);
end
else
begin
timersec.Enabled := false;
end;
end
else
begin
if checkbox2.Checked = true then
begin
if checkbox5.Checked = false then timersec.Enabled := false;
form2.Label9.Caption := 'Start time:' + timetostr(now); {here i show the start time}
startime := now; {saves the starttime}
randomnr := random(listview1.Items.Count -1);
form2.ProgressBar1.Max := listview1.Items.Count;
for n:=1 to ListView1.Items.Count do
begin
application.ProcessMessages;
if form2.checkbox1.checked = true then break;
form2.ProgressBar1.Position := form2.ProgressBar1.Position + 1;
form2.LblList1.Caption := 'Lisview1 : ' + inttostr(form2.ProgressBar1.Position) + ' out of ' + inttostr(form2.ProgressBar1.Max);
SetWindowPos(form3.Handle, HWND_TOPMOST, 0,0,0,0, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
if checkbox3.Checked = true then
begin
x := 0;
form2.ProgressBar2.Max := listview2.Items.Count;
While x<listview2.Items.Count do
begin
application.ProcessMessages;
if form2.checkbox1.checked = true then break;
if inttostr(randomnr) = listview2.Items[x].Caption then
begin
form2.Label2.Caption := 'Randum number found... Generating new one!';
randomnr := random(listview1.Items.Count);
x := 0;
form2.ProgressBar2.Position := 0;
SetWindowPos(form3.Handle, HWND_TOPMOST, 0,0,0,0, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
end
else
begin
form2.ProgressBar2.Position := form2.ProgressBar2.Position + 1;
form2.LblList2.Caption := 'Lisview2 : ' + inttostr(form2.ProgressBar2.Position) + ' out of ' + inttostr(form2.ProgressBar2.Max);
form2.Label2.Caption := 'Processing...';
x := x +1;
form2.Label10.Caption := 'Time went: ' + timetostr(now - startime); { here i show how much time has gone.}
currenttime := now - startime; {here the "Currenttime" gets updated}
timeleft := lasttime - currenttime; {here i calculate timeleft whit lasttime - currenttime. But it count upwards instead of down}
form2.label12.caption := 'Time left:' + timetostr(timeleft); {here i show timeleft}
SetWindowPos(form3.Handle, HWND_TOPMOST, 0,0,0,0, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
end;
end;
end;
form2.ProgressBar2.Position := 0;
end;
if form2.CheckBox1.Checked = false then
begin
item := listview1.Items[randomnr];
form2.image1.Picture.LoadFromFile(item.Caption);
SetWindowPos(form3.Handle, HWND_TOPMOST, 0,0,0,0, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
form2.label8.Caption := 'Size of image: ' + inttostr(getfilesize(item.Caption) div 1024) + ' KB';
form2.Label7.Caption := item.Caption;
SetWindowPos(form3.Handle, HWND_TOPMOST, 0,0,0,0, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
item := listview2.Items.Add;
item.Caption := inttostr(randomnr);
form2.ProgressBar1.Position := 0;
form2.ProgressBar2.Position := 0;
form2.Label11.Caption := 'Time for last picture: ' + timetostr(now - startime); {Here i show how long it was to calculate the last picture}
lasttime := now - startime; {here i save the time for the last image.}
if listview1.Items.Count = listview2.Items.Count then listview2.Clear;
if (checkbox5.Checked = false) and (lockdown = true) then timersec.Enabled := true;
end;
end
else
begin
i := i + 1;
item := listview1.Items[i];
form2.image1.Picture.LoadFromFile(item.Caption);
form2.label8.Caption := 'Size of image: ' + inttostr(getfilesize(item.Caption) div 1024) + ' KB';
form2.Label7.Caption := item.Caption;
end;
end;
End;
Best regards,Darkyere
Edited by WingedPanther, 10 December 2008 - 01:06 PM.
add code tags (the # button)


Sign In
Create Account


Back to top









