slider value

General Discussion about libRocket.

slider value

Postby nace186 on Thu Feb 11, 2010 10:47 pm

I created a slider with the following rml:
Code: Select all
<input id="test_slider" type="range" min="0" max="10" value="0" style="width: 100px;" onchange="one" />


and in the event handler, I have the following:
Code: Select all
         
   if (pFile!=NULL)
   {
      fprintf(pFile, "slider value %s \n", event.GetCurrentElement()->GetAttribute< EMP::Core::String >("value", "1") );
   }


I'm able to drag the slider, but the slider value saved in the file is always zero. How can I get the value that is submitted by the user?
nace186
 
Posts: 3
Joined: Thu Feb 11, 2010 10:41 pm

Re: slider value

Postby peterc on Wed Feb 17, 2010 12:22 am

The RML appears to be correct. When you're fprinting the value of the variable however, there should be a .c_str() on the end of the call to GetAttribute to convert the EMP::Core::String into a const char*. I don't know if that's the problem; if that doesn't work, try changing the initial value of the slider and seeing what the value is reported as then.
peterc
Rocket Engineer
Rocket Engineer
 
Posts: 222
Joined: Wed Jan 16, 2008 12:00 am


Return to General


cron