Author: Jonas Bilinkevicius
I have a popup menu assigned to a TListView. I'm trying to get the ListItem where
the right click occured. I can not get the coords where the popup click happened
due to the fact that PopupMenu.PopupPoint is protected.
Answer:
1 type2 TCrackPopupMenu = class(TPopupMenu)
3 end;
4 5 procedure TForm1.PopupMenu1Popup(Sender: TObject);
6 var7 pt: TPoint;
8 begin9 pt := TCrackPopupMenu(PopupMenu1).PopupPoint;
10 Label1.Caption := Format('Popped up at: X = %d, Y = %d', [pt.x, pt.y]);
11 end;
By the way, PopupPoint returns screen coordinates.