Game Development Community

1.1 and up - guiScrollCtrl scrollbar drag

by Daan Broekhof · in Torque Game Engine · 09/11/2005 (6:23 pm) · 1 replies

Not essentially a bug, but more a pet peeve - when dragging the scrollbars in a guiScrollCtrl the scrollbars have a very low tolerance on what is still considered to be 'near' the scrollbar. Especially when scrolling vertically in the console or editors this can get irritating.

The fix: Behaviour like standard Windows scrollbar-tolerance, this is a tolerance of roughly 130 pixels either direction of a dragging scrollbar.

In "engine/gui/containers/guiScrollCtrl.h"

Add
S32 mScrollBarDragTolerance;    // maximal distance from scrollbar at which a scrollbar drag is still valid
after "S32 mScrollBarArrowBtnLength; // determined by the height of the up arrow"


In "engine/gui/containers/guiScrollCtrl.cc"

In function "GuiScrollCtrl::GuiScrollCtrl"
mScrollBarDragTolerance = 130;
after " mScrollBarArrowBtnLength = 16;"

In function "GuiScrollCtrl::onMouseDragged" replace
mScrollBarThickness
with
mScrollBarDragTolerance