VirtualStringTree hide node (s)

Is it possible to hide certain nodes in VirtualStringTree? I implement a filter function (VST acts like a list with columns), and I would like to avoid reloading the content every time the filter has been changed - instead, it would be much faster to tell VST not to display certain elements ... any solutions?

+3
source share
2 answers
VirtualTree.IsVisible[Node] := False;
+16
source

There is a problem using .IsVisible [] or .IsFiltered [], and it is very slow, I have a probe filter in a tree with 25,000 nodes and too slow.

aproach, Include (Node.states, vsFiltered) (Node.States, vsVisible), Node. , ( ).

, 25 000 , , , :

procedure TFC_Articulo.Filtrar(Filtro:String);
var
 Node:PVirtualNode;
 Data:PArticulo;
begin
  Node := TV.GetFirst;
  TV.RootNode.TotalHeight:=TV.DefaultNodeHeight;  // The Trick
  while Assigned(Node) do
  begin
    Data:=TV.GetNodeData(Node);
    Exclude(Node.States,vsFiltered);     // By default all nodes wil be Visible
    if ComparationHereForDetermineFiltering then
       Include(Node.States,vsFiltered)   // This node wil be filtered
    else
       Inc(TV.RootNode.TotalHeight,Node.NodeHeight);  // Determine the Height of scrollbar
    Node:=TV.GetNext(Node);
  end;
  TV.RootNode.TotalHeight:=TV.RootNode.TotalHeight+TV.BottomSpace;
  TV.UpdateScrollBars(True);
end;

, ...

+1

Source: https://habr.com/ru/post/1749274/


All Articles