mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-01 00:47:15 +01:00
LCL: Never trigger click events on TreeView's fold-arrow. Issue #37051, patch from CudaText man.
git-svn-id: trunk@63171 -
This commit is contained in:
parent
5b86ef8e6d
commit
257f95ec97
@ -3341,6 +3341,7 @@ type
|
|||||||
FMaxRight: integer; // maximum text width of all nodes (needed for horizontal scrolling)
|
FMaxRight: integer; // maximum text width of all nodes (needed for horizontal scrolling)
|
||||||
FMouseDownPos: TPoint;
|
FMouseDownPos: TPoint;
|
||||||
FMouseDownNodeSelected: Boolean;
|
FMouseDownNodeSelected: Boolean;
|
||||||
|
FMouseDownOnFoldingSign: Boolean;
|
||||||
FMultiSelectStyle: TMultiSelectStyle;
|
FMultiSelectStyle: TMultiSelectStyle;
|
||||||
FHotTrackColor: TColor;
|
FHotTrackColor: TColor;
|
||||||
FDisabledFontColor: TColor;
|
FDisabledFontColor: TColor;
|
||||||
@ -3520,8 +3521,8 @@ type
|
|||||||
procedure CreateWnd; override;
|
procedure CreateWnd; override;
|
||||||
procedure Click; override;
|
procedure Click; override;
|
||||||
procedure DblClick; override;
|
procedure DblClick; override;
|
||||||
//procedure TripleClick; override; - Are these needed?
|
procedure TripleClick; override;
|
||||||
//procedure QuadClick; override;
|
procedure QuadClick; override;
|
||||||
procedure Delete(Node: TTreeNode); virtual;
|
procedure Delete(Node: TTreeNode); virtual;
|
||||||
procedure DestroyWnd; override;
|
procedure DestroyWnd; override;
|
||||||
procedure DoCreateNodeClass(var NewNodeClass: TTreeNodeClass); virtual;
|
procedure DoCreateNodeClass(var NewNodeClass: TTreeNodeClass); virtual;
|
||||||
|
|||||||
@ -3317,13 +3317,25 @@ end;
|
|||||||
|
|
||||||
procedure TCustomTreeView.Click;
|
procedure TCustomTreeView.Click;
|
||||||
begin
|
begin
|
||||||
if FMouseDownNodeSelected then
|
if not FMouseDownOnFoldingSign then
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomTreeView.DblClick;
|
procedure TCustomTreeView.DblClick;
|
||||||
begin
|
begin
|
||||||
if FMouseDownNodeSelected then
|
if not FMouseDownOnFoldingSign then
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomTreeView.TripleClick;
|
||||||
|
begin
|
||||||
|
if not FMouseDownOnFoldingSign then
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomTreeView.QuadClick;
|
||||||
|
begin
|
||||||
|
if not FMouseDownOnFoldingSign then
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5566,7 +5578,7 @@ function TCustomTreeView.MouseDownNode(X, Y: Integer): TTreeNode;
|
|||||||
begin
|
begin
|
||||||
Result := GetNodeAt(X, Y);
|
Result := GetNodeAt(X, Y);
|
||||||
// Update the NodeSelected flag.
|
// Update the NodeSelected flag.
|
||||||
FMouseDownNodeSelected := (Result<>nil) and
|
FMouseDownNodeSelected := Assigned(Result) and
|
||||||
(Result.Selected or ((tvoAllowMultiselect in Options) and Result.MultiSelected));
|
(Result.Selected or ((tvoAllowMultiselect in Options) and Result.MultiSelected));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5608,18 +5620,20 @@ begin
|
|||||||
//CursorNode must be reassigned again - e.g. in OnMouseDown the node can be deleted or moved.
|
//CursorNode must be reassigned again - e.g. in OnMouseDown the node can be deleted or moved.
|
||||||
CursorNode := MouseDownNode(X, Y);
|
CursorNode := MouseDownNode(X, Y);
|
||||||
|
|
||||||
|
//Flag is used for DblClick/TripleClick/QuadClick, so set it before testing ShiftState
|
||||||
|
FMouseDownOnFoldingSign :=
|
||||||
|
Assigned(CursorNode) and CursorNode.HasChildren and ShowButtons and
|
||||||
|
(LogicalX >= CursorNode.DisplayExpandSignLeft) and
|
||||||
|
(LogicalX < CursorNode.DisplayExpandSignRight);
|
||||||
|
|
||||||
//change selection on left click
|
//change selection on left click
|
||||||
if (Button = mbLeft) and//left click
|
if (Button = mbLeft) and//left click
|
||||||
(([ssDouble, ssTriple, ssQuad] * Shift) = []) and//single or first of a multi click
|
(([ssDouble, ssTriple, ssQuad] * Shift) = []) and//single or first of a multi click
|
||||||
(CursorNode <> nil) then
|
(CursorNode <> nil) then
|
||||||
begin
|
begin
|
||||||
if CursorNode.HasChildren and ShowButtons and
|
if FMouseDownOnFoldingSign then
|
||||||
(LogicalX >= CursorNode.DisplayExpandSignLeft) and
|
|
||||||
(LogicalX < CursorNode.DisplayExpandSignRight) then
|
|
||||||
begin
|
|
||||||
// mousedown occured on expand sign -> expand/collapse
|
// mousedown occured on expand sign -> expand/collapse
|
||||||
CursorNode.Expanded := not CursorNode.Expanded;
|
CursorNode.Expanded := not CursorNode.Expanded
|
||||||
end
|
|
||||||
else if LogicalX >= CursorNode.DisplayStateIconLeft then
|
else if LogicalX >= CursorNode.DisplayStateIconLeft then
|
||||||
begin
|
begin
|
||||||
// mousedown occured in text or icon -> select node and begin drag operation
|
// mousedown occured in text or icon -> select node and begin drag operation
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user