Delphi makes it very easy to add context sensitive menus (or mostly known as popup menus that appear on right mouse clicks!) to your application:
- Create a "New Application"
- Drop a "TPopupMenu" component on your form
- Double click on it and add necessary menu items
- Select your form and set its "PopupMenu" property to the newly created "TPopupMenu" (named "PopupMenu1" by default)
- Run your program to and right click on your form
Assuming that the name of your popup menu is "PopupMenu1," following will contain the name of the right clicked control:
NOTE: In order to get a valid control name, you must assign the popup menu to each control's "PopupMenu" property.
PopupMenu1.PopupComponent.ClassName
Source : http://www.chami.com/tips/delphi/010697D.html