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

Mouse wheel support in report designer

edited October 2004 in General
Hi All!

Some source change in Enterpise version Report Builder can add
mouse wheel support in report designer.

File: ppDsgner.pas
Line: before declaration of TppDesignerWindow.WMActivate(var Message:
TMessage);

Code:

// *** Changed
// *** MouseWheel support
type _TForm = class(TForm)
public
class procedure _MouseWheelUp(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
class procedure _MouseWheelDown(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
end;


class procedure _TForm._MouseWheelUp(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
var ppViewer1 : TppViewer;
begin
if TppDesignerWindow(Sender).pgcDesigner.ActivePage =
TppDesignerWindow(Sender).tshDesign then
begin
TppDesignerWindow(Sender).sbxWorkspace.VertScrollBar.Position :=
TppDesignerWindow(Sender).sbxWorkspace.VertScrollBar.Position -
round(TppDesignerWindow(Sender).sbxWorkspace.ClientHeight*0.04);
end else
if TppDesignerWindow(Sender).pgcDesigner.ActivePage =
TppDesignerWindow(Sender).tshPreview then
if Assigned(TppDesignerWindow(Sender).FViewer) then
begin
ppViewer1 := TppDesignerWindow(Sender).FViewer;
if ppViewer1.ScrollBox.VertScrollBar.ScrollPos -
round(TppDesignerWindow(Sender).ClientHeight*0.08) >= 0 then
ppViewer1.ScrollBox.VertScrollBar.Position :=
ppViewer1.ScrollBox.VertScrollBar.Position -
round(TppDesignerWindow(Sender).ClientHeight*0.08)
else
ppViewer1.ScrollBox.VertScrollBar.Position := 0;
end;
end;

class procedure _TForm._MouseWheelDown(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
var ppViewer1 : TppViewer;
begin
if TppDesignerWindow(Sender).pgcDesigner.ActivePage =
TppDesignerWindow(Sender).tshDesign then
begin
TppDesignerWindow(Sender).sbxWorkspace.VertScrollBar.Position :=
TppDesignerWindow(Sender).sbxWorkspace.VertScrollBar.Position +
round(TppDesignerWindow(Sender).sbxWorkspace.ClientHeight*0.04);
end else
if TppDesignerWindow(Sender).pgcDesigner.ActivePage =
TppDesignerWindow(Sender).tshPreview then
if Assigned(TppDesignerWindow(Sender).FViewer) then
begin
ppViewer1 := TppDesignerWindow(Sender).FViewer;
if ppViewer1.ScrollBox.VertScrollBar.ScrollPos +
round(TppDesignerWindow(Sender).ClientHeight*0.08) <=
ppViewer1.ScrollBox.VertScrollBar.Range then
ppViewer1.ScrollBox.VertScrollBar.Position :=
ppViewer1.ScrollBox.VertScrollBar.Position +
round(TppDesignerWindow(Sender).ClientHeight*0.08)
else
ppViewer1.ScrollBox.VertScrollBar.Position :=
ppViewer1.ScrollBox.VertScrollBar.Range;
end;
end;
// ***


before end of procedure TppDesignerWindow.WMActivate(var Message: TMessage);
add next code:

//***
if not Assigned(OnMouseWheelUp) then
OnMouseWheelUp := _TForm._MouseWheelUp;
if not Assigned(OnMouseWheelDown) then
OnMouseWheelDown := _TForm._MouseWheelDown;

//***

Support for versions delphi > 5.0

Regards,
Nikolai
This discussion has been closed.