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 VirtualTreeView→CacheThreshold 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;