Manage WMVScroll properly

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3074 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo
2014-05-21 18:28:15 +00:00
parent 52faebc69e
commit cd13fe49a0

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, DB, Grids, DBGrids, Classes, SysUtils, LResources, Forms, Controls, Graphics, DB, Grids, DBGrids,
Dialogs, LCLType, jdbgridutils; Dialogs, LCLType, LMessages, jdbgridutils;
type type
@ -80,6 +80,7 @@ type
override; override;
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): boolean; override; function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): boolean; override; function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): boolean; override;
procedure WMVScroll(var Message: TLMVScroll); message LM_VScroll;
procedure KeyDown(var Key: word; Shift: TShiftState); override; procedure KeyDown(var Key: word; Shift: TShiftState); override;
public public
{ Public declarations } { Public declarations }
@ -205,10 +206,10 @@ end;
procedure TJDBGridControl.MouseDown(Button: TMouseButton; Shift: TShiftState; procedure TJDBGridControl.MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: integer); X, Y: integer);
begin begin
if not (integerDbGridControl.CanDefocus and if not (integerDbGridControl.CanDefocus and doubleDbGridControl.CanDefocus and
doubleDbGridControl.CanDefocus and dateTimeDbGridControl.CanDefocus and dateTimeDbGridControl.CanDefocus and stringDbGridControl.CanDefocus and
stringDbGridControl.CanDefocus and dateDbGridControl.CanDefocus and dateDbGridControl.CanDefocus and timeDbGridControl.CanDefocus) then
timeDbGridControl.CanDefocus) then
abort abort
else else
inherited MouseDown(Button, Shift, X, Y); inherited MouseDown(Button, Shift, X, Y);
@ -235,6 +236,16 @@ begin
Result := inherited DoMouseWheelUp(Shift, MousePos); Result := inherited DoMouseWheelUp(Shift, MousePos);
end; end;
procedure TJDBGridControl.WMVScroll(var Message: TLMVScroll);
begin
if not (integerDbGridControl.CanDefocus and doubleDbGridControl.CanDefocus and
dateTimeDbGridControl.CanDefocus and stringDbGridControl.CanDefocus and
dateDbGridControl.CanDefocus and timeDbGridControl.CanDefocus) then
abort
else
inherited WMVScroll(Message);
end;
procedure TJDBGridControl.KeyDown(var Key: word; Shift: TShiftState); procedure TJDBGridControl.KeyDown(var Key: word; Shift: TShiftState);
begin begin
inherited KeyDown(Key, Shift); inherited KeyDown(Key, Shift);