Mouse Wheel in StringGrid lazarus / 8-Other ---------------------------------------------------------------------- faber · 2009-02-23 19:29 I want to set up MouseWheel behavior in the same way as the vertical ScrollBar (with out goScrollKeepVisible). I don't want to change the location of active cell by mouse wheel. I just want to move the entire sheet when I'm scrolling by mouse(like MS Office). How to do that ? ---------------------------------------------------------------------- faber · 2009-03-03 08:54 I found solution by overriding the DoMouseWheelDown and DoMouseWheelUp routines ---------------------------------------------------------------------- cpalx · 2009-03-03 17:57 i dont get it... ---------------------------------------------------------------------- faber · 2009-03-03 18:03 Quote from: cpalx on March 03, 2009, 06:57:14 pmi dont get it... ? By override DoMouseWheel... ( off, Result:=false ) I get what I want. ---------------------------------------------------------------------- noctrex · 2012-07-13 10:01 Quote from: faber on March 03, 2009, 09:54:58 amI found solution by overriding the DoMouseWheelDown and DoMouseWheelUp routines I know this post is old, but is it possible to tell us how you did it? I'm currently struggling with this... ---------------------------------------------------------------------- User137 · 2012-07-13 11:06 I tried this quickly, at least it compiles: Code: [Select]  TStringGrid2 = class(TStringGrid)   protected     function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;   end; // ... function TStringGrid2.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; begin   //Result:=inherited DoMouseWheel(Shift, WheelDelta, MousePos);   Result:=false; end; To insert a TStringGrid2 on form, you need to do a little more tricks. You can: - Make it a new component. - TStringGrid2.Create and set its properties manually. - Draw a TStringGrid on form, and then change it to TStringGrid2. You may have to manually edit .lfm file. ---------------------------------------------------------------------- Bernd82 · 2017-08-15 11:10 There is a new(?) property: MouseWheelOption. Set it to mwGrid. Works fine! ---------------------------------------------------------------------- Graeme · 2017-08-24 23:18 Quote from: Bernd82 on August 15, 2017, 01:10:36 pmThere is a new(?) property: MouseWheelOption. Set it to mwGrid. Works fine! Awesome, thanks for sharing. I worked recently on a LCL project and was fighting with this exact issue. ---------------------------------------------------------------------- zbyna · 2017-08-31 22:23 Quote from: Bernd82 on August 15, 2017, 01:10:36 pmThere is a new(?) property: MouseWheelOption. Set it to mwGrid. Works fine! Unfortunately does not work in TDBGrid. ---------------------------------------------------------------------- RayoGlauco · 2018-03-26 08:42 Quote from: Bernd82 on August 15, 2017, 01:10:36 pmThere is a new(?) property: MouseWheelOption. Set it to mwGrid. Works fine! Great!! I spent many time figuring out how to do this!!