Switching to the next page when end of page has been reached
Posted: Tue Jul 02, 2013 12:41 pm
I would like TRichViewEdit control automatically switch to next page when the end of page has been reached. How can I do this ?
Support forums for TRichView, ScaleRichView, Report Workshop and RVMedia components
https://textally.com/forums/
Code: Select all
TRVPrintPreview = class(TCustomRVPrintPreview)
private
FVScrollDownAgain: Integer;
FVScrollUpAgain: Integer;
...
protected
...
{$IFDEF RICHVIEWDEF4}
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
{$ENDIF}
...
constructor TRVPrintPreview.Create(AOwner: TComponent);
begin
inherited;
FCachePageImage := False;
FVScrollUpAgain := 0;
FVScrollDownAgain := 0;
end;
function TRVPrintPreview.DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean;
begin
Result := inherited DoMouseWheelDown(Shift, MousePos);
FVScrollUpAgain := 0;
if Result and (VScrollPos = VScrollMax) then
begin
if (FVScrollDownAgain > 3) and (PageNo < GetPageCount()) then
begin
FVScrollDownAgain := 0;
VScrollPos := 0;
Next;
end;
Inc(FVScrollDownAgain);
end;
end;
function TRVPrintPreview.DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean;
begin
Result := inherited DoMouseWheelUp(Shift, MousePos);
FVScrollDownAgain := 0;
if Result and (VScrollPos = 0) then
begin
if (FVScrollUpAgain > 3) and (PageNo > 1) then
begin
FVScrollUpAgain := 0;
VScrollPos := VScrollMax;
Prev;
end;
Inc(FVScrollUpAgain);
end;
end;