[Bug?] ScrollBar onClick issue

simed

17-11-2011 11:22:55

I have a H-ScrollBar with horizontal stretch. I noticed that if expand the window so the scroll-bar stretches, moveToClick doesn't work past the original width. Clicking and dragging the scrollbar positioner does still work though.

I was able to reproduce this in LayoutEditor too:<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout" version="3.2.0">
<Widget type="Window" skin="WindowCS" position="5 10 405 95">
<Widget type="ScrollBar" skin="ScrollBarH" position_real="0 0 1 1" align="Stretch">
<Property key="Range" value="100"/>
<Property key="RangePosition" value="50"/>
</Widget>
</Widget>
</MyGUI>
Maybe this is already known/fixed in a newer version? ... no I checked and I already have latest code.

simed

24-11-2011 13:02:04

bump

Crystal Hammer

18-12-2011 06:59:44

Yeah, would be great if you fixed it.
We have plenty (over 70) sliders in game and editor and dragging them to reach the upper values is just annoying.
Will it be fixed, or do we need to make a custom slider control ourself ?
BTW. Is it a lot of work to make the slider have a float (not integer) value ? We have many sliders with for float variables, and making them on int with range 1000001 kind of works, but isn't very good.

simed

19-12-2011 09:50:54

Will it be fixed, or do we need to make a custom slider control ourself ?I would imagine as a fellow MyGUI user that fixing it is easier than making your own control - if you make a fix or find the problem let the rest of us know!

BTW. Is it a lot of work to make the slider have a float (not integer) value ? We have many sliders with for float variables, and making them on int with range 1000001 kind of works, but isn't very good.Personally I have some util methods to make this easier. You probably have the same but you're free to use/modify this if it helps you:
///all-static collection of helper methods
class MyGUIUtil
{
public:
///Get slider value in range [0.0,1.0]
static float getSliderValue(MyGUI::ScrollBar *slider)
{
return (slider->getScrollPosition()*1.f)/slider->getScrollRange();
}
///Get slider value in specified integer range
static int getSliderValue(MyGUI::ScrollBar *slider,int a,int b)
{
float x = getSliderValue(slider);
return a + (int)(x * (b-a) + .5f);
}
///Get slider value in specified range
static float getSliderValue(MyGUI::ScrollBar *slider,float a,float b)
{
float x = getSliderValue(slider);
return a + x * (b-a);
}
///Translate slider val to range [-range/2,+range/2]
static int getSliderValue0(MyGUI::ScrollBar *slider)
{
return slider->getScrollPosition() - slider->getScrollRange()/2;
}

static MyGUI::MouseButton translateMouseButton(MouseButton mb)
{
return (MyGUI::MouseButton::Enum)(mb);
}
};

Crystal Hammer

03-05-2012 20:28:20

Yeah I've made my own implementation. No problems now.
Look in:
viewtopic.php?f=17&t=29445