Buttonscrollers: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Theuni
No edit summary
>Ronie
No edit summary
Line 99: Line 99:
| class="usercell" | '''texturefocus'''
| class="usercell" | '''texturefocus'''
| class="usercell" |
| class="usercell" |
Specifies the default image file which should be displayed when a button has focus. This is overridden by the buttons particular focus texture. You can use animated gif's, jpgs, pngs, or bmps. This should be the path to the image file from the media/ folder of your skin directory. XBMC will first look inside the compressed Textures.xpr file, and if not found, will look inside the media/ folder for the actual skin file.
Specifies the default image file which should be displayed when a button has focus. This is overridden by the buttons particular focus texture. You can use animated gif's, jpgs, pngs, or bmps. This should be the path to the image file from the media/ folder of your skin directory. XBMC will first look inside the compressed Textures.xbt file, and if not found, will look inside the media/ folder for the actual skin file.
|- class="userrow"
|- class="userrow"
| class="usercell" | '''texturenofocus'''
| class="usercell" | '''texturenofocus'''

Revision as of 08:13, 24 January 2011

NOTE: This control is now obsolete. You should use a list or panel container with static content instead.

The button scroller control is used for creating a list of buttons in XBMC. You can choose the position, size, and look of each button in the list, what each button does, and the look of the list as a whole.

Example

<control>
      <description>My first buttonscroller control</description>
      <type>buttonscroller</type>
      <id>1</id>
      <posx>80</posx>
      <posy>60</posy>
      <width>250</width>
      <height>200</height>
      <visible>true</visible>
      <texturefocus>myfocustexture.png</texturefocus>
      <texturenofocus>mynormaltexture.png</texturenofocus>
      <font>font12</font>
      <textcolor>FFFFFFFF</textcolor>
      <align></align>
      <aligny></aligny>
      <textoffsetx></textoffsetx>
      <textoffsety></textoffsety>
      <onup>2</onup>
      <ondown>3</ondown>
      <onleft>1</onleft>
      <onright>1</onright>
      <numbuttons>7</numbuttons>
      <buttongap>5</buttongap>
      <orientation>vertical</orientation>
      <defaultbutton>2</defaultbutton>
      <movement>2</movement>
      <alpha>1</alpha>
      <wraparound>true</wraparound>
      <smoothscrolling>true</smoothscrolling>
      <buttons>
        <default>1</default>
        <button id="1">
          <label>0</label>
          <onclick>XBMC.ActivateWindow(MyPrograms)</onclick>
          <texturefocus>programs.png</texturefocus>
          <texturenofocus>programs-nf.png</texturenofocus>
        </button>
        <button id="2">
          <label>5</label>
          <onclick>XBMC.ActivateWindow(MyMusic)</onclick>
          <texturefocus>music.png</texturefocus>
          <texturenofocus>music-nf.png</texturenofocus>
        </button>
        <button id="3">
          <label>3</label>
          <onclick>XBMC.ActivateWindow(MyVideos)</onclick>
          <texturefocus>videos.png</texturefocus>
          <texturenofocus>videos-nf.png</texturenofocus>
        </button>
        <button id="4">
          <label>7</label>
          <onclick>XBMC.ActivateWindow(MyWeather)</onclick>
        </button>
        <button id="5">
          <label>9</label>
          <onclick>XBMC.ActivateWindow(Settings)</onclick>
        </button>
      </buttons>
</control>

Available Tags

Note that each tag is lower case only. This is important, as xml tags are case-sensitive.

description Only used to make things clear for the skinner. Not read by XBMC at all.
type Should be button for a button control.
id Specifies the control's id. The value this takes depends on the control type, and the window that you are using the control on. There are special control id's that must be present in each window. Any other controls that the skinner adds can be any id they like. Obviously they should be unique for buttons, given that they are navigatible, and you want the onup, onleft etc. to make sense.
posx Specifies where the left edge of the button should be drawn. This is offset from the window's coordinates (normally the left edge of the screen, or 0).
posy Specifies where the top edge of the button should be drawn. This is offset from the window's coordinates (normally the top edge of the screen, or 0).
width Specifies the width of the button. The texturefocus and texturenofocus images will be resized to fit into this width.
height Specifies the height of the button. The texturefocus and texturenofocus images will be resized to fit into this height.
visible

