In Delphi, When I capture the MouseWheel events for a TImage, I find that the wheel events are not created over my TImage but rather offset up and to the left (but smaller). In other words, if put the mouse over the lower right corner of my TImage, I get no events. But I do get events above and to the left of the TImage. It does not seem to make a difference how I capture the events. I tried simple hijack adding the OnMouseWheel property. I tried create a descendant component, exposing OnMouseWheel. I tried overriding DoMouseWheel. I tried hooking WndProc() and capturing WM_MOUSEWHEEL. All result in the same thing.
Asked
Active
Viewed 445 times
-2
-
Please, show the minimal code with which we can reproduce the problem, iow an [MCVE](http://stackoverflow.com/help/mcve). – Tom Brunberg Oct 22 '16 at 08:55
-
Add the image on a wincontrol like a panel with identical dimensions and expose wheel handling on that control. Being a graphiccontrol descendant, the image is not delivered any kind of scrolling message. – Sertac Akyuz Oct 22 '16 at 13:46
-
`TImage` is a graphical control, not a windowed control. Mouse input is received by the windowed Parent first and then delegated to the closest non-windowed child. So the received coordinates are relative to the Parent, not the Image. It sounds like the Parent is not adjusting the coordinates correctly when delegating. But without an MVCE, nobody can tell you why that is. – Remy Lebeau Oct 22 '16 at 15:54
-
Ok, it was a long shot. All the other windowed functions seemed to work. I switched my component to inherit from TCustomControl and added the functionality I need from TImage and things work much better. Thanks. – Bill F Oct 23 '16 at 05:17
1 Answers
-2
Ok, it was a long shot. All the other windowed functions seemed to work. I switched my component to inherit from TCustomControl and added the functionality I needed from TImage and things work much better.

Bill F
- 201
- 2
- 11