0
How to make the mouse scroll button work in Quick Report reports.
Today I use a custom Preview using the Tqrpreview component.
I use Delphi 7 and Quick Report 3.0.9.
0
How to make the mouse scroll button work in Quick Report reports.
Today I use a custom Preview using the Tqrpreview component.
I use Delphi 7 and Quick Report 3.0.9.
2
I found this other tip in the Embarcadero forum, even simpler than the tip below.
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
var
i: SmallInt;
pt : Tpoint;
begin
GetCursorPos(pt); // Get the position from Cursor
if Msg.message = WM_MOUSEWHEEL then // WheelMouse Message when scrolling
begin
Msg.lParam := 0;
i := HiWord(Msg.wParam) ;
if i > 0 then // If Scrolling Up
SendMessage(WindowFromPoint(pt),WM_VSCROLL, SB_LINEUP,0)
else
SendMessage(WindowFromPoint(pt),WM_VSCROLL, SB_LINEDOWN,0);
Handled := False;
end;
end;
OnMessage
Second oldest tip
First, add an event BeforePrint
in his report:
procedure Form1.QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
SetupMouseWheel;
end;
Then create the function SetupMouseWheel
:
procedure Form1.SetupMouseWheel;
begin
with TQRStandardPreview(Application.FindComponent('QRStandardPreview')) do
begin
OnMouseWheel := MouseWheel;
end;
end;
Finally, create the function MouseWheel
:
procedure Form1.MouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
begin
with TQRStandardPreview(Application.FindComponent('QRStandardPreview')) do
begin
Application.ProcessMessages;
VertScrollBar.Range := 1350;
VertScrollBar.Position := VertScrollBar.Position - trunc(WheelDelta / 4);
end;
end;
Replace the QRStandardPreview
in both functions by the name of its component TQRPreview
.
See more here:
Browser other questions tagged delphi delphi-7 quickreport
You are not signed in. Login or sign up in order to post.
you have some example you can send me. I did as you say in your example and it didn’t work. In this part of the code "Onmousewheel := Mousewheel;" from access Violation.
– Ariel Inacio Correa
Hello Ariel, you replaced the
QRStandardPreview
by the name of its component? It may be in this part that it gives the memory error, because there is no component. Check the post again, I added an update with a code I found on the Embarcadero website.– Vitor Henrique
Hello Vitor, to resolve this situation, I did it this way. No evento onMouseWheel coloquei o seguinte código:

Application.ProcessMessages;
QRPreview.VertScrollBar.Position := QRPreview.VertScrollBar.Position - trunc(WheelDelta / 4);

Isso já foi o bastante para que o que estava precisando funcionasse.
– Ariel Inacio Correa
Ariel, yes also works, the difference is that you accessed the component directly without searching for it as I did in the example. Also test with the Applicationevents that I put up, it sends a scroll message to your report, maybe it’s even simpler.
– Vitor Henrique