Page 1 of 1

scroll value

Posted: Fri Apr 14, 2006 09:56
by nickak2003
Hi, I am trying to get the scrollvalue, but it always seems to return one, even though its being moved around. I set the value of some static text equal to its value, and it is always 1

Code: Select all

      CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
      std::stringstream sstr;
      sstr<<((CEGUI::Slider*)wmgr.getWindow("slider1"))->getCurrentValue() << " ";
      OutputDebugString( sstr.str().c_str() );
      ((CEGUI::StaticText*)wmgr.getWindow("static1"))->setText( sstr.str() );

Posted: Fri Apr 14, 2006 13:13
by Van
I think the values are between 0.0 and 1.0. Anything above 1.0 is set to 1.0. That is your range. 0-10 won't work. it has to be 0.0 - 1.0 with 0.1 increments ( or finer ).

Posted: Fri Apr 14, 2006 21:13
by nickak2003
I havent set any properties effecting the max or minimum of the scroll.
After loading the control, I set it up like this:

Code: Select all

   //static_cast<CEGUI::Slider*>(wmgr.getWindow("slider1"))->subscribeEvent(CEGUI::Slider::EventValueChanged, CEGUI::Event::Subscriber(&GameMode_test::slider_slide, this));
   CEGUI::Slider* slider= static_cast<CEGUI::Slider*>(wmgr.getWindow("slider1"));
   //slider->setMaxValue(1);
   slider->setClickStep(0.1f);
   //slider->setCurrentValue(1);

The several lines commented out generate runtime errors.

Posted: Sat Apr 15, 2006 01:23
by jacmoe
I don't think the values are clamped between 0.0 and 1.0.
But I think it is a problem if you pass it ints instead of floats.
Try this:

Code: Select all

   slider->setMaxValue(1.0f);
   slider->setClickStep(0.1f);
   slider->setCurrentValue(1.0f);