I wrote a grid control and would like to add mouse wheel support to it. I thought it would be as simple as overriding the DoMouseWheel virtual method, but there is a bit of a problem with it.
You can set the number of lines to scroll at a time in the control panel, and by default, three. And that makes sense when scrolling through a document or web page, but on a grid, I think waiting is more like scrolling a line at a time. But it seems that Delphi wheel support will call DoMouseWheel three times for every label that I scroll, which means that I can only scroll every third row in the grid (or whatever this is a global setting).
How do I scroll one line at a time for each turn of the mouse wheel?
Update: . The short answer here is to simply set Result to True after scrolling - then it does not scroll three times, but only once.
source
share