Recent

Author Topic: [SOLVED] TStringGrid - disable mouse wheel control  (Read 296 times)

big_M

  • Jr. Member
  • **
  • Posts: 60
[SOLVED] TStringGrid - disable mouse wheel control
« on: March 03, 2023, 12:17:23 am »
How could I disable any mouse wheel control on a TStringGrid?

The TStringGrid has a MouseWheelOption which can be set to either "mwGrid", which makes the wheel control the scroll bars, or to "mwCursor" which makes it control the cell selection/cursor. Unfortunately there is no "mwNone" to completely disable any control that the mouse wheel has.

Is there an other way to do this? Or would I have to create my own TStringGrid?

Btw, what I want to accomplish is to zoom in and out of the grid using ctrl+MW, with the MW having no other control in that moment. Setting the mouseWheelOption temporarily to an unfortunately not existing mwNone would be perfect.
« Last Edit: March 03, 2023, 01:14:57 am by big_M »

Blaazen

  • Hero Member
  • *****
  • Posts: 3234
  • POKE 54296,15
    • Eye-Candy Controls
Re: TStringGrid - disable mouse wheel control
« Reply #1 on: March 03, 2023, 12:25:58 am »
You can do it this way:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.StringGrid1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
  2.   var Handled: Boolean);
  3. begin
  4.   Handled:=True;
  5. end;
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

big_M

  • Jr. Member
  • **
  • Posts: 60
Re: TStringGrid - disable mouse wheel control
« Reply #2 on: March 03, 2023, 12:50:04 am »
Oh, great. Thank you

 

TinyPortal © 2005-2018