TreeFilter: fix moving up and down when tree has multiselect enabled.

git-svn-id: trunk@34466 -
This commit is contained in:
juha 2011-12-28 09:39:59 +00:00
parent 633f92bf41
commit e762c4e425
4 changed files with 48 additions and 26 deletions

View File

@ -5,7 +5,7 @@
<Name Value="LazControls"/> <Name Value="LazControls"/>
<AddToProjectUsesSection Value="True"/> <AddToProjectUsesSection Value="True"/>
<CompilerOptions> <CompilerOptions>
<Version Value="10"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<SearchPaths> <SearchPaths>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>

View File

@ -422,31 +422,13 @@ begin
end; end;
procedure TTreeFilterEdit.MoveNext; procedure TTreeFilterEdit.MoveNext;
var
tn: TTreeNode;
begin begin
tn := fFilteredTreeview.Selected; fFilteredTreeview.MoveToNextNode;
if not Assigned(tn) then
begin
tn := fFilteredTreeview.TopItem;
if Assigned(tn) then
fFilteredTreeview.Selected := tn;
Exit;
end;
tn := tn.GetNext;
if Assigned(tn) then
fFilteredTreeview.Selected := tn;
end; end;
procedure TTreeFilterEdit.MovePrev; procedure TTreeFilterEdit.MovePrev;
var
tn: TTreeNode;
begin begin
tn := fFilteredTreeview.Selected; fFilteredTreeview.MoveToPrevNode;
if not Assigned(tn) then Exit;
tn := tn.GetPrev;
if Assigned(tn) then
fFilteredTreeview.Selected := tn;
end; end;
end. end.

View File

@ -2914,6 +2914,8 @@ type
function GetLastMultiSelected: TTreeNode; function GetLastMultiSelected: TTreeNode;
function SelectionVisible: boolean; function SelectionVisible: boolean;
procedure MakeSelectionVisible; procedure MakeSelectionVisible;
procedure MoveToNextNode;
procedure MoveToPrevNode;
public public
property BackgroundColor: TColor property BackgroundColor: TColor
read FBackgroundColor write SetBackgroundColor default clWindow; read FBackgroundColor write SetBackgroundColor default clWindow;

View File

@ -3332,6 +3332,14 @@ begin
end; end;
end; end;
procedure TCustomTreeView.SetSeparatorColor(const AValue: TColor);
begin
if fSeparatorColor=AValue then exit;
fSeparatorColor:=AValue;
if tvoShowSeparators in Options then
Invalidate;
end;
procedure TCustomTreeView.SetShowButton(Value: Boolean); procedure TCustomTreeView.SetShowButton(Value: Boolean);
begin begin
if ShowButtons <> Value then begin if ShowButtons <> Value then begin
@ -5435,12 +5443,42 @@ begin
ANode.MakeVisible; ANode.MakeVisible;
end; end;
procedure TCustomTreeView.SetSeparatorColor(const AValue: TColor); procedure TCustomTreeView.MoveToNextNode;
var
lNode: TTreeNode;
begin begin
if fSeparatorColor=AValue then exit; if tvoAllowMultiSelect in FOptions then
fSeparatorColor:=AValue; lNode := FTreeNodes.FLastMultiSelected
if tvoShowSeparators in Options then else
Invalidate; lNode := Selected;
if lNode <> nil then
lNode := lNode.GetNextExpanded
else if Items.Count > 0 then
lNode := FTreeNodes.GetFirstNode;
if lNode <> nil then
if tvoAllowMultiSelect in FOptions then
FTreeNodes.SelectOnlyThis(lNode)
else
Selected := lNode;
end;
procedure TCustomTreeView.MoveToPrevNode;
var
lNode: TTreeNode;
begin
if tvoAllowMultiSelect in FOptions then
lNode := FTreeNodes.FLastMultiSelected
else
lNode := Selected;
if lNode <> nil then
lNode := lNode.GetPrevExpanded
else if Items.Count > 0 then
lNode := Items.GetLastExpandedSubNode;
if lNode <> nil then
if tvoAllowMultiSelect in FOptions then
FTreeNodes.SelectOnlyThis(lNode)
else
Selected := lNode;
end; end;
// back to comctrls.pp // back to comctrls.pp