I have an array whose data will be presented on TVirtualStringTree. This array is thread safe and blockable. And grew up with another thread.
My problem is that when the VST fires the OnMeasureItem event to measure the height of the node, the data used for the measurement can change when it comes to the print point of the data with the OnGetText event.
I checked the order of the events and this is not good for my design. First, it fires the OnMeasureItem event for all nodes that are not initialized, then it starts to raise OnGetText events. I mean, suppose we have 3 nodes, events will be fired in the following order:
OnMeasureItem for node 1 OnMeasureItem for node 2 OnMeasureItem for node 3 OnGetText for node 1 OnGetText for node 2 OnGetText for node 3
But I need something like this so that I can block:
OnMeasureItem for node 1 OnGetText for node 1 OnMeasureItem for node 2 OnGetText for node 2 OnMeasureItem for node 3 OnGetText for node 3
What is the best way to keep the data received between OnMeasureItem and OnGetText events synchronized?
I do not want to block my array in all OnMeasureItem () and OnGetText () events.
Thanks.
Added onTimer:
procedure TMainForm.SyncHexLog; begin HexLog.BeginUpdate; Try if (HexLog.RootNodeCount <> FirpList.ComOperationCountLagged) then begin HexLog.RootNodeCount := FirpList.ComOperationCountLagged; // measure for fast scrolling HexLog.ReInitNode(HexLog.GetLastNoInit(), True); if FAutoScroll then begin HexLog.ScrollIntoView(HexLog.GetLast, False, False); end; end; Finally HexLog.EndUpdate; End; end;
source share