Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

performing procedure onclick of array element

micahmicah Posts: 4Member
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

Comments

Sign In or Register to comment.