Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Win32 scrollbar "slop distance" constant?

On Windows, when you use the mouse to click and drag in a scrollbar to scroll it up and down, you can move the mouse approximately ~120 pixels away from the scrollbar before the dragging stops working. (By contrast, on the mac you appear to be able to move it anywhere on the screen and the drag will still happen.)

Is there a constant I can get at, maybe using SystemParametersInfo or something, to get the OS-defined value for this? I'm using a control that simulates a scrollbar, and I'd like to use the same behavior for how far you can drag away from the bar before scrolling stops.

Thanks!

like image 617
Colen Avatar asked May 04 '11 00:05

Colen


1 Answers

GetSystemMetrics has a lot of these values. However, there is no Windows API that retrieves this value.

As an aside, you should think carefully before simulating a control. There is a lot more code to implementing the control correctly (including support for accessibility, keyboarding and other behaviours) that will tend to make your scroll bar either lacking in features or more costly than you intend.

like image 183
Martyn Lovell Avatar answered Oct 17 '22 21:10

Martyn Lovell