Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to define OnClick event for dinamically created objects?

Status
Not open for further replies.

Delphard

Programmer
Jul 22, 2004
144
RS
I have:
<code>
for j := ...
...
CategoryButtons1.Categories.Items[j].Items.Insert(k);
CategoryButtons1.Categories.Items[j].Itemsk].OnClick :=
MyOnClickProcedure;
...
</code>


And, in declaration section of Unit:
<code>
procedure MyOnClickProcedure(Sender: TButtonItem);
</code>

What is missing?
I get message:
[Error] Unit60.pas(835): E2010 Incompatible types: 'TObject' and 'TButtonItem'
 
your onclick procedure must be like this :

procedure MyOnClickProcedure(Sender: TObject);

--------------------------------------
What You See Is What You Get
 
Yes, that's one of the causes.
Second is that I forgot to add:
Code:
[COLOR=red][u]Form1[/u][/color].MyOnClickProcedure(Sender: TObject);

Thanks whosrdaddy!
 
I would like to say:
Code:
[COLOR=red][u]TForm1[/u][/color].MyOnClickProcedure(Sender: TObject);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top