Home General

TppViewer and mouse scroll wheel

ReportBuilder 20.04
Delphi 7

A client has requested the mouse wheel be able to scroll reports. So far I have not got it working.

Currently the preview form is based on an rb example preview form code, with the main difference being the addition of a pagecontrol, with the first tabsheet containing the original controls/layout.

The scroll wheel works on other controls within the form but not the Viewer, and if i click on the scroll bar for the report, it will scroll very slowly using the wheel.

I see that support was added for mouse wheel from RB 7.04 and revised in RB14.

MouseMode property is vmmScroll (if that is in any way related).

I have also tried adding the below event as a test, and if i place a breakpoint, within, it never triggers, so still not working.

procedure TmySearchPrintPreview.FormMouseWheel(Sender: TObject;
Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
var Handled: Boolean);
begin
ppViewer1.VerticalScroll(WheelDelta div 5);
Handled := True;
end;

Comments

  • Hi Steven,

    The issue with mousewheel in the preview is focus. The previewer consists of numerous controls, all gaining and loosing focus as a user interacts with them. The OnMouseWheel event will only fire for the "focused" control when implemented.

    To work around this, RB uses a "KeyCatcher" control. This is essentially an invisible TEdit control that is constantly given focus once something is done inside the previewer. This way when a key is pressed or the mousewheel is moved, the TEdit events are always fired and the correct action is taken in the previewer.

    I suggest implementing something similar in your preview plugin (or create a new preview plugin that descends from the current TppPreview class). See the FKeyCatcher property of the TppPreview class for how we go about it.


    Best Regards,

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