Kodi Community Forum

Full Version: Need help with a buttonscroller
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have been trying to write a buttonscroller. At first I couldn't get it to show up but I have worked that out. Now the problem is that the buttonscroller won't scroll. Here is the sample code.

Code:
<window>
  <id>4</id>
  <defaultcontrol>15</defaultcontrol>
  <allowoverlay>yes</allowoverlay>

  <controls>

    <control>
      <description>background image</description>
      <type>image</type>
      <id>1</id>
      <posx>0</posx>
      <posy>0</posy>
      <width>720</width>
      <height>576</height>
      <texture>background-settings.png</texture>
    </control>

    <control>
      <description>Settings image</description>
      <type>image</type>
      <id>2</id>
      <posx>30</posx>
      <posy>26</posy>
      <width>210</width>
      <height>70</height>
      <texture>settings_logo.png</texture>
    </control>

    <controlgroup>
      <control>
        <description>Settings Buttons</description>
        <type>buttonscroller</type>
        <id>300</id>
        <posx>300</posx>
        <posy>150</posy>
        <width>150</width>
        <height>60</height>
        <buttongap>65</buttongap>
        <numbuttons>3</numbuttons>
        <orientation>vertical</orientation>
        <align>left</align>
        <aligny>top</aligny>
        <movement>2</movement>
        <defaultbutton>2</defaultbutton>
        <wraparound>yes</wraparound>
        <smoothscrolling>yes</smoothscrolling>
        <alpha>70</alpha>
        <font>special13</font>
        <onleft>300</onleft>
        <onright>300</onright>
        <onup>300</onup>
        <ondown>300</ondown>
        <textoffsetx>20</textoffsetx>
        <texturefocus></texturefocus>
        <texturenofocus></texturenofocus>
        <textcolor>FFffffff</textcolor>
        <include>home-buttonscroller</include>
        <buttons>
        <button id="142">
          <description>Appearance</description>
          <label>480</label>
          <onclick>ActivateWindow(AppearanceSettings)</onclick>
        </button>
        <button id="143">
          <description>My Videos</description>
          <label>3</label>
          <onclick>ActivateWindow(MyVideosSettings)</onclick>
        </button>
        <button id="144">
            <description>My Music</description>
          <label>2</label>
          <onclick>ActivateWindow(MyMusicSettings)</onclick>
        </button>
        <button id="145">
          <description>My Pictures</description>
          <label>1</label>
          <onclick>ActivateWindow(MyPicturesSettings)</onclick>
        </button>
        <button id="146">
          <description>My Programs</description>
          <label>0</label>
          <onclick>ActivateWindow(MyProgramsSettings)</onclick>
        </button>
        <button id="147">
          <description>My Weather</description>
          <label>8</label>
          <onclick>ActivateWindow(MyWeatherSettings)</onclick>
        </button>
        <button id="148">
          <description>Weather</description>
          <label>705</label>
          <onclick>ActivateWindow(NetworkSettings)</onclick>
        </button>
        <button id="149">
          <description>System</description>
          <label>13000</label>
          <onclick>ActivateWindow(SystemSettings)</onclick>
        </button>
        </buttons>
      </control>
    </controlgroup>

  </controls>
</window>

I need your input on why it won't scroll. Thanks!
your buttonscroller cannot scroll because your "cursor" is not focused on it.
the Default Control of the Window is set to 15 whereas your buttonscroller id is 300. Thus, the "cursor" is currently focused on a control with id 15 which your window doesn't have and therefore, nothing is directing it to id 300 (your scroller).

you can either change the default control of the window (line3) to 300

or if your adding other controls, direct one of them to id 300 using <onleft>, <onright>,<onup>,<ondown> commands, and make sure the window's defaultcontrol points to one of these controls.
Thanks nolimitflip. That cleared up the problem. I guess I forgot to change that when I rewrote the buttonscroller. Thanks again!