Label control: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Manturafs
>Asteron
Line 63: Line 63:
| class="usercell" | '''align'''
| class="usercell" | '''align'''
| class="usercell" | Can be left, right, or center. Aligns the text within the given label <width>. Defaults to left
| class="usercell" | Can be left, right, or center. Aligns the text within the given label <width>. Defaults to left
|- class="userrow"
| class="usercell" | '''aligny'''
| class="usercell" | Can be top or center. Aligns the text within its given label <height>. Defaults to  top
|- class="userrow"
|- class="userrow"
| class="usercell" | '''scroll'''
| class="usercell" | '''scroll'''

Revision as of 21:52, 24 February 2007

The label control is used for displaying text in XBMC. You can choose the font, size, colour, location and contents of the text to be displayed.

Example

<xml>

 <control type="label" id="1">
       <description>My First label</description>
       <posx>80</posx>
       <posy>60</posy>
       <width>250</width>
       <visible>true</visible>
       <align>center</align>
       <scroll>false</scroll>
       <label>6</label>
       <number></number>
       <info>MusicPlayer.Artist</info>
       <haspath>false</haspath>
       font14
       <textcolor>FFB2D4F5</textcolor>
 </control>

</xml>

Multi-Line Labels

If you want your label control to span multiple lines, you can insert a new line character in your label. For example: <xml>

  <label>This will be on the first line
And this will be on the second line</label>

</xml> Also, if you want your label control to conform to the <width> parameter, but still want to be able to give it more content than will fit on one line, then setting: <xml>

  <wrapmultiline>true</wrapmultiline>

</xml> will cause the text to be cut up (at the spaces in the text) onto multiple lines. Note that if a single word is larger than <width> then it will not be cut, and will still overflow.

Tag Descriptions

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 Specifies the control type
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.
posx Specifies where the left of the label should be drawn. This is offset from the window's coordinates (normally the left edge of the screen, or 0). In the case of <align>right</align> however, this specifies the right of the label.
posy Specifies where the top edge of the label should be drawn. This is offset from the window's coordinates (normally the top edge of the screen, or 0).
width Specifies the width that should be used to draw the label. If the text is longer than the label, then it will either be truncated (ending in ...) or will scroll, depending on the <scroll> tag setting.
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.

align Can be left, right, or center. Aligns the text within the given label <width>. Defaults to left
aligny Can be top or center. Aligns the text within its given label <height>. Defaults to top
scroll When true, the text will scroll if longer than the label's <width>. If false, the text will be truncated. Defaults to false.
label

Specifies the text which should be drawn. You should specify an entry from the strings.xml here, however you may also specify a piece of text yourself if you wish, though ofcourse it will not be localisable. You may also specify more than one piece of information here by using the $INFO and $LOCALIZE formats.

info

Specifies the information that should be presented. XBMC will auto-fill in this info in place of the <label>. See here for more information.

number Specifies a number that should be presented. This is just here to allow a skinner to use a number rather than a text label (as any number given to <label> will be used to lookup in strings.xml)
haspath Specifies whether or not this label is filled with a path. Long paths are shortened by compressing the file path while keeping the actual filename full length.
font Specifies the font to use from the font.xml file.
textcolor Specifies the color the text should be, in hex AARRGGBB format.
shadowcolor Specifies the color of the drop shadow on the text, in AARRGGBB format.
angle The angle the text should be rendered at, in degrees. A value of 0 is horizontal.
wrapmultiline If true, any text that doesn't fit on one line will be wrapped onto multiple lines.