In SclRView SetCurPage(PageNo : Integer)
Line# 8297
If you click on the page in SRVPageScroll1 (in the left bar) and nothing is loaded into the document, it GPFs.
You need to add a check:
if (DrawItemNo < 0) then exit;
after getting DrawItemNo and before looking up DrawItems[DrawItemNo]
eg:
if (checkRealTimeMode) or (PageNo < 1) or (PageNo > FPageCount) then exit;
DrawItemNo := PageStartDrawItemNo[PageNo - 1];
if (DrawItemNo < 0) then exit;
ItemNo := FRichViewEdit.RVData.DrawItems[DrawItemNo].ItemNo;
. . .
Same thing in Item2DrawItem (and probably several other places)
I'm trying to load a file into my app. It is loading into RVE, but for some reason it's not displaying. Something in my code is probably clearing things after it gets loaded. In any case, stuff isn't in a clean state, and there's one thing that's trying to select an item in the RVE that doesn't exist. So it's getting these errors that normally wouldn't be arising.
-David
bug and fix
replace:
Code: Select all
procedure TSRichViewEdit.SetCurPage(PageNo : Integer);
Var
ItemNo, Offs, DrawItemNo : Integer;
Item: TRVTableItemInfo;
begin
if (checkRealTimeMode) or (PageNo < 1) or (PageNo > FPageCount) then
exit;
DrawItemNo := PageStartDrawItemNo[PageNo - 1];
if (DrawItemNo < 0) or
(DrawItemNo > FRichViewEdit.RVData.DrawItems.Count) then
exit;
ItemNo := FRichViewEdit.RVData.DrawItems[DrawItemNo].ItemNo;
Offs := FRichViewEdit.RVData.DrawItems[DrawItemNo].Offs;
VScrollPos := Round(RectPage(PageNo).Top - OffsetY) div FRichViewEdit.VSmallStep;
if (PageStartTableItem[PageNo - 1] >= 0) then
begin
Item := TRVTableItemInfo(FRichViewEdit.RVData.GetItem(PageStartTableItem[PageNo - 1]));
Item.Cells[PageStartTableRow[PageNo - 1], 0].Edit;
end
else
RichViewEdit.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);
Update;
end;