开发者

What is the best method for implementing mouse wheel activity in Delphi VCL forms?

As a long time user of Delphi 7, I've rolled my own mouse wheel handling in a few controls but lately I've noticed that some recent applications only ne开发者_如何转开发ed the mouse cursor to be placed over a control (e.g. a list box or tree view) for the mouse wheel activity to cause that control to scroll.

This feels nice (as opposed to having to click focus a control before it responds to the wheel).

Now I've moved to Delphi 2010 I'm wondering what is the 'correct' behavior?

And what can I use in Delphi that avoids me having to bodge this with my own solutions now?

Thanks.


I don't know if there's an official 'correct' behavior, but I personally find it most intuitively correct when the mouse wheel goes to the window that the mouse pointer is currently hovering over without having to explicitly give it focus. That's not the default behavior, however, and it seems that about half the applications I normally use do it one way and the other half the other way.

To get mouse wheel messages without having focus, you need to implement a mouse hook.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