However, I'm having a problem with it that I can't track down. I created a demo application that does the exact same thing as my main app, although without the overall architecture of the main app (like form inheritance and such). The demo app does not exhibit the problem.
Basically, I get a List Index Out of Bounds when SaveCellToRVF executes LoadRVFFromStream:
Code: Select all
Cell.SaveRVFToStream(Result, False, clNone, nil, nil);
Result.Position := 0;
//!!! Index Out of Bounds occurs when next line is executed!!!
rv.LoadRVFFromStream(Result);
Code: Select all
item := GetItem(ItemNo); // ItemNo is zero here
DrawItemNo := item.DrawItemNo; // item.DrawItemNo is -1 here
if item.StyleNo<0 then begin // StyleNo = 0, so this is skipped
DrawItemOffs := ItemOffs-DrawItems[DrawItemNo].Offs;
exit;
end;
//!!! Exception occurs here, because DrawItemNo = -1!!!
DrawItemOffs := ItemOffs-DrawItems[DrawItemNo].Offs+1;