LazControls: Use the new OnFilterItemEx also for TreeFilterEdit.

git-svn-id: trunk@51866 -
This commit is contained in:
juha 2016-03-08 21:05:58 +00:00
parent 919198e297
commit d658049401
2 changed files with 9 additions and 4 deletions

View File

@ -154,6 +154,7 @@ begin
else else
EndInd := 0; EndInd := 0;
for i := 0 to EndInd do begin for i := 0 to EndInd do begin
// ToDo: Use OnFilterItemEx event.
Result := Pos(FilterLC,UTF8LowerCase(aData[i]))>0; Result := Pos(FilterLC,UTF8LowerCase(aData[i]))>0;
if Result then if Result then
Exit; Exit;

View File

@ -475,12 +475,16 @@ begin
FilterLC:=UTF8LowerCase(Filter); FilterLC:=UTF8LowerCase(Filter);
while Node<>nil do while Node<>nil do
begin begin
// Call OnFilterItem handler. // Filter with event handler if there is one.
if Assigned(OnFilterItem) then if Assigned(fOnFilterItemEx) then
Pass:=OnFilterItem(TObject(Node.Data), Done) Pass:=fOnFilterItemEx(Node.Text, TObject(Node.Data), Done)
else else
Pass:=False; Pass:=False;
// Filter by item's title text if needed. // Support also the old filter event without a caption.
if (not (Pass and Done)) and Assigned(fOnFilterItem) then
Pass:=fOnFilterItem(TObject(Node.Data), Done);
// Filter by item's caption text if needed.
if not (Pass or Done) then if not (Pass or Done) then
Pass:=(FilterLC='') or (Pos(FilterLC,UTF8LowerCase(Node.Text))>0); Pass:=(FilterLC='') or (Pos(FilterLC,UTF8LowerCase(Node.Text))>0);
if Pass and (fFirstPassedNode=Nil) then if Pass and (fFirstPassedNode=Nil) then