diff --git a/components/lazcontrols/treefilteredit.pas b/components/lazcontrols/treefilteredit.pas index 8e1c1f7f2e..cc2f250a88 100644 --- a/components/lazcontrols/treefilteredit.pas +++ b/components/lazcontrols/treefilteredit.pas @@ -82,8 +82,8 @@ type fFirstPassedNode: TTreeNode; fOnGetImageIndex: TImageIndexEvent; fOnFilterNode: TFilterNodeEvent; - procedure SetFilteredTreeview(const AValue: TCustomTreeview); - procedure SetShowDirHierarchy(const AValue: Boolean); + procedure SetFilteredTreeview(AValue: TCustomTreeview); + procedure SetShowDirHierarchy(AValue: Boolean); function FilterTree(Node: TTreeNode): Boolean; procedure OnBeforeTreeDestroy(Sender: TObject); protected @@ -102,6 +102,7 @@ type public constructor Create(AOwner: TComponent); override; destructor Destroy; override; + procedure SetTreeFilterSilently(ATree: TCustomTreeview; AFilter: string); procedure StoreSelection; override; procedure RestoreSelection; override; function GetExistingBranch(ARootNode: TTreeNode): TTreeFilterBranch; @@ -446,7 +447,7 @@ begin FreeAndNil(fBranches); end; -procedure TTreeFilterEdit.SetFilteredTreeview(const AValue: TCustomTreeview); +procedure TTreeFilterEdit.SetFilteredTreeview(AValue: TCustomTreeview); begin if fFilteredTreeview = AValue then Exit; if fFilteredTreeview <> nil then @@ -463,7 +464,16 @@ begin end; end; -procedure TTreeFilterEdit.SetShowDirHierarchy(const AValue: Boolean); +procedure TTreeFilterEdit.SetTreeFilterSilently(ATree: TCustomTreeview; AFilter: string); +begin // The tree is already filtered, the same FilterEdit is used for many. + fAlreadyFiltered:=True; + SetFilteredTreeview(ATree); + InternalSetFilter(AFilter); + fAlreadyFiltered:=False; + Text:=AFilter; // This will trigger filtering if Text differs from AFilter. +end; + +procedure TTreeFilterEdit.SetShowDirHierarchy(AValue: Boolean); begin if fShowDirHierarchy=AValue then exit; if not Assigned(fFilteredTreeview) then diff --git a/ide/searchresultview.lfm b/ide/searchresultview.lfm index f089583a20..af16c2cd4b 100644 --- a/ide/searchresultview.lfm +++ b/ide/searchresultview.lfm @@ -10,9 +10,9 @@ object SearchResultsView: TSearchResultsView Constraints.MinHeight = 100 Constraints.MinWidth = 400 KeyPreview = True + LCLVersion = '4.99.0.0' OnCreate = Form1Create OnKeyDown = FormKeyDown - LCLVersion = '2.3.0.0' object ControlBar1: TPanel Left = 0 Height = 26 diff --git a/ide/searchresultview.pp b/ide/searchresultview.pp index 94b1e878c3..39e3af261d 100644 --- a/ide/searchresultview.pp +++ b/ide/searchresultview.pp @@ -798,8 +798,7 @@ begin lTree := GetCurrentTree; if assigned(lTree) and not (csDestroying in lTree.ComponentState) then begin - SearchInListEdit.FilteredTreeview := lTree; - SearchInListEdit.Filter := lTree.SearchInListPhrases; + SearchInListEdit.SetTreeFilterSilently(lTree, lTree.SearchInListPhrases); if FFocusTreeViewInOnChange then ActivateControl(lTree); end; diff --git a/lcl/editbtn.pas b/lcl/editbtn.pas index bb03db325f..1b5bc42a41 100644 --- a/lcl/editbtn.pas +++ b/lcl/editbtn.pas @@ -241,8 +241,9 @@ type procedure OnAsync(Data: PtrInt); function IsTextHintStored: Boolean; protected - fNeedUpdate: Boolean; + fAlreadyFiltered: Boolean; fIsFirstUpdate: Boolean; + fNeedUpdate: Boolean; fSelectedPart: TObject; // Select this node on next update fOnFilterItem: TFilterItemEvent; fOnFilterItemEx: TFilterItemExEvent; @@ -1348,6 +1349,7 @@ end; procedure TCustomControlFilterEdit.InvalidateFilter; begin + if fAlreadyFiltered then Exit; fNeedUpdate:=true; IdleConnected:=true; end;