Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
performing procedure onclick of array element Posted by micah on 23 Jul 2003 at 9:50 AM
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
Report
Re: performing procedure onclick of array element Posted by injektilo on 23 Jul 2003 at 12:41 PM
you can only assign a TNotifyEvent to the OnClick. if you need the number then i'd suggest you'd use the TEdit(Sender).Tag
Report
Re: performing procedure onclick of array element Posted by micah on 23 Jul 2003 at 2:02 PM
: you can only assign a TNotifyEvent to the OnClick. if you need the number then i'd suggest you'd use the TEdit(Sender).Tag
:
Can you give me an idea of how to do this?
Report
Re: performing procedure onclick of array element Posted by micah on 24 Jul 2003 at 2:13 AM
: : you can only assign a TNotifyEvent to the OnClick. if you need the number then i'd suggest you'd use the TEdit(Sender).Tag
: :
: Can you give me an idea of how to do this?
:
Actually, I got it!



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.