Page 1 of 1
RPG doesn't know slider value
Posted: Thu Jan 05, 2012 12:34 pm
by Thomas Garvey
I have a Slider widget and a displayed value that changes as the user adjusts the slider button. Works great. However, when the user has finished their adjustment (which I guess is OnMouseUp) I need to check the value they left the slider at and, depending on value, either turn on or off a separate radio button.
I'm guessing I have to use JavaScript for this because I can't figure out how to have my RPG program know when the user is done with the slider (and thus check the value and set/reset the radio button). That is, other than JavaScript. I can't bind a Response Indicator to it.
Any ideas, or JavaScript for this type of thing?
Re: RPG doesn't know slider value
Posted: Thu Jan 05, 2012 12:44 pm
by Brian
The screen would need to be submitted for your RPG to regain control of anything. You could just put a call to pui.click() on the onmouseup event of the slider. This should return control to RPG after they adjust the slider. Let me know if that meets your need.
Re: RPG doesn't know slider value
Posted: Thu Jan 05, 2012 4:51 pm
by Thomas Garvey
That didn't really help. My program gets control, but the new value of the slider is not provided to the program.
Re: RPG doesn't know slider value
Posted: Thu Jan 05, 2012 5:48 pm
by Brian
Did you bind a field to the "value" property of the slider?
Re: RPG doesn't know slider value
Posted: Thu Jan 05, 2012 5:50 pm
by Thomas Garvey
yes, and that field also appears on the display
Re: RPG doesn't know slider value
Posted: Thu Jan 05, 2012 5:53 pm
by Thomas Garvey
The OnChange event for the slider has this JavaScript Code...
changeElementValue("spAdjust", this.value);
So, the value is changing but the pui.click(); code in the OnMouseUp for the slider does not place the new value in the 'buffer' that my RPG program sees.
Re: RPG doesn't know slider value
Posted: Thu Jan 05, 2012 5:54 pm
by Thomas Garvey
THis is why I think the only way is to have JavaScript in the OnMouseUp event for the slider that tests the value of the slider and then changes the value of the othere field (a radio button).
Re: RPG doesn't know slider value
Posted: Thu Jan 05, 2012 6:14 pm
by Brian
That is strange. What happens if you bind a field to your displayed value? Can RPG see the current value there?
Re: RPG doesn't know slider value
Posted: Thu Jan 05, 2012 6:24 pm
by Thomas Garvey
The bound field for Value is the same for both widgets. The slider ID is Spinner1 and the bound field for Value is spAdjust. The displayed field is an Output Field, whose ID is spAdjust and the bound field for Value is spAdjust.
I'm not sure why, but the following JavaScript is in the OnChange Event for BOTH the slider AND the display output field.
changeElementValue("spAdjust", this.value);
The Display Output field would never experience an OnChange Event, right? Why would this JavaScript code be there? And does it matter, as it regards this problem?
Re: RPG doesn't know slider value
Posted: Fri Jan 06, 2012 10:08 am
by Brian
I'm not really sure what is happening. I'm going to try to recreate the situation here so that I can debug it.