hi im trying to create a popup menu on runtime.I have the following code that creates the menu items.
for x:=0 to opcoes.Memo2.Lines.Count do
begin
combobox1.Items.Add(opcoes.Memo2.lines.Strings[x]);
NewItem.Caption :=opcoes.Memo2.lines.Strings[x];
pop.Items.Add(NewItem);
newitem.OnClick:=newitemclick;
end;
so far just fine.
On the event onclick that i created newitemclick is:
procedure TNavegain.newitemClick(sender:Tobject);
begin
dm.ComprasinQ.Close;
dm.ComprasinQ.SQL.Clear;
dm.ComprasinQ.SQL.Add('select * from invernomarfel');
dm.ComprasinQ.SQL.Add('where tipo=
1');
dm.ComprasinQ.Params.ParamByName('p1').Value:=newitem.Caption;
dm.ComprasinQ.Open;
end;
the problem is that in newitem.caption i have always '' and not the name of the menu.
Thanks.
for x:=0 to opcoes.Memo2.Lines.Count do
begin
combobox1.Items.Add(opcoes.Memo2.lines.Strings[x]);
NewItem.Caption :=opcoes.Memo2.lines.Strings[x];
pop.Items.Add(NewItem);
newitem.OnClick:=newitemclick;
end;
so far just fine.
On the event onclick that i created newitemclick is:
procedure TNavegain.newitemClick(sender:Tobject);
begin
dm.ComprasinQ.Close;
dm.ComprasinQ.SQL.Clear;
dm.ComprasinQ.SQL.Add('select * from invernomarfel');
dm.ComprasinQ.SQL.Add('where tipo=
dm.ComprasinQ.Params.ParamByName('p1').Value:=newitem.Caption;
dm.ComprasinQ.Open;
end;
the problem is that in newitem.caption i have always '' and not the name of the menu.
Thanks.