diff --git a/components/orpheus/ovcbase.pas b/components/orpheus/ovcbase.pas index c55750774..9d4c0b0a7 100644 --- a/components/orpheus/ovcbase.pas +++ b/components/orpheus/ovcbase.pas @@ -1844,6 +1844,11 @@ end; procedure TO32CustomControl.DoOnMouseWheel(Shift : TShiftState; Delta, XPos, YPos : SmallInt); +// Another TurboPower bug? Their TMouseWheelEvent expects Word +// params, yet passing SmallInts here. Delta is negative when +// scroll down, which will raise exception if a descendent class +// with a TMouseWheelEvent handler has range checking turned on. +// Note that their TMouseWheelEvent redefines LCL's. begin if Assigned(FOnMouseWheel) then FOnMouseWheel(Self, Shift, Delta, XPos, YPos); @@ -2026,10 +2031,15 @@ begin end; procedure TO32CustomControl.WMMouseWheel(var Msg : TMessage); +// TurboPower bug: They should have used TWMMouseWheel instead of +// TMessage. Delta is negative on scroll down, but extracting it +// from wParam with HIWORD returns a Word, which causes an +// exception when passed as SmallInt to DoOnMouseWheel when +// range checking turned on. Fix is to cast delta as SmallInt. begin with Msg do DoOnMouseWheel(KeysToShiftState(LOWORD(wParam)) {fwKeys}, - HIWORD(wParam) {zDelta}, + SmallInt(HIWORD(wParam)) {zDelta}, //bug fix LOWORD(lParam) {xPos}, HIWORD(lParam) {yPos}); end; @@ -2265,10 +2275,11 @@ begin end; procedure TOvcCustomControl.WMMouseWheel(var Msg : TMessage); +// See TurboPower bug comments above. begin with Msg do DoOnMouseWheel(KeysToShiftState(LOWORD(wParam)) {fwKeys}, - HIWORD(wParam) {zDelta}, + SmallInt(HIWORD(wParam)) {zDelta}, //bug fix LOWORD(lParam) {xPos}, HIWORD(lParam) {yPos}); end; diff --git a/components/orpheus/ovccmbx.pas b/components/orpheus/ovccmbx.pas index d5c6771d9..cf2c6f83b 100644 --- a/components/orpheus/ovccmbx.pas +++ b/components/orpheus/ovccmbx.pas @@ -1530,12 +1530,13 @@ begin end; procedure TOvcBaseComboBox.WMMouseWheel(var Msg : TMessage); +// See TurboPower bug comments in TO32CustomControl.WMMouseWheel. begin inherited; with Msg do DoOnMouseWheel(KeysToShiftState(LOWORD(wParam)) {fwKeys}, - HIWORD(wParam) {zDelta}, + SmallInt(HIWORD(wParam)) {zDelta}, //bug fix LOWORD(lParam) {xPos}, HIWORD(lParam) {yPos}); end;