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; |
[001318]