Vcl.ComCtrls.TTreeView.OnContextPopup

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnContextPopup;

C++

__property OnContextPopup;

Properties

Type Visibility Source Unit Parent
event published
Vcl.ComCtrls.pas
Vcl.ComCtrls.hpp
Vcl.ComCtrls TTreeView

Description

Occurs when the user right-clicks the control or otherwise invokes the pop-up menu (such as using the keyboard).

Vcl.ComCtrls.TTreeView.OnContextPopup inherits from Vcl.Controls.TControl.OnContextPopup. All content below this line refers to Vcl.Controls.TControl.OnContextPopup.

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).

Note: Parent controls receive an OnContextPopup event before their child controls. In addition, for many child controls, the default window procedure causes the parent control to receive an OnContextPopup event after the child control. As a result, when parent controls do not set 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.

See Also