Kodi Community Forum

Full Version: Slider with discrete values?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to code a slider with discrete values?

Ie in an imaginary world:

Code:
<control type="slider" id="22212">
      <description>My first slider control</description>
      <left>100</left>
      <top>570</top>
      <width>375</width>
      <height>30</height>
      <visible>true</visible>
      <initialvalue>5</initialvalue>
      <step>1</step>
      <lower>0</lower>
      <upper>10</upper>
      <texturesliderbar>osd_slider_bg_2.png</texturesliderbar>
      <textureslidernib>osd_slider_nibNF.png</textureslidernib>
      <textureslidernibfocus>osd_slider_nib.png</textureslidernibfocus>
</control>

initialvalue, step, lower and upper define a slider that would have limits 0 to 10, and step by one each time.

The situation I'm in now is having a load of buttons lined up with values "0", "1" ..."10". A slider would look a lot nicer.

I've tried putting this into python:

Code:
slider = xbmcgui.Window(xxx).getControl(yyy)
percent = slider.getPercent()
stepsize = 1/numofsteps
step = int(round(percent/stepsize))

But this code crashes when trying to access any method of "slider". The slider exists and dir(slider) reports methods correctly.