ScaleRichView page scrolling

General TRichView support forum. Please post your questions here
Post Reply
DXS
Posts: 43
Joined: Fri Sep 16, 2005 10:31 am
Location: Cape Town, South Africa

ScaleRichView page scrolling

Post by DXS »

Hi Sergey (or proxy)

We use ScaleRV as a viewer (readonly & hidden caret), however WMPageScroll still attempts to reposition the caret somewhere appropriate, which is unnecessary when not being used, and can lead to list index out of bounds errors, especially when a table is involved.

I did put in a hack that avoids the issue by doing a simple scroll and exit:

begin
CurRVData := RichViewEdit.TopLevelEditor.RVData;
CurItemNo := RichViewEdit.TopLevelEditor.CurItemNo;
CurItemOffs := RichViewEdit.TopLevelEditor.OffsetInCurItem;
Key := Message.wParam;
DeltaY := round(ClientHeight * PAGESCROLLPERCENT / FViewProperty.ZoomPercent);
if (Key = VK_PRIOR) then
DeltaY := -DeltaY;

// [JT] - don't need to reposition the caret if hidden (avoid list index out of bounds errors)
if not CaretVisible then
begin
//SetVScrollPos(DeltaY);
if (Key = VK_PRIOR) then
SetVScrollPos(GetVScrollPos - (ClientHeight div RichViewEdit.VSmallStep))
else
SetVScrollPos(GetVScrollPos + (ClientHeight div RichViewEdit.VSmallStep));
Exit;
end;

LCaretPos := FRVCaretRect.BottomRight;

But it would be better if something similar is done in a future version :mrgreen:
Post Reply