Game Development Community

Small but handy GuiScrollCtrl enhancement

by Fyodor -bank- Osokin · in Torque Game Engine · 01/26/2008 (4:38 pm) · 3 replies

what:
1. If you press SHIFT, then the scroll will do horizontal scrolling instead of vertical
2. If there is nothing to scroll vertically, it will try to scroll horizontal automatically

Changes:
open:
guiScrollCtrl.cc

locate:
bool GuiScrollCtrl::onMouseWheelUp(const GuiEvent &event)
change:
scrollByRegion((event.modifier & SI_CTRL) ? UpPage : UpArrow);
to this:
scrollByRegion(
      (event.modifier & SI_SHIFT || !mVBarEnabled) ? 
      ( (event.modifier & SI_CTRL) ? LeftPage : LeftArrow) :
      ( (event.modifier & SI_CTRL) ? UpPage : UpArrow )
      );

locate:
bool GuiScrollCtrl::onMouseWheelDown(const GuiEvent &event)
change:
scrollByRegion((event.modifier & SI_CTRL) ? DownPage : DownArrow);
to this:
scrollByRegion(
      (event.modifier & SI_SHIFT || !mVBarEnabled) ? 
      ( (event.modifier & SI_CTRL) ? RightPage : RightArrow) :
      ( (event.modifier & SI_CTRL) ? DownPage : DownArrow)
      );

Save. Rebuild. Enjoy!

#1
01/26/2008 (6:29 pm)
Thanks man! you should put it on resources, so its easier to find on the future ;)
#2
01/26/2008 (6:47 pm)
Nice!
agree w/ novack.