ralph78
asked on
easy
how to get acces on a run time created object event (with the 'create' procedure)?
for an example, the TmenuItem component
var item:TMenuItem;
begin
item:=TmenuItem.create(nil );
item.caption='test';
form1.new1.add(item);
new1 is a menuitem created at design time, and i want to get the testclick event.
thanks!
for an example, the TmenuItem component
var item:TMenuItem;
begin
item:=TmenuItem.create(nil
item.caption='test';
form1.new1.add(item);
new1 is a menuitem created at design time, and i want to get the testclick event.
thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If I understand you, you want to get the OnClick event for the TMenuItem you just created (and called 'test'), through the New1 menu item?
If so, you can do it like this:
for I := 0 to form1.new1.count - 1 do
if form1.new1.items[i].Captio n = 'test' then
form1.new1.items[i].OnClic k := DoTheClick;
Cheers,
Raymond.
If so, you can do it like this:
for I := 0 to form1.new1.count - 1 do
if form1.new1.items[i].Captio
form1.new1.items[i].OnClic
Cheers,
Raymond.
{public}
Procedure ClickItem(Sender:TObject);