mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 06:39:26 +02:00
LCL: Implement also msSiblingOnly and msVisibleOnly for TTreeView.MultiSelectStyle. Issue #18043, patch from AlexeyT.
git-svn-id: trunk@54188 -
This commit is contained in:
parent
55b51f1788
commit
07e44579a9
@ -2695,11 +2695,46 @@ begin
|
||||
end;
|
||||
|
||||
procedure TTreeNodes.MultiSelect(Node: TTreeNode; ClearWholeSelection: Boolean);
|
||||
var
|
||||
bGoNext, bOnlySiblings, bOnlyVisible: Boolean;
|
||||
//
|
||||
procedure _TakeNext(var N: TTreeNode);
|
||||
begin
|
||||
if bGoNext then
|
||||
begin
|
||||
if bOnlySiblings and bOnlyVisible then
|
||||
N := N.GetNextVisibleSibling
|
||||
else
|
||||
if bOnlySiblings and not bOnlyVisible then
|
||||
N := N.GetNextSibling
|
||||
else
|
||||
if not bOnlySiblings and bOnlyVisible then
|
||||
N := N.GetNextVisible
|
||||
else
|
||||
N := N.GetNext;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if bOnlySiblings and bOnlyVisible then
|
||||
N := N.GetPrevVisibleSibling
|
||||
else
|
||||
if bOnlySiblings and not bOnlyVisible then
|
||||
N := N.GetPrevSibling
|
||||
else
|
||||
if not bOnlySiblings and bOnlyVisible then
|
||||
N := N.GetPrevVisible
|
||||
else
|
||||
N := N.GetPrev;
|
||||
end;
|
||||
end;
|
||||
//
|
||||
var
|
||||
I, FirstNode, LastNode: TTreeNode;
|
||||
GetNext: Boolean;
|
||||
begin
|
||||
if Owner<>nil then Owner.LockSelectionChangeEvent;
|
||||
bOnlySiblings := Assigned(Owner) and (msSiblingOnly in Owner.MultiSelectStyle);
|
||||
bOnlyVisible := Assigned(Owner) and (msVisibleOnly in Owner.MultiSelectStyle);
|
||||
|
||||
try
|
||||
if FStartMultiSelected=nil then
|
||||
begin
|
||||
@ -2717,15 +2752,12 @@ begin
|
||||
if Assigned(FLastMultiSelected) then
|
||||
begin
|
||||
LastNode := FLastMultiSelected;
|
||||
GetNext := (FirstNode.Index <= LastNode.Index);
|
||||
bGoNext := (FirstNode.Index <= LastNode.Index);
|
||||
I := FirstNode;
|
||||
I.MultiSelected:=False;
|
||||
while (I<>LastNode) do
|
||||
begin
|
||||
if GetNext then
|
||||
I:=I.GetNextSibling
|
||||
else
|
||||
I:=I.GetPrevSibling;
|
||||
_TakeNext(I);
|
||||
if I=nil then Break;
|
||||
I.MultiSelected:=False;
|
||||
end;
|
||||
@ -2735,15 +2767,12 @@ begin
|
||||
end;
|
||||
|
||||
//select again
|
||||
GetNext := (FirstNode.Index <= Node.Index);
|
||||
bGoNext := (FirstNode.Index <= Node.Index);
|
||||
I := FirstNode;
|
||||
I.Selected:=True;
|
||||
while (I<>Node) do
|
||||
begin
|
||||
if GetNext then
|
||||
I:=I.GetNextSibling
|
||||
else
|
||||
I:=I.GetPrevSibling;
|
||||
_TakeNext(I);
|
||||
if I=nil then Break;
|
||||
I.Selected:=True;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user