Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

Mouse Wheel on TppViewer - Scrolling Reports and Moving Forward Page Numbers

edited November 2006 in End User
I?m currently using a TppViewer on a customized Print Preview Form.

Well, I want to know how can I handle the Mouse Wheel messages to Scroll Up
and Down the Report. I have tried the OnMouseWheelUp of TForm with
TppViewer.ScrollBy with no success.

Also, is it possible to, when the user presses the Mouse Wheel and scroll it
up and down, to move forward and reward the pages of a report?

Thanks in advance

Murilo

Comments

  • edited November 2006
    Hi Murilo,

    The Designer and the built-in preview dialog include support for the mouse
    wheel. They both use the TppPreview class (see ppPreview.pas) which manages
    the Viewer, Toolbar, Outline, and TextSearch controls that comprise the
    ReportBuilder preview controls.

    One solution is to descend from the TppPreview class.

    The other solution is to implement the FormMouseWheel event-handler as shown
    here...

    procedure TForm1.FormMouseWheel(Sender: TObject; Shift: TShiftState;
    WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
    begin
    ppViewer1.ScrollBox.VertScrollBar.Position :=
    ppViewer1.ScrollBox.VertScrollBar.Position - (WheelDelta div 5);

    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    Thanks! It worked nicely!!

This discussion has been closed.