I have learned how to use TVirtualStringTree, and I've found it excellent. I have one custom non-visual list called PackedList which is filled by another thread. And I want to show all list content in TVirtualStringTree at realtime. So I put one timer on the mainform to update HexLog's (which is TVirtualStringTree) RootNodeCount every 500ms.
All my data appears on the VirtualStringTree, and I don't have any speed problem, very nice. But there is one problem with Vertical Scroll bar. When I press Ctrl+End on the control in order to jump to the end of the list, it goes somewhere on the middle. Similarly when I drag scroll bar to the end, it doesn't go to the end. But HexLog knows the DataCount. Why doesn't it jump to the end? If I press couple of times to Ctrl+END then it reaches to the end.
Inside timer routine, I want to say HexLog to jump to the end of the list by code. How can I do this and How to handle vertical scroll bar properly?
procedure TMainForm.StatusUpdateTimerTimer(Sender: TObject);
begin
if (FirpList.ComOperationCount > 0) and (PacketList.Items.Count <> FirpList.ComOperationCount) then
begin
HexLog.RootNodeCount := PacketList.Items.Count;
end;
end;
procedure TMainForm.HexLogMeasureItem(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; Node: PVirtualNode; var NodeHeight: Integer);
begin
if Sender.MultiLine[Node] then
begin
TargetCanvas.Font := Sender.Font;
NodeHeight := HexLog.ComputeNodeHeight(TargetCanvas, Node, 1, FirpList.ComOperations[Node^.Parent^.Index].DataAsHexString(FAppSettings.HexLogColumnCharWidth) + #13#10);
end;
end;
Suggested reply by TLama is not working properly, see the image for explanation:
See that link for detailed image explanation: http://i43.tinypic.com/1445thi.png