Author: Tomas Rutkauskas
How can the event handler of a popup menu item determine which component was
right-clicked upon to activate that menu?
Answer:
Use the PopupMenu.PopupComponent property to determine what control the menu was
activated for:
1 procedure TForm1.PopupItem1Click(Sender: TObject);
2 begin3 Label1.Caption := PopupMenu1.PopupComponent.ClassName;
4 end;
The form's ActiveControl property can also be used, however, the active control may not necessarily be the control that caused the popup menu to appear.