Hello,
In some cases, I have a range check error occuring during form creation in the VCL.TMSFNCTreeViewBase.pas unit if the form contains a TTMSFNCTreeView component.
The problematic code is TTMSFNCTreeViewBase.UpdateScrollBars, around line 1410:
else
begin
vs.PageSize := Round(Max(0, Min(h, ch)));
vs.Max := Round(Max(vs.PageSize, h));
vs.SmallChange := Round(DefaultRowHeight);
vs.LargeChange := vs.PageSize; // <- blows up here if vs.PageSize = 0
vs.Position := Min(vs.Position, vs.Max);
end;
The problem occures when "Round(Max(0, Min(h, ch)))" returns 0.
I have fixed the code this way in my source:
else
begin
vs.PageSize := Round(Max(0, Min(h, ch)));
vs.Max := Round(Max(vs.PageSize, h));
vs.SmallChange := Round(DefaultRowHeight);
vs.LargeChange := max(1,vs.PageSize);
vs.Position := Min(vs.Position, vs.Max);
end;
I'm not 100% sure it makes sense this way or if I should change Round(Max(0, Min(h, ch))) to Round(Max(1, Min(h, ch))) but it stops the range check error anyway.
Could you please integrate the fix into the main code (or, if that is the symptom of somethoing else, fix it)?
This does not alway occures but I had hi happen to me when dropping a second TTMSFNCTreeView on a form (inside a new, blank TabSheet page) and running the application without any additional change.