(page requirements)

What did I just right click on?

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

That was easy enough. But, the question is, once you add more components to your form, how do you determine which control your user right clicked on?

Assuming that the name of your popup menu is "PopupMenu1," following will contain the name of the right clicked control:

PopupMenu1.PopupComponent.ClassName

NOTE: In order to get a valid control name, you must assign the popup menu to each control's "PopupMenu" property.

 
 
Applicable Keywords : Components, Delphi, Delphi 1.x, Delphi 2.x, User Interface
 
 
 
Copyright © 2009 Chami.com. All Rights Reserved. | Advertise | Created in HTML Kit editor