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

OnMouseWheel event for ThumbnailViewer

The code below is what i'm using to try to get the mousewheel to work with the ThumbNailViewer. However the ThumbNailMouseWheelEvent won't fire. The name of the ppReport is 'rp'.

procedure MyForm.PreviewFormCreate(Sender: TObject);
begin TppPrintPreview(TppReport(Self.FindComponent('rp')).PreviewForm).OutlineNotebook.ThumbNailViewer.OnMouseWheel := ThumbnailMouseWheelEvent;
end;

procedure MyForm.ThumbNailMouseWheelEvent(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
begin
with TppThumbnailViewer(Sender).VertScrollBar do Position := Position -(WheelDelta div 5);
Handled := True;
end;

Any help would be appreciated.

Best Regards,
Tommy

Comments

  • Hi Tommy,

    The RB Preview ThumbNailViewer includes built-in support for mouse wheel scrolling. Testing with RB 22.03 and Delphi 12 it is working. Also when the PageView is set to Continuous, the mouse wheel can be used to scroll the pages.


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • Hi Nard,

    Thank you for your reply. However, it isn't working for me. I have Delphi 12 Patch 1 and RB 22.03.

    There are more thumbnails than are displayed in the viewer but there is no response using the mousewheel. Could there be some property that I need to change?

    Best Regards,
    Tommy
  • Greetings,

    I now have Delphi 12.1 and RB 22.04. I still can't get the mousewheel to respond in the ThumbnailViewer.

    Best Regards,
    Tommy
  • Hi Tommy,

    I'll help with this issue moving forward since I wrote the Thumbnail feature.

    The TppThumbnailViewer is a descendent of a TScrollBox with its DoMouseWheel function overridden. This event should fire anytime the mouse wheel is activated when the ScrollBox is in focus.

    In all of our tests with Windows 10 and 11, Delphi 10x, 11, and 12, the mouse wheel is functioning correctly with the thumbnail viewer.

    1. Are you able to recreate this behavior outside your main application with a simple example? (i.e. Report on a form with a button set to print. AutoStop set to False and PageLimit set to 25).

    2. If you do still get the same behavior with the simple example above, try running it on a different machine to be sure the OS is not the problem.

    3. Finally, send the example in .zip format to us and we will try to recreate the problem here and find a solution.
    Best Regards,

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

    I ran the program on another machine and the mouse wheel is working as expected. There must be some problem with the mouse events on my machine. I'll start troubleshooting my system from that angle.

    Thank you for your help. By the way, all other programs on my machine are working with the mouse wheel - for whatever that's worth.

    Best Regards,

    Tommy
  • Hi Nico,

    I found a solution. I have Windows 11 Pro.

    In the System Menu > Bluetooth & Devices > Mouse - I changed the following setting to on:
    Scroll inactive windows when hovering over them.

    Now the mouse wheel scrolls the thumbnails as designed.

    Thank you for your help and support.

    Best Regards,

    Tommy
  • Thanks Tommy,

    This information will be very helpful for other RB users moving forward.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.