[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'ComCtrls' (#lcl)

TCustomTreeView.MouseDown

Handles mouse down events for the tree view control.

Declaration

Source position: comctrls.pp line 3601

protected procedure TCustomTreeView.MouseDown(

  Button: TMouseButton;

  Shift: TShiftState;

  X: Integer;

  Y: Integer

); override;

Arguments

Button

  

Mouse button for the event.

Shift

  

Shift, Ctrl, or Alt modifier for the mouse event.

X

  

Horizontal coordinate for the mouse event.

Y

  

Vertical coordinate for the mouse event.

Description

MouseDown is an overridden method in TCustomTreeView used to handle mouse down events in the control.

Button identifies the mouse button for the event.

Shift contains the Shift, Alt, or Ctrl modifier for the mouse event.

X and Y contain the coordinates for the mouse event.

MouseDown updates the States property to remove the values tvsEditOnMouseUp and tvsSingleSelectOnMouseUp.

The tree node for the mouse event is retrieved using GetNodeAt for the mouse coordinates. The Selected state for the tree node is saved so the selection can be restored prior to exit.

MouseDown ensures that both Left and Right mouse button events are handled (when needed). When RightClickSelect is True, the Selection can be changed using the Right mouse button. Otherwise, it is ignored. Multi-selection is handled when the Shift modifier is set for the mouse event.

A mouse event on an unused space in the control causes ClearSelection to be called when RowSelect is True. Selected is set to Nil if RowSelect is False.

When MultiSelect has not been enabled, the selected tree node is assigned to the Selected property. When it has been enabled, the MultiSelect method in Items is used to include the selected tree node in the Selections property. ClearSelection is called if the tree node was de-selected by the mouse event. Selected is set to Nil if the tree node was de-selected by the mouse event.

The control is Focused (when needed and allowed) by calling the SetFocus method.

Mouse events in the Expand or Collapse indicator causes the Expanded state for the tree node to be toggled. When RowSelect is enabled, the MouseUp event causes the editor to be activated for the node.

MouseDown calls the inherited method to handle drag messages or close the editor for the control.

See also

TControl.MouseDown

  

Handles a mouse down event for the control.


Version 3.2 Generated 2024-02-25 Home