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

Mouse scroll in report preview

edited January 2004 in End User
Hi!
I use custom EU Explorer (from your demo).
How to implement scroll of report preview that will react on mouse weel
scroll?
Maybe this is not the right place to ask, but this would be a nice
enchansement in some next release...
THX!
Benjamin

Comments

  • edited January 2004
    Hi Benjamin,

    Mouse wheel scroll in the preview will be enabled in the next release of
    ReportBuilder. As for now, below is some simple code one of our customers
    gave to accomplish this.

    unit AJBPreviewPlugIn;

    interface

    uses
    Messages, Controls, Classes, Types, ExtCtrls,
    ppPreview, ppTypes, Forms;

    type

    TAJBPreviewPlugIn = class(TppPreview)
    private
    protected
    public
    procedure BeforePreview; override;
    procedure MyMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta:
    Integer;
    MousePos: TPoint; var Handled: Boolean);

    end;

    TAJBCustomWheel = class(TControl)
    public
    property OnMouseWheel;
    end;

    implementation

    uses
    SysUtils, Dialogs, ppViewr;

    procedure TAJBPreviewPlugIn.BeforePreview;
    begin
    inherited BeforePreview;
    TAJBCustomWheel(Viewer.Owner).OnMouseWheel := MyMouseWheel;
    end;

    procedure TAJBPreviewPlugIn.MyMouseWheel(Sender: TObject; Shift:
    TShiftState;
    WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
    var
    lScrollBar: TControlScrollBar;
    begin
    lscrollbar := Viewer.ScrollBox.VertScrollBar;
    lScrollBar.Position := lScrollBar.Position - (WheelDelta div 5);
    end;

    initialization
    TppPreviewPlugIn.Register(TAJBPreviewPlugIn);
    finalization
    TppPreviewPlugIn.UnRegister(TAJBPreviewPlugIn);
    end.


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2004
    Hi!
    Thx for this code, but I'm not too familiar with rBuilder source and so
    on...
    Can you give me a little hint what to do with that code?
    THX!

  • edited January 2004
    Hi Benjamin,

    You should be able to simply place the code I gave you in a new unit. Save
    this new unit, include it in your project and rebuild. That's it!.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2004
    I wasn't know it is so easy....my person looks allways for complications....
    ;-)
    THX!

This discussion has been closed.