954,176 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Assigning event

i create an array of panels
var bt:array[1..3,1..2] of TPanel;

so i go in Form1.FormCreate and i write:

for i:=1 to 3 do
for j:=1 to 2 do
begin
bt[i, j]:=TPanel.Create(self);
bt[i, j].Parent:=self;
bt[i, j].OnCLick:=????????????????????????????????;
end;

i created a procedure TForm1.press(x,y:integer) what should do the OnClick and i wrote in Form1.FormCreate
bt[i,j].OnClick:=TForm1.press(j,i)
but i get only error

some 1 pls tell me what i have to do!!!

Tepes
Newbie Poster
6 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

What was the error message?

I believe that TPanel.OnClick requires a TNotifyEvent. This basically means that your procedure must follow this syntax:

procedure (Sender: TObject) of object;

Example:

procedure Press(Sender: TObject);

Then, you can do the following:

OnClick := Press;

neverwinter
Newbie Poster
6 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You