Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TForm1.Button1Click(Sender: TObject);
- var
- Index: Integer;
- CurPos: TPoint;
- NewItem: TMenuItem;
- begin
- NewItem := TMenuItem.Create(PopupMenu1);
- Index := PopupMenu1.Items.Count;
- PopupMenu1.Items.Add(NewItem);
- NewItem.Caption := 'Menu Item ' + IntToStr(Index);
- NewItem.Tag := Index;
- NewItem.OnClick := PopupMenuItemsClick;
- // store the current screen relative cursor position
- CurPos := Mouse.CursorPos;
- // invoke the menu to popup at the stored screen position
- PopupMenu1.Popup(CurPos.X, CurPos.Y);
- end;
Advertisement
Add Comment
Please, Sign In to add comment