I learned how to use TVirtualStringTree and I found it to be excellent. I have one custom PackedList non-visual list that is populated by another thread. And I want to show the entire list of content in TVirtualStringTree in real time. So I put one timer on mainform to update HexLog (which is TVirtualStringTree) RootNodeCount every 500 ms.
All my data appears on VirtualStringTree, and I have no speed problem, very nice. But there is one problem with the vertical scrollbar. When I press Ctrl + End on a control to go to the end of the list, it goes somewhere in the middle. Similarly, when I drag the scroll bar to the end, it does not end. But HexLog knows the DataCount. Why is it not coming to an end? If I press a couple of times to Ctrl + END, it will go to the end.
In internal timer mode, I want to say HexLog to go to the end of the list by code. How to do this and how to handle the vertical scrollbar correctly?
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) +
The recommended answer from TLama is not working properly, see image for explanation:
See this link for a detailed explanation of the image: http://i43.tinypic.com/1445thi.png
source share