Specifies a condition as to when this control will be visible. Can be true, false, or a condition. See here for more information. Defaults to true.

animation

Specifies the animation to be run when the control enters a particular state. See here for more information.

texturefocus

Specifies the default image file which should be displayed when a button has focus. This is overridden by the buttons particular focus texture. You can use animated gif's, jpgs, pngs, or bmps. This should be the path to the image file from the media/ folder of your skin directory. XBMC will first look inside the compressed Textures.xbt file, and if not found, will look inside the media/ folder for the actual skin file.

texturenofocus Specifies the default image file which should be displayed when a button does not have focus. This is overridden by the buttons particular nofocus texture.
font Font used for the button label. From fonts.xml.
textcolor Color used for displaying the button label. In AARRGGBB hex format.
shadowcolor Specifies the color of the drop shadow on the text, in AARRGGBB format.
align Label horizontal alignment on the button. Defaults to left, can also be center or right.
aligny Label vertical alignment on the button. Defaults to top, can also be center.
textoffsetx Amount to offset the label from the left (or right) edge of the button when using left or right alignment.
textoffsety Amount to offset the label from the top edge of the button when using top alignment.
onup Control id to move to when the user moves up off this control.
ondown Control id to move to when the user moves down off this control.
onleft Control id to move to when the user moves left off this control.
onright Control id to move to when the user moves right off this control.
numbuttons Number of buttons shown in the scroller at one time. Defaults to 7.
buttongap Gap (in pixels) between each button in the scroller. Defaults to 5.
orientation Set to horizontal for a horizontal scroller, else it'll be vertical (the default).
defaultbutton The default button slot to highlight with the cursor. Default is 2. 0 is the first slot.
movement The amount of movement the cursor can take before the scroller will scroll. Defaults to 2.
alpha The number of buttons on either side of the default button before fading is applied. Defaults to 0.
wraparound If true, the buttons wrap around inside the scroller (ie going up from button 0 takes you to the last item in the list).
smoothscrolling If true, the buttons scroll smoothly from one slot to the next. If false, they jump positions.
buttons Indicates the start of the button block. See the next section.

The Buttons Block

The <buttons> block is the section that describes the buttons. Each button must have a unique id number, and you can define textures and labels for the button, as well as the action the button performs.

Example

<button id="1">
          <label>0</label>
          <onclick>XBMC.ActivateWindow(MyPrograms)</onclick>
          <texturefocus>programs.png</texturefocus>
          <texturenofocus>programs-nf.png</texturenofocus>
</button>

The buttons are displayed in the button scroller in the order presented in the xml file. The button that is placed in the <defaultbutton> slot is the one with the id given in the tag <default>. If no <default> tag is present, the first button will have focus. The button look is defined by the textures given to it. If no textures are given, then the main button scroller's textures (<texturefocus> and <texturenofocus>) are used.

Available Tags

id

This attribute specifies the buttons id. This should be a unique value between 1 and 200, as it is used by XBMC to track which button is currently focused, for use with the ButtonScroller.HasFocus(id) visibility condition.

label The label used on the button. It can be a link into strings.xml, or an actual text label.
info

The info label used for the button label. Overrides the <label> tag if both are present and the information produces a non-empty string.

onclick

Specifies the action to perform when the button is pressed. Should be a built in function

texturefocus Specifies the image file which should be displayed when the button has focus. If this tag is missing, the main ButtonScroller's <texturefocus> tag will be used.
texturenofocus Specifies the image file which should be displayed when the button does not have focus. If this tag is missing, the main ButtonScroller's <texturenofocus> tag will be used.