[DUG] MouseWheel and DBGrid in D6
Dennis Chuah
dennis_cs_chuah at hotmail.com
Tue May 30 14:50:02 NZST 2006
Range checking turned off perhaps?
----- Original Message -----
From: "Wayne Roser" <rr at kristin.school.nz>
To: "NZ Borland Developers Group - Delphi List" <delphi at ns3.123.co.nz>
Sent: Tuesday, May 30, 2006 2:47 PM
Subject: [DUG] MouseWheel and DBGrid in D6
>I found an article in Delphi.about.com and got this code to fix MouseWheel
>behaviour in a DBGrid:
>
> procedure TForm1.ApplicationEvents1Message (var Msg: TMsg; var Handled:
> Boolean) ;
> var
> i: SmallInt;
> begin
> if Msg.message = WM_MOUSEWHEEL then begin
> Msg.message := WM_KEYDOWN;
> Msg.lParam := 0;
> i := HiWord(Msg.wParam) ; // this line gives me a problem
> if i > 0 then
> Msg.wParam := VK_UP
> else
> Msg.wParam := VK_DOWN;
> Handled := False;
> end;
> end;
>
> So I dropped a TApplicationEvents component on my form and used the code.
>
> I get a problem at the line
> i := HiWord(Msg.wParam) ;
> Msg.wParam is -7864320 and an ERangeError pops up with message 'Range
> check error'
>
> My working version has
> i := Msg.wParam div abs(Msg.wParam);
> in place of the offending line but I'd like to know wassup with the
> original code.
>
> Wayne Roser
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
More information about the Delphi
mailing list