var
m: TMenuItem;
navidummy: TComponent;
..........................................................
procedure TMyForm.CreatePopUpMM(Sender: TObject);
begin
Navidummy.free;
Navidummy := TComponent.create(self);
while not NaviT.EOF do
begin
m := TMenuItem.create(navidummy);
II := II + 1;
with m do
begin
name := 'MM' + IntToStr(II);
caption := NaviT.Fieldbyname('MyWHAT').AsString;
tag := NaviT.Fieldbyname('MyTAG').AsInteger;
visible := True;
OnClick := NaviExec;
end;
MyMenuItem.add(m);
NaviT.Next;
end;
NaviT.Close;
end;
procedure TMyForm.NaviExec(Sender: TObject);
begin
{ Здесь я получаю то, что хочу ! }
What.text := (Sender as TMenuItem).Caption;
Key := (Sender as TMenuItem).Tag;
end;
|