LCL: Select a single TreeView node with RightClick also when MultiSelect is enabled. Issue #28193, patch from Ondrej Pokorny.

git-svn-id: trunk@49200 -
This commit is contained in:
juha 2015-05-29 09:04:09 +00:00
parent a9060dc0b7
commit 7abf4ba56f

View File

@ -5198,11 +5198,6 @@ begin
{$ENDIF} {$ENDIF}
fMouseDownPos := Point(X,Y); fMouseDownPos := Point(X,Y);
FStates:=FStates-[tvsEditOnMouseUp,tvsSingleSelectOnMouseUp]; FStates:=FStates-[tvsEditOnMouseUp,tvsSingleSelectOnMouseUp];
if Button=mbRight then begin
if RightClickSelect then begin
Selected:=GetNodeAt(X,Y);
end;
end;
if not Focused and CanFocus then if not Focused and CanFocus then
SetFocus; SetFocus;
@ -5214,17 +5209,19 @@ begin
and (CursorNode.Selected and (CursorNode.Selected
or ((tvoAllowMultiselect in Options) and CursorNode.MultiSelected)); or ((tvoAllowMultiselect in Options) and CursorNode.MultiSelected));
LogicalX:=X; LogicalX:=X;
if ([ssDouble, ssTriple, ssQuad] * Shift) = [] then if ((Button = mbLeft) or ((Button = mbRight) and RightClickSelect)) and
(([ssDouble, ssTriple, ssQuad] * Shift) = []) then
begin begin
// single click or first of a multi click // single click or first of a multi click
if (Button = mbLeft) and (CursorNode <> nil) then if (CursorNode <> nil) then
begin begin
if CursorNode.HasChildren and ShowButtons and if CursorNode.HasChildren and ShowButtons and
(LogicalX >= CursorNode.DisplayExpandSignLeft) and (LogicalX >= CursorNode.DisplayExpandSignLeft) and
(LogicalX < CursorNode.DisplayExpandSignRight) then (LogicalX < CursorNode.DisplayExpandSignRight) then
begin begin
// mousedown occured on expand sign -> expand/collapse // mousedown occured on expand sign -> expand/collapse only on left button
CursorNode.Expanded:=not CursorNode.Expanded; if (Button = mbLeft) then
CursorNode.Expanded:=not CursorNode.Expanded;
end end
else if LogicalX >= CursorNode.DisplayStateIconLeft then else if LogicalX >= CursorNode.DisplayStateIconLeft then
begin begin
@ -5260,7 +5257,7 @@ begin
begin begin
if not CursorNodeSelected then if not CursorNodeSelected then
Items.SelectOnlyThis(CursorNode) Items.SelectOnlyThis(CursorNode)
else else if Button = mbLeft then
Include(FStates, tvsSingleSelectOnMouseUp); Include(FStates, tvsSingleSelectOnMouseUp);
end; end;
end; end;