Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Example: Searching, Behavior.IncSearch, Behavior.IncSearchItem, Behavior.ExpandOnIncSearching, SearchingText, CancelSearching

The following sample implements the incremental search feature using code. The IncSearch method accepts the following parameters:

ASearchColumn represents the column whose values are searched.

ASearchingText provides the search string.

AExpandOnIncSearching specifies whether a collapsed node should expand if one of its child nodes contains a suitable value. The parameter defaults to True.

procedure IncSearch(ASearchColumn: TcxTreeListColumn; ASearchingText: String; AExpandOnIncSearching: Boolean = True);
begin
  cxTreeList.OptionsBehavior.IncSearch := True;
  cxTreeList.OptionsBehavior.IncSearchItem := ASearchColumn;
  cxTreeList.OptionsBehavior.ExpandOnIncSearch := AExpandOnIncSearching;
  cxTreeList.SearchingText := ASearchingText;
  repeat
    if not cxTreeList.FindNext(True) then
    begin
      cxTreeList.CancelSearching;
      Break;
    end;
  until cxTreeList.FocusedNode.Texts[ASearchColumn.ItemIndex] = ASearchingText
end;