SpinBox

lepawel

11-10-2015 19:45:06

Hey guys,

I'm working on a small project in my free time and use MyGUI as to handle my interface. I have noticed that there's a currently lack of a spinbox control inside the system, so I decided to make my own.
You can get it https://drive.google.com/file/d/0B3dnXeQkx4eXUTd3MUdlZ0U2SDQ/view

This class is essentially a wrapper for 3 MyGUI widgets: an EditBox and 2 Buttons. While the class itself doesn’t decide how your SpinBox looks or where each widget is positioned (so you could re-create a classic Windows-like Spinbox or invent your own layout that will work better for your needs), it does override their event functions to change the value pointer passed with an adjustable increment/decrement value, which triggers to a “fast” mode based on time spent with button down (also adjustable). Additionally, I have added support for changing values with scroll wheel, but they only seem to work when hovering over the increment/decrement buttons and not the EditBox itself. It requires to be be periodically updated by calling the ‘tickUpdate’ function with time passed since last update in milliseconds.

Feel free to use it in whatever way you want, I give no guarantees on its bug-freeness, it seem to work well for me though.

LePawel