0

I read texts about hiding and showing nodes for filtering purposes, but if we set more than 2000 row to make node visible/invisible,

After this amount of row when we try to insert ChildNode to the top, it adds node to the bottom and no node shown in this line.

I looked at the code of VirtualTreeViewCacheThreshold mentioned in code as init value 2000?

You can reproduce error if you add Nodes to the first by function

Node := PGrid.InsertNode(nil, amAddChildFirst);

you can add lots of rows whenever you want.

But when you set all these rows to visible after this operation,

PGrid.IsVisible[Node] := True

attempting to insert further root nodes (root=nil always) will be added to the bottom and such as invisible node if node count reaches greater than CacheThreshold.

Only white blank area shown for added this early childs...at the bottom of tree?

Also, for this blank white area, OnGetText, OnPaint events are not triggered?

I tried to increase CacheThreshold, then it is OK to these incermented number of amount but after greater number same problem occurs.

[EDITED]

If I use code as below it works fine, but it cost more CPU usage,

  PGrid.BeginUpdate;
  try
    Node := PGrid.InsertNode(nil, amAddChildFirst);
    Data := PGrid.GetNodeData(Node);
    Data.P := RowInformer;
    RowInformer.pNode := Node;
  finally
    Pgrid.EndUpdate;
  end;

  RowInformer.NodeisVisible;
  RowInformer.InvalidateRow;

But If I use code as below it works for awhile , and then goes unstable after 2000 (default cachethreshold), I add nodes to the top, but after 2000 adding , it starts adding to the bottom and nodes become invisible but have volume as a row with only blank white area.. I want to use code as blow to update only concerned row, but it is problematic after 2000 NodeisVisible() function call

Node := PGrid.InsertNode(nil, amAddChildFirst);
Data := PGrid.GetNodeData(Node);
Data.P := RowInformer;
RowInformer.pNode := Node;
if RowInformer.NodeisVisible then
  begin
      if PGrid.FullyVisible[Node] then
        PGrid.InvalidateNode( Node );
  end;

NodeisVisibleFunction is:

begin
  Result := True;
  try
        with OwnerGridTable do
        begin
            Result := Result and  Filter_Account.GetFilterResult(PItem.P040_AccountID.AsInteger);
            Result := Result and  Filter_SymbolID.GetFilterResult(PItem.P030_SymbolID.AsInteger);
            Result := Result and  Filter_OrderStatus.GetFilterResult(PItem.P060_OrderStatus.AsOrderStatus);
        end;


  finally

    if Result then
     begin
       if not (vsVisible in pNode.States) then
         OwnerGridTable.PGrid.IsVisible[pNode] := True;
     end
     else
     begin
         if (vsVisible in pNode.States) then
         OwnerGridTable.PGrid.IsVisible[pNode] :=  False;
     end;


  end;
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
  • At the point of 2000, is your CPU maxxed? – Simon Mar 06 '12 at 13:09
  • You may want to read http://stackoverflow.com/questions/7165405/how-can-i-hide-a-tvirtualstringtree-node to ensure node visibility is being controlled correctiy. Also show GetFilterResult code - this could be causing the issue – Simon Mar 06 '12 at 13:19
  • What version of VirtualTreeView are you using ? – TLama Mar 08 '12 at 10:21
  • @Simon CPU usage gets little more if I does not use second code.. But I want to use CPU max at %1 totally in my application.. I discovered all performanced usage of TVirtualstringtree, But I have encountered with this problem.. GetFilterResult returns only True or False, and does not make any calculation in it.. Only makes logical opearitons in it.. has No interaction with virtualstringtree – Nihat Erim inceoğlu Mar 08 '12 at 10:21
  • @TLama , I am using 4.8.7 for XE – Nihat Erim inceoğlu Mar 08 '12 at 10:23

0 Answers0