Hi,
I have a for loop that creates a series of labels, captioned with the file name of a series of files. When each is clicked, I want it to perform the procedure LoadEntry(I), where I is the integer value of the entry no to load. My procedure LoadEntry works fine, but there is an error in the code below
//print a list of the last 20 entries
for I := 1 to StrToInt(latestentry()) do
begin
if (I > 20) then
break;
entryno:=StrToInt(latestentry())-I+1;
LabelArray[I] := TLabel.Create(Self);
LabelArray[I].Parent := Self;
LabelArray[I].Left := 408;
LabelArray[I].Top := 136 + 15 * I;
LabelArray[I].OnClick:=LoadEntry(entryno);
fileurl := 'entries/'+IntToStr(entryno)+'.jnl';
LabelArray[I].Caption := 'Entry #'+IntToStr(entryno)+': '+DateTimeToStr(FileDateToDateTime(FileAge(fileurl)));;
end;
The error is in the line with the onClick handler. Any ideas?
Many thanks,
Micah