Vcl.Controls.TControl.OnContextPopup
Delphi
property OnContextPopup: TContextPopupEvent read FOnContextPopup write FOnContextPopup;
C++
__property TContextPopupEvent OnContextPopup = {read=FOnContextPopup, write=FOnContextPopup};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
event | protected | Vcl.Controls.pas Vcl.Controls.hpp |
Vcl.Controls | TControl |
Description
Occurs when the user right-clicks the control or otherwise invokes the pop-up menu (such as using the keyboard).
The OnContextPopup event handler is called when the user utilizes the mouse or keyboard to request a pop-up menu. The OnContextPopup event is generated by a WM_CONTEXTMENU message, which is itself generated by the user clicking the right mouse button or by pressing SHIFT+F10 or the Applications key.
This event is especially useful when the control does not have an associated pop-up menu (the PopupMenu property is not set) or if the AutoPopup property of the control's associated pop-up menu is False. However, the OnContextPopup can also be used to override the automatic context menu that appears when the control has an associated pop-up menu with an AutoPopup
property of True. In this last case, if the event handler displays its own menu, it should set the Handled
parameter to True to suppress the default context menu.
The handler's MousePos
parameter indicates the position of the mouse, in client coordinates. If the event was not generated by a mouse click, MousePos
is (-1,-1).
Handled
to True in an OnContextPopup event handler, the event handler may be called multiple times for each context menu invocation.OnContextPopup is an event handler of type Vcl.Controls.TContextPopupEvent.