TLama

Untitled

Jul 6th, 2013
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.54 KB | None | 0 0
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   Index: Integer;
  4.   CurPos: TPoint;
  5.   NewItem: TMenuItem;
  6. begin
  7.   NewItem := TMenuItem.Create(PopupMenu1);
  8.   Index := PopupMenu1.Items.Count;
  9.   PopupMenu1.Items.Add(NewItem);
  10.   NewItem.Caption := 'Menu Item ' + IntToStr(Index);
  11.   NewItem.Tag := Index;
  12.   NewItem.OnClick := PopupMenuItemsClick;
  13.   // store the current screen relative cursor position
  14.   CurPos := Mouse.CursorPos;
  15.   // invoke the menu to popup at the stored screen position
  16.   PopupMenu1.Popup(CurPos.X, CurPos.Y);
  17. end;
Advertisement
Add Comment
Please, Sign In to add comment