2007. december 20., csütörtök
How to determine what control a TPopupMenu was activated for
Problem/Question/Abstract:
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:
procedure TForm1.PopupItem1Click(Sender: TObject);
begin
Label1.Caption := PopupMenu1.PopupComponent.ClassName;
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.
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése