List Container

From DevWiki

Jump to: navigation, search

Applications,Boxee GUI API,Controls

Contents


Overview

The list container is one of several containers used to display items from file lists in various ways. The list container is very flexible - it's only restriction is that it is a list - i.e. a single column or row of items. The layout of the items is very flexible and is up to the skinner.


Example

  1. <control type="list" id="50">
  2.    <description>My first list container</description>
  3.    <posx>80</posx>
  4.    <posy>60</posy>
  5.    <width>250</width>
  6.    <height>200</height>
  7.    <visible>true</visible>
  8.    <onup>2</onup>
  9.    <ondown>3</ondown>
  10.    <onleft>1</onleft>
  11.    <onright>1</onright>
  12.    <viewtype label="3D list">list</viewtype>
  13.    <orientation>vertical</orientation>
  14.    <pagecontrol>25</pagecontrol>
  15.    <scrolltime>200</scrolltime>
  16.    <itemlayout width="250" height="29">
  17.       <control type="image">
  18.          <posx>5</posx>
  19.          <posy>3</posy>
  20.          <width>22</width>
  21.          <height>22</height>
  22.          <info>ListItem.Icon</info>
  23.       </control>
  24.       <control type="label">
  25.          <posx>30</posx>
  26.          <posy>3</posy>
  27.          <width>430</width>
  28.          <height>22</height>
  29.          <font>font13</font>
  30.          <aligny>center</aligny>
  31.          <selectedcolor>green</selectedcolor>
  32.          <align>left</align>
  33.          <info>ListItem.Label</info>
  34.       </control>
  35.       <control type="label">
  36.          <posx>475</posx>
  37.          <posy>3</posy>
  38.          <width>300</width>
  39.          <height>22</height>
  40.          <font>font13</font>
  41.          <aligny>center</aligny>
  42.          <selectedcolor>green</selectedcolor>
  43.          <textcolor>grey</textcolor>
  44.          <align>right</align>
  45.          <info>ListItem.Label2</info>
  46.       </control>
  47.    </itemlayout>
  48.    <focusedlayout height="29" width="250">
  49.       <control type="image">
  50.          <width>485</width>
  51.          <height>29</height>
  52.          <posx>0</posx>
  53.          <posy>0</posy>
  54.          <visible>Control.HasFocus(50)</visible>
  55.          <texture>list-focus.png</texture>
  56.       </control>
  57.       <control type="image">
  58.          <posx>5</posx>
  59.          <posy>3</posy>
  60.          <width>22</width>
  61.          <height>22</height>
  62.          <info>ListItem.Icon</info>
  63.       </control>
  64.       <control type="label">
  65.          <posx>30</posx>
  66.          <posy>3</posy>
  67.          <width>430</width>
  68.          <height>22</height>
  69.          <font>font13</font>
  70.          <aligny>center</aligny>
  71.          <selectedcolor>green</selectedcolor>
  72.          <align>left</align>
  73.          <info>ListItem.Label</info>
  74.       </control>
  75.       <control type="label">
  76.          <posx>475</posx>
  77.          <posy>3</posy>
  78.          <width>300</width>
  79.          <height>22</height>
  80.          <font>font13</font>
  81.          <aligny>center</aligny>
  82.          <selectedcolor>green</selectedcolor>
  83.          <textcolor>grey</textcolor>
  84.          <align>right</align>
  85.          <info>ListItem.Label2</info>
  86.       </control>
  87.    </focusedlayout>
  88. </control>


Available Tags

In addition to the Default Control Properties the following tags are available. Note that all XML tags are in lower case.

Element Description Required
orientation The orientation of the list. Defaults to vertical. Yes
pagecontrol Used to set the <id> of the page control used to control this list. No
scrolltime The time (in ms) to scroll from one item to another. By default, this is 200ms. The list will scroll smoothly from one item to another as needed. Set it to zero to disable the smooth scrolling. No
itemlayout Specifies the layout of items in the list. Requires the height attribute set in a vertical list, and the width attribute set for a horizontal list. The <itemlayout> then contains as many label and image controls as required. See here for more information. Yes
focusedlayout Specifies the layout of items in the list that have focus. Requires the height attribute set in a vertical list, and the width attribute set for a horizontal list. The <focusedlayout> then contains as many label and image controls as required. See here for more information. Yes
content Used to set the item content that this list will contain. Allows the skinner to setup a list anywhere they want with a static set of content, as a useful alternative to the grouplist control. No
preloaditems Used in association with the background image loader. No


Available Events

In addition to the Default Control Properties the following tags are available. Note that all XML tags are in lower case.

Element Description Required
onclick The onclick event can be used to catch item selections by the user. By default, Boxee will open the action/info window for the item selected at which point control is lost by the application. Once the onclick code fires, the action/info window will not open so it is up to the developer to launch the content if needed. No


Python Integration

GetList(controlId:Integer):List
Represents a list control in the user interface.

  1. list = mc.GetWindow(14000).GetList(50)


GetFocusedItem

GetFocusedItem():Integer
Returns the index of the focused item in the list. Throws an exception if no item is focused.

  1. itemNumber = mc.GetList(50).GetFocusedItem()


GetItem

GetItem(listIndex:Integer):ListItem
Returns a specific item in the list. Throws an exception if the item does not exist.

  1. itemNumber = mc.GetList(50).GetFocusedItem()
  2. item = mc.GetList(50).GetItem(itemNumber)


GetItems

GetItems():ListItems
Returns all the items in the list.

  1. items = mc.GetList(50).GetItems()


GetSelected

GetSelected():ListItems
Returns all the selected items in the list.

  1. items = mc.GetList(50).GetSelected()


JumpToLetter

JumpToLetter(letterChar:Char):Void
Moves the focus in the list to the first item with the specified letter.

  1. mc.GetList(50).JumpToLetter('b')


Refresh

Refresh():Void
Refreshes the contents of the list.

  1. mc.GetList(50).Refresh()


ScrollPageDown

ScrollPageDown():Void
Scrolls the list one page down for vertical lists or right for horizontal lists.

  1. mc.GetList(50).ScrollPageDown()


ScrollPageUp

ScrollPageUp():Void
Scrolls the list one page up for vertical lists or left for horizontal lists.

  1. mc.GetList(50).ScrollPageUp()


SelectAll

SelectAll():Void
Selects all the items in the list.

  1. mc.GetList(50).SelectAll()


SetContentURL

SetContentURL(rssFeedUrl:String):Void
Sets the list with items from an RSS feed. Please see the RSS specification for supported RSS formats.

  1. mc.GetList(50).SetContentURL("rss://mysite.com/boxee/feed")


SetFocusedItem

SetFocusedItem(listIndex:Integer):Void
Focuses a specific item in the list. Only one item can be focused in the list.

  1. mc.GetList(50).SetFocusedItem(0)


SetItems

SetItems(listItems:ListItems):Void
Loads the list with items.

  1. mc.GetList(50).SetItems(listItems)


SetSelected

SetSelected(listIndex:Integer, selectedItem:Boolean):Void
Selects/unselects an item in the list. Single/multiple selection is defined in the skin.

  1. mc.GetList(50).SetSelected(6, True)


UnselectAll

UnselectAll():Void
Unselect all the items in the list.

  1. mc.GetList(50).UnselectAll()
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox