Logo Logo en
  • iRidi Pro
    Основные компоненты
    • Приложение i3 Pro
    • iRidi Pro Server
    • iRidi Studio
    • iRidium studio v. 1.3.8 (устаревшая версия)
    Java Script в iRidi
    • Руководство
    • Справочник
    • Примеры
    • JS драйвера
    другие
    • Личный Кабинет
    • iRidium Cloud
    • iRidium Transfer
    • Push-уведомления
    • Лучшая практика
    Лицензирование
    • Лицензирование и передача проекта
    • Оффлайн-лицензирование
    • Активация iRidi Pro Server
  • Продукты
    i3 lite
    • Приложение i3 lite
    • Регистрация и лицензирование
    • Сервер
    • Модули
    KNX Home Server
    • Приложение i3 KNX
    • KNX Home Server
    BUS77 HOME SERVER
    • Приложения Bus77 Home и Bus77 Lite
    • Bus77 Home Server
    Решения
    • BYOD - решение для гостиниц
    • Портал жителя - решение для МКД
    iRidi SCADA
    • iRidi SCADA
  • Bus77
    НАСТРОЙКА BUS77
    • Основы Bus77
    • Приложения Bus77 Home и Bus77 Lite
    • Работа с драйвером Bus77 в iRidi Studio
    • Настройка шины Bus77 в iRidi Studio
    ПРОТОКОЛ BUS77
    • Характеристики CAN (Bus77)
    • Описание протокола
    • Исходники на GitHub
    ОБОРУДОВАНИЕ BUS77
    • Каталог Bus77 Pro
    • Каталог Bus77 Lite
  • Поддерживаемое оборудование
    Драйверы
    • Список драйверов
    • ProAV драйвера
    • AV & Custom Systems
    • JS драйвера
    • Сторонние драйвера и фриланс
    Протоколы и интерфейсы
    • Голосовое управление
    • 1-Wire
    • BACnet IP
    • Bus77
    • KNX
    • KNX IP BAOS
    • Weinzierl kBerry
    • Microsoft Exchange
    • Modbus
    • MQTT
    • NFC
    • ODBC
    • Onvif
    • SIP
    • SNMP
    • Wake On Lan
    • Z-Wave
    • ZigBee
    Производители
    • AMX
    • AVCiT
    • Beckhoff ADS
    • Biamp Tesira
    • Bluesound
    • Casambi
    • BSS Harman
    • Clipsal
    • ControlArt 7Port
    • Crestron
    • DigiBird
    • Domintell
    • Duotecno
    • EIDE
    • EPSNET
    • Global Cache
    • HDL Buspro
    • Helvar
    • IEAST
    • INELS BUS
    • INELS Wireless
    • Intesis
    • Kleger
    • Kramer VIA
    • Kramer 3000
    • Larnitech
    • Legrand Netatmo
    • LG TV
    • Lutron
    • Lutron Homeworks QS
    • MyHome
    • Nest
    • Novastar
    • Panasоnic PTZ
    • Philips Dynalite
    • PJLink
    • Satel
    • SamsungTV
    • Sonos
    • Somfy
    • SpinetiX
    • Televic Conference
    • TIS
    • Tion
    • URRI
    • Velbus
    • Velocio
    • Vinteo
    • WyreStorm
    • WiiM
    • Xicato
    • Yamaha
    • ZONT
    • Z-Wave.me
    Протестированное оборудование
    • Панель HDL S57
    • Панель HDL S10
    • SIP-домофон
    • Akuvox
    • Arlight
    • Divus
    • QBic TD-1050 PRO
    • QBic TD-1060 Slim
    • QBic TD-1070
    • Sigur
    • Uni-Ubi
    • Velocio
  • Оборудование iRidi

    Серверы
    • HS Сервер
    • ProAV Control Processor Basic
    • ProAV Control Processor Advanced
    • Спецификация контроллеров UMC
    • Настройка контроллера UMC C2
    • Настройка контроллера UMC C3
    • Настройка контроллера HDL IntelliCenter 2 (UMC C4)
    Модули расширения
    • I-PX-RS1
    • I-PX-RS4
    • I-PX-IR3
    KNX
    • KNX Home Server
    • KNX IP Interface
    Панели управления
    • iRidium Panel 7
    • Touch Panel P3
    • Touch Panel P6
    • Touch Panel P8
    • Touch Panel P10
    • Tabletop Touch Panel 10
    • AV Remote Control
    ОБОРУДОВАНИЕ BUS77
    • Каталог Bus77 Pro
    • Каталог Bus77 Lite
    • Differences
iRidium mobile web-site
Содержание
    Инструменты‌
    • Сведения о странице
    • Постоянная ссылка
    • Версия для печати
    • Спецстраницы
    • Связанные правки
    • Ссылки сюда
    Login / Create Account
    Материал из for iRidium developers
    Перейти к: навигация, поиск
    Эта страница является переводом страницы List API. Перевод выполнен на 100%.

  • Handbook
  • Lists
  • Содержание

    • 1 API iRidium. Lists
    • 2 Events
      • 2.1 IR.EVENT_ITEM_SELECT
      • 2.2 IR.EVENT_LIST_ITEM_CHANGE
      • 2.3 IR.EVENT_LIST_SCROLL
    • 3 IR.ITEM_LISTBOX (List)
      • 3.1 IR.CreateItem()
      • 3.2 .CreateItem()
      • 3.3 .DeleteItem()
      • 3.4 .Clear()
      • 3.5 .SetPosition()
      • 3.6 .SetStrictPositionByIndex()
      • 3.7 Properties
    • 4 IR.ITEM_GOOD_LIST
      • 4.1 IR.CreateItem()
      • 4.2 .Adapter
      • 4.3 .SetSelected()
      • 4.4 .Update()
      • 4.5 .GetSelected()
      • 4.6 .ClearSelected()
      • 4.7 Properties
    • 5 Static List
      • 5.1 .AddPopup()
      • 5.2 .RemovePopup()
      • 5.3 .SetPosition()
      • 5.4 .Clear()
    • 6 IR.ITEM_PICKER
      • 6.1 IR.CreateItem()
      • 6.2 Properties
      • 6.3 Getting values from the picker
      • 6.4 IR.EVENT_PICKER_SCROLL

    API iRidium. Lists

    methods, events and parameters for working with dynamic lists which can be filled with JS in during application work


    Events

    An event - a process forwarded to scripts with an identifier for monitoring.

    A listener - it is a function which is executed if the event set for it is activated

    Add a listener using the method IR.AddListener

    IR.AddListener(event, input, action);
    • event - the identifier of the event monitored by the listener
    • input - the input parameter required for creating the listener. If there is not such parameter indicate 0
    • action - the unnamed function or the link to the named function in which the actions are performed



    IR.EVENT_ITEM_SELECT

    the identifier of the event which is activated when clicking on a list item. Get the link to the List object with the help of the IR.GetItem() method.

    Syntax

    IR.AddListener(IR.EVENT_ITEM_SELECT, list, function, [pointer]);

    input value description
    list IR.GetItem("Page 1").GetItem("List 1") type: object
    a link to an item - a list
    function function(itemID, subItemID, index) {} type: function
    the unnamed function or reference to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output
    itemID 2 type: number
    the list item which is clicked, beginning with 0
    subItemID 1 type: number
    the list subitem which is clicked
    • 0 - the subitem
    • 1...n - the item on the subitem, in the order of displaying in the editor
    index 1 type: number
    index of the item in the list, starting from 0.

    In case of dynamic deletion of list items, itemID and index do not match.


    Sample

    IR.AddListener(IR.EVENT_ITEM_SELECT, IR.GetItem("Page 1").GetItem("List 1"), function(itemID, subItemID, index) {
    IR.Log("pressed "+itemID+" / "+subItemID);
    });





    IR.EVENT_LIST_ITEM_CHANGE

    the identifier of the event which is activated when pressing on the list, releasing or moving it (Press, Release and Move). The event provides access for reading and writing to all subitem properties. It considerably expands functions of lists. Get the link to the List with the method IR.GetItem().

    Syntax

    IR.AddListener(IR.EVENT_LIST_ITEM_CHANGE, list, function, [pointer]);

    input value description
    list IR.GetItem("Page 1").GetItem("List 1") type: object
    a link to an item - a list
    function function(itemID, subItemID, event_type, object, index) {} type: function
    the unnamed function or reference to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output
    itemID 2 type: number
    the list item which is clicked, beginning with 0
    subItemID 1 type: number
    the list subitem which is clicked
    • 0 - the subitem
    • 1...n - the item on the subitem, in the order of displaying in the editor
    event_type IR.EVENT_LIST_ITEM_PRESS type: number
    the type of the occurred event:
    • IR.EVENT_LIST_ITEM_PRESS - pressing the item,
    • IR.EVENT_LIST_ITEM_RELEASE - releasing the item,
    • IR.EVENT_LIST_ITEM_MOVE - moving the item,
    • IR.EVENT_LIST_ITEM_HOLD - holding the item,
    • IR.EVENT_LIST_ITEM_END_HOLD - releasing the item after holding.
    object [Object DialogItemPrototype] type: object
    the link to the list subitem which is changed. It provides access to subitem properties for reading and writing
    index 1 type: number
    index of the item in the list.

    In case of dynamic deletion of list items, itemID and index do not match.


    Sample

    IR.AddListener(IR.EVENT_LIST_ITEM_CHANGE, list, function(itemID, subItemID, event_type, object, index) {
     
        IR.Log("itemID " + itemID + ", subItemID " + subItemID + ", index " + index + ", object " + object.Name);
     
        switch(event_type)
        {
            case IR.EVENT_LIST_ITEM_PRESS:
            {
                IR.Log("Pressed");
                break;
            }
     
            case IR.EVENT_LIST_ITEM_RELEASE:
            {
                IR.Log("Relesed");
                break;
            }
     
            case IR.EVENT_LIST_ITEM_MOVE:
            {
                IR.Log("Move");
                break;
            }
     
            case IR.EVENT_LIST_ITEM_HOLD:
            {
                IR.Log("Hold");
                break;
            }
     
            case IR.EVENT_LIST_ITEM_END_HOLD:
            {
                IR.Log("End Hold");
                break;
            }
        }
    });

    the list of possible subitem properties (object) see in API iRidium. Pages and items

    the tree of items parentage:

    • Page / Popup - the page/popup
      • List - the list
        • Item - the list item
          • Subitem - the list subitem




    IR.EVENT_LIST_SCROLL

    ID of an event that works at Press, Release and Move. The event gives information about the current position of the list, the direction of scrolling and the fact of reaching the limits of the list (top or bottom).
    If Static List is used as a list, the method works only if Static list has Center property.

    Syntax

    IR.AddListener(IR.EVENT_LIST_SCROLL, list, function, [pointer]);

    input value description
    list IR.GetItem("Page 1").
    GetItem("List 1")
    type: object
    a link to an item - a list
    function function(in_pos, in_direction, in_edge) {} type: function
    the unnamed function or reference to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output
    in_pos 2 type: number
    the utmost top (for a vertical list) ot the utmost left (for a horizontal list) which is displayed at the moment (starting with 0)
    in_direction 3 type: number
    the direction of scrolling:
    0 - to the right,
    1 - to the left,
    2 - down,
    3 - up
    in_edge 1 type: number
    a maker that the beginning or the end of a list is reached:
    1 - a list is scrolled to the limit,
    0 - a list is not scrolled to the limit


    Sample

    var list = IR.GetItem("Page 1").GetItem("List 1");
    IR.AddListener(IR.EVENT_LIST_SCROLL, list, function(in_pos, in_direction, in_edge) {
      IR.Log("POSITION " + in_pos);
      IR.Log("DIRECTION " + in_direction);
      IR.Log("EDGE " + in_edge + "\n"); 
    });





    IR.ITEM_LISTBOX (List)

    Methods used when working with dynamic lists: graphic items with the List type.

    IR.CreateItem()

    create a List graphic item on the current page of the project. The page can be determined with the help of the IR.CurrentPage method. To create an item on some page you are required to apply the CreateItem() method to the link to the Page or Popup object. The link is received with the help of the IR.GetItem() method.

    Syntax

    IR.CreateItem(IR.ITEM_LISTBOX, name, X, Y, width, height);

    input value description
    name "Button 1" type: String
    item name, unique for the page
    X 30 type: Number
    the X coordinate
    Y 40 type: Number
    the Y coordinate
    width 200 type: Number
    the item width
    height 500 type: Number
    the item height
    output
    Object [Object DialogItemPrototype] type: Object
    the graphic item instance


    Sample

    IR.AddListener(IR.EVENT_START,0, function()
    {
        var src = IR.CreateItem(IR.ITEM_LISTBOX,"List 1",30,40,200,500); 
        IR.Log(src); // [Object DialogItemPrototype]
    });

    To create a dialog item on a particular page apply .CreateItem() to the link to the page or popup:

        var list_1 = IR.GetItem("Page 1").CreateItem(IR.ITEM_LISTBOX,"List 1",30,40,200,500); 
        IR.Log(list_1) // [Object DialogItemPrototype]  // create list and get the link in one action

    In the constructor you can see only basic item properties without which the item cannot be created. All items also have a set of additional properties and a set of properties characteristic for the selected item type. See the section Properties.


    .CreateItem()

    create a new item of the List item. To create a list item you need to get the link to the List object with the help of the IR.GetItem() method.

    Syntax

    list.CreateItem(item, subitem, {property: value, ...});

    input value description
    list IR.GetItem("Page 1").GetItem("Item 1") type: Object
    the link to list
    item 0 type: Number
    the list item beginning with 0
    subitem 1 type: Number
    the list subitem number (item in the list item); 0 - the item, 1...n - subitems by the order of creation in the editor
    property Text type: String
    the subitem property, the list is identical to the graphic item properties
    value 'text' type: String, Number
    the value to be written in the indicated property
    output
    Object [Object DialogItemPrototype] type: Object
    the graphic item instance


    Sample

    IR.AddListener(IR.EVENT_START, 0, function()
    {
      var List_1 = IR.GetItem("Page 1").GetItem("List 1");
      List_1.CreateItem(0, 1, {Text: "Hello"}); 
    });

    You can use CreateItem() method to edit item in List. Send the new property to the item that already exist to change this property.

    CreateItem() method does not work with the new methonds for lists.


    .DeleteItem()

    delete an item of the List item. In order to do that yoг need to receive the link to the List object with the help of the IR.GetItem() method.

    Syntax

    list.DeleteItem(item);

    input value description
    list IR.GetItem("Page 1").GetItem("Item 1") type: Object
    the link to list
    item 0 type: Number
    the list item beginning with 0
    output

    -


    Sample

    IR.AddListener(IR.EVENT_START, 0, function()
    {
      var List = IR.GetItem("Page 1").GetItem("List 1");
      List.DeleteItem(0); // delete first point of list
    });





    .Clear()

    delete all items of the List item. In order to do that you need to get the link to the List object with the help of the IR.GetItem() method.

    Syntax

    list.Clear();

    input value description
    list IR.GetItem("Page 1").GetItem("Item 1") type: Object
    the link to list
    output

    -


    Sample

    IR.AddListener(IR.EVENT_START, 0, function()
    {
      var List = IR.GetItem("Page 1").GetItem("List 1");
      List.Clear(); // clear list
    });





    .SetPosition()

    scroll the list to the indicated position. In order to do that you need to get the link to the List object with the help of the IR.GetItem() method.

    Syntax

    list.SetPosition(item);

    input value description
    list IR.GetItem("Page 1").GetItem("Item 1") type: Object
    the link to list
    item 0 type: Number
    the list item beginning with 0
    output

    -


    Sample

    IR.AddListener(IR.EVENT_START, 0, function()
    {
      var List = IR.GetItem("Page 1").GetItem("List 1");
      List.SetPosition(12); // go to point
    });

    for scrolling the list to the indicated item:

    • the item had to exist
    • at the moment of command execution the list has to be seen - the page/popup containing the list has to be opened
    • it should be not less than 100 ms after creating a new list item - the command for scrolling will not be executed right after the command for creating a new list item.




    .SetStrictPositionByIndex()

    scroll the list to the indicated position. To do it, get a link to the List object with the help of the IR.GetItem() method.

    .SetStrictPositionByIndex() method is a more precise realization of .SetPosition() method, but it works slower. This method works better in case items in the list have different sizes. It considers the individual size of items in the list. If items in the list have the same size, it's recommended to use .SetPosition().

    Syntax

    list.SetStrictPositionByIndex(item);

    input value description
    list IR.GetItem("Page 1").GetItem("Item 1") type: Object
    the link to a list
    item 0 type: Number
    the number of a list item beginning with 0
    output

    -


    Sample

    IR.AddListener(IR.EVENT_START, 0, function()
    {
      var List = IR.GetItem("Page 1").GetItem("List 1");
      List.SetStrictPositionByIndex(12); // go to point
    });

    to scroll a list to the indicated item:

    • the item has to exist
    • at the moment of command execution the list has to be seen - the page/popup containing the list has to be opened
    • at least 100 ms must pass after creating a new list item - a command to scroll is not executed right after a command to create a new list item.




    Properties

    Properties of graphic items with the List type:

    IR.GetItem(page/popup).GetItem(list).property

    Template "Popup 1" type: string
    enables you to set up or request a template for list subitems (the template is one of the project popups)
    Direction 0 type: number
    enables you to set up or request the direction of list scrolling:
    • 0 - vertical list
    • 1 - horizontal list
    ItemsCount 24 type: number
    enables you to request the number of list items
    Filter "A" type: string
    enables you to filter list items by their names (part of the name)
    ScrollEnabled true type: boolean
    enables you to disable the possibility of scrolling the list manually, from the interface. At that the .SetPosition method will still work.
    var list = IR.GetItem("Page 1").GetItem("List 1");
    //** Template **//
    IR.Log(list.Template); // "Popup 1"
    list.Template = "Popup 2"; // change template if exist
    //** Direction **//
    IR.Log(list.Direction); // 1
    list.Direction = 0;  // change direction
    //** ItemsCount **//
    IR.Log(list.ItemsCount); // 24
    //** Filter **//
    list.CreateItem(0, 0, {Text: "Curriculum", Name:"Curriculum"});
    list.CreateItem(1, 0, {Text: "Privacy", Name: "Privacy"});  
    list.Filter = "C"; // "Privacy" will be filtered out, "Curriculum" showed
    IR.Log(list.Filter); // "C"
    //** ScrollEnabled **//
    list.ScrollEnabled = true; // list can be flipped manually
    list.ScrollEnabled = false; // list cannot be flipped manually


    IR.ITEM_GOOD_LIST

    Methods used when working with dynamic lists: graphic items with the "Good List" type. Good List is the new version of Listbox with the better possibilities for displaying of big number of items

    IR.CreateItem()

    сreate a List graphic item on the current page of the project. The page can be determined with the help of the IR.CurrentPage method. To create an item on some page you are required to apply the CreateItem method to the link to the Page or Popup object. The link is received with the help of the IR.GetItem() method.

    Syntax

    IR.CreateItem(IR.ITEM_GOOD_LIST, name, X, Y, width, height, infinity);

    input value description
    name "GList 1" type: String
    the item name, unique for the page
    X 30 type: Number
    the X coordinate
    Y 40 type: Number
    the Y coordinate
    width 200 type: Number
    the item width
    height 500 type: Number
    the item height
    infinity false type: Boolean
    Whether the list is closed. If true, after the last item in the list, the list's starting items will be displayed
    output
    Object [Object DialogItemPrototype] type: Object
    the graphic item instance


    Sample

    IR.AddListener(IR.EVENT_START,0, function()
    {
        var GList = IR.CreateItem(IR.ITEM_GOOD_LIST, "GList 1", 20, 20, 250, 600, false); 
        IR.Log(GList) // [Object DialogItemPrototype]
    });

    To create a dialog item on a particular page apply .CreateItem() to the link to the page or popup:

        var list_1 = IR.GetItem("Page 1").CreateItem(IR.ITEM_GOOD_LIST, "GList 1", 20, 20, 250, 600); 
        IR.Log(list_1) // [Object DialogItemPrototype]  // create list and get the link in one action

    In the constructor you can see only basic item properties without which the item cannot be created. All items also have a set of additional properties and a set of properties characteristic for the selected item type. See the section Properties.


    .Adapter

    An object that allows you to work with individual list items to fill them, monitor the activity, modify properties, etc.

    Syntax

    GList.Adapter = {}

    input value description

    -

    output

    -


    Sample

    GList.Adapter = {
       total       :  8,  // total number of states after the list creation
       GetCount    :  function () {return this.total}, //makes "total" property available for external functions
       GetItem     :  function (in_nPos) {},  // function will be called separately for each created item of list. Here you can select template of item, change their properties. in_nPos - index of list item
       SetSelected :  function (in_oItem, in_bSelected) {} //  function will be called separately for each created item of list. It returns the link to list item as an object (popup) and the state of activity of this item - is it selected in list or not
    }

    An example of implementation, the list of methods and properties:

    function good_list (list_item, template) 
    {
       var l_list = list_item;
       var l_oTemp = IR.GetItem(template);
     
       l_list.GetState(0).Color = 0xFFFFFFFF;
       l_list.SelectMode = 1; // 0 - cannot select, 1 - one selected item, 2 - any number of items can be marked as selected  
       l_list.Direction = 1;  // 0 - horisontal from left to right, 1 - vertical from up to down
     
       l_list.Adapter = {
          //number of list items at start
          total: 8,   
     
          //function to count the number of list items
          GetCount : function ()  
          {   
       			return this.total;    
                //use as: IR.Log("Total number of items in list = " + l_oGList.Adapter.GetCount())
          }, 
     
          //function to work with list items    
          GetItem: function(in_nPos)  
          {   
             var l_oItem = l_oTemp.Clone("" + in_nPos);   // use popup as template of List item
             l_oItem.GetItem("Item_name").Text = in_nPos; // display the popup position at each list item
     
             // when press to popup in list
             IR.AddListener(IR.EVENT_ITEM_RELEASE, l_oItem, function () 
             {
                l_list.SetSelected(l_oItem);   // mark item as selected 	
       		}); 
     
             // when press to some item of popup in list
             IR.AddListener(IR.EVENT_ITEM_RELEASE, l_oItem.GetItem("Add"), function () 
             {
       		   l_list.Adapter.total += 1;   //add one more list item
                //l_list.Adapter.total -= 1;   //delete the last item of list
                l_list.Position = l_list.Adapter.total+1; // go to the last position of list         
                l_list.Update();   //update list when change the number of items in list from inside or outside
       		});
     
             return l_oItem;   //get object item
       	},
     
          //function to work with selected items
          SetSelected : function (in_oItem, in_bSelected)  
          {   
             if (in_bSelected == true) 
             {
                //IR.Log("selected > "+in_oItem.Name);
                in_oItem.GetItem("Selector").Value = 1;
             } else  in_oItem.GetItem("Selector").Value = 0;
          }     
       };
       return l_list;
    }
     
    var l_oGList1 = new good_list(IR.GetPage("Page 1").CreateItem(IR.ITEM_GOOD_LIST, "ConList", 16, 16, 320, 600), "Popup 1");
    var l_oGList2 = new good_list(IR.GetPage("Page 1").CreateItem(IR.ITEM_GOOD_LIST, "ConList_2", 352, 16, 320, 600), "Popup 1");  
     
    /***** List Of Methods
    *
    *  l_oGList1.SetSelected(l_oItem)                               // mark list position as selected
    *  l_oGList1.Update()                                           // update list when change the number of items
    *  IR.DeleteItem(l_oGList1)                                     // remove List object
    *
    *  l_oGList1.Adapter.GetCount()                                 // get total number of list positions
    *  l_oGList1.Adapter.GetItem(4).GetItem("Item_name").Text       // get list position by index
    *  l_oGList1.Adapter.GetItem("4").GetItem("Item_name").Text     // get list position by name
    *  l_oGList1.Adapter.total                                      // get or change total number of list positions
    *
    *  l_oGList1.SelectMode                                         // 0 - cannot select, 1- one selected item, 2 - any number of items can be marked as selected
    *  l_oGList1.GetState(0).Color                                  // color of List substate
    *  l_oGList1.Direction                                          // 0 - horisontal from left to right, 1 - vertical from up to down
    *  l_oGList1.Position                                           // set or get the current list position
    *
    *****/

    SAMPLE


    .SetSelected()

    mark the list item as a selected. The possibility of marking of items depends on .SelectMode property

    Syntax

    list.SetSelected(item-object);

    input value description
    list IR.GetItem("Page 1").GetItem("GList 1") type: Object
    the link to list
    item-object [Object DialogItemPrototype] type: object
    the list item
    output

    -


    Sample

    var l_oTemp = IR.GetItem("Popup 1");
    l_list.Adapter = {
          GetItem: function(in_nPos)  
          {   
             var l_oItem = l_oTemp.Clone("" + in_nPos);   // use popup as template of List item
             IR.AddListener(IR.EVENT_ITEM_RELEASE, l_oItem, function () 
             {
                l_list.SetSelected(l_oItem);   // mark item as selected on Release 	
       		}); 
          }   
    }





    .Update()

    to update the list. Used after changing the number of items in the list

    Syntax

    list.Update();

    input value description

    -

    output

    -


    Sample

    var l_oTemp = IR.GetItem("Popup 1");
    l_list.Adapter = {
          GetItem: function(in_nPos)  
          {   
             var l_oItem = l_oTemp.Clone("" + in_nPos);   // use popup as template of List item
             IR.AddListener(IR.EVENT_ITEM_RELEASE, l_oItem, function () 
             {
                l_list.Adapter.total += 1;
                l_list.Update();  // update list if number of items has been changed
       		}); 
          }   
    }





    .GetSelected()

    Get list of selected items

    Syntax

    list.GetSelected();

    input value description

    -

    output

    Array of selected elements


    Sample

    IR.AddListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("Item 1"), function()
    {
      var SelectedBuffer = l_oGList1.GetSelected();
      IR.Log("SelectedBuffer = " + SelectedBuffer );
    });





    .ClearSelected()

    Clear selection of all selected elements

    Syntax

    list.ClearSelected();

    input value description

    -

    output

    -


    Sample

    IR.AddListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("Item 2"), function()
    {
       l_oGList1.ClearSelected();
    });





    Properties

    The properties of graphic items with the Good List type:


    IR.GetItem(page/popup).GetItem(good_list).property


    .SelectMode 1 type: number
    control of possibility to select the item of list:
    • 0 - not possible to select item
    • 1- only one item can be selected at a time
    • 2- several items can be selected at a time
    .Direction 0 type: number
    allows you to set the direction of the list scrolling:
    • 0 - a horizontal list (from left to right)
    • 1 - a vertical list (from top to bottom)
    .Position 10 type: number
    Allows to set of get the current list position
    .GetState(0).Color 0xFFFFFFFF type: RGBA
    allows to change the background color of the list
    .Adapter.total 24 type: number
    allows to query the number of items in the list
    .Adapter.Item.Subitem.Property type:
    allows to access the properties of items and sub-items of a list when referring to items by name or ID (from zero). The sub-items you can call by name. The list of properties, see in GUI API: Properties of graphic elements and their States
    .infinity false type: Boolean
    allows to loop the list
    (true - looped, false - not looped)
    .StopByTap 1 type: number
    allows you to stop the list when you touch it:
    • 0 - do not stop the list when touched
    • 1 - stop the list when touched


    Static List

    Static List is a graphic item inside which you can scroll popups. it is used for creating menus controlled with the help of gestures.

    Static List cannot be crated from JS but it is possible to add and remove popups from it, turn over to the needed place. For the moment it is not possible to determinate the current position of a Static List.

    JS methods of Static List:

    // get a link to the Static List as an object
    var st_list = IR.GetItem("Page 1").GetItem("Static List Item 1") 
     
    // methods
    st_list.AddPopup("Popup 1") // add a popup to the end of Static List (by name)
    st_list.RemovePopup("Popup 1") // remove a popup from the Static List (by name)
    st_list.SetPosition(0) // set the position of the Static List by the index from 0
    st_list.Clear() // clear the Static List (romove all popups)


    .AddPopup()

    add the popup at the end of the list Static List. It is needed to get a reference to the Static List as an object using the method IR.GetItem().

    Syntax

    st_list.AddPopup(popup_name);

    input value description
    st_list IR.GetItem("Page 1").GetItem("Item 1") type: Object
    link to Static List
    popup_name "Popup 1" type: string
    the name popup that will be added to the end of the list
    output

    -


    Sample

    IR.AddListener(IR.EVENT_START, 0, function()
    {
      var st_list = IR.GetItem("Page 1").GetItem("Static List 1");
      st_list.AddPopup("Popup 1");
    });





    .RemovePopup()

    remove the popup from the Static List by name. Remove by index is not supported. It is needed to get a reference to the Static List as an object using the method IR.GetItem.

    Syntax

    st_list.RemovePopup(popup_name);

    input value description
    st_list IR.GetItem("Page 1").GetItem("Item 1") type: Object
    link to Static List
    popup_name "Popup 1" type: string
    the name popup that you need to remove from the list
    output

    -


    Sample

    IR.AddListener(IR.EVENT_START, 0, function()
    {
      var st_list = IR.GetItem("Page 1").GetItem("Static List 1");
      st_list.RemovePopup("Popup 1");
    });





    .SetPosition()

    move the Static List on a specified position by index. The index starts from 0.

    Syntax

    st_list.SetPosition(position);

    input value description
    st_list IR.GetItem("Page 1").GetItem("Item 1") type: Object
    link to Static List
    position 0 type: number
    list position to move
    output

    -


    Sample

    IR.AddListener(IR.EVENT_START, 0, function()
    {
      var st_list = IR.GetItem("Page 1").GetItem("Static List 1");
      st_list.SetPosition(1);
    });





    .Clear()

    remove all popups from the Static List

    Syntax

    st_list.Clear();

    input value description
    st_list IR.GetItem("Page 1").GetItem("Item 1") type: Object
    link to Static List
    output

    -


    Sample

    IR.AddListener(IR.EVENT_START, 0, function()
    {
      var st_list = IR.GetItem("Page 1").GetItem("Static List 1");
      st_list.Clear();
    });





    IR.ITEM_PICKER

    Methods used to work with a picker Picker.

    IR.CreateItem()

    create a picker graphical item on a current pager or a popoup of a project. To create an item on any page use CreateItem() method to a link to a Page or a Popup. The link is received with the help of the following method IR.GetItem().

    Syntax

    IR.CreateItem(IR.ITEM_PICKER, name, {parameter});

    input value description
    name "picker" type: String
    item name, unique for the page
    X 30 type: Number
    X axis coordinates
    Y 40 type: Number
    Y axis coordinates
    Min 0 type: Number
    minimal value of the picker
    Max 100 type: Number
    maximal value of the picker
    Template IR.GetPopup("Template_Picker") type: Popup
    string template of Picker item
    Items ["January", "February"] type: Array
    value array of a picker (used instead of min/max)
    Step 10 type: Number
    picker step
    Position 3 type: Number
    default value (starting with 0)
    Direction 0/1 type: Number
    Direction of scroll. 0 - horizontal, 1 - vertical.
    VisibleCount 3, 5, 7, 9 ... type: Number
    The number of visible items displayed on the reel. The number must be positive and odd. The number should not exceed the number of scroll elements (default value is 3) .
    output
    Object [Object DialogItemPrototype] type: Object
    graphic item instance


    Sample

    //create picker with min/max values
    var picker = IR.GetItem("Page1").CreateItem(IR.ITEM_PICKER, "picker", {
          X: 55,
          Y: 6,
          Min: 1, // min value
          Max: 31, // max value
          Template: IR.GetPopup("Template Picker")
        });
     
    //create picker with array
    var picker = IR.GetItem("Page1").CreateItem(IR.ITEM_PICKER, "picker", {
          X: 35,
          Y: 0,
          Items: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], //array
         Template: IR.GetPopup("Template Picker")
        });





    Properties

    Picker properties

    IR.GetItem(page/popup).GetItem(picker).property

    ItemsCount 15 type: number
    allows to request the number of items in a picker
    SelectedIndex 2 type: number
    allows to request the index of the current posision of the picker
    var picker = IR.GetItem("Page 1").getItem("picker");
    //** ItemsCount **//
    IR.Log(picker.ItemsCount); // 15
    //** SelectedIndex **//
    IR.Log(picker.SelectedIndex); //2

    Getting values from the picker

    Value can be received by requesting Value property of Picker

    IR.AddListener(IR.EVENT_ITEM_RELEASE, IR.GetItem(“Page 1”).GetItem("Done_Button"), function() {
        var Day = parseInt(DayPicker.Value); // Day (number)
        var Month = MonthPicker.Value; // Month (string)
        var Year = parseInt(YearPicker.Value); // Year (number)
        IR.Log("Date: " + Day + ", Month: " + Month + ", Year: " + Year); // Logging
      });
    Example:
    • download

    IR.EVENT_PICKER_SCROLL

    This method is used to define how the drum is scrolled. After one drum is scrolled, the appearance of another drum may change. For example, the number of days can change depending on the selected month.

    Syntax

    IR.AddListener(IR.EVENT_PICKER_SCROLL, picker, function (in_pos), [pointer]);

    input value description
    picker IR.GetItem("Popup 1").GetItem("midPicker"); type: object
    link to item
    function function(in_pos){} type: function
    unnamed function or a function call
    pointer - type: object
    a pointer to an object that services a function (optional)
    output
    in_pos 2 type: number
    current position of a drum after a scroll ()


    Sample

    IR.AddListener(IR.EVENT_PICKER_SCROLL, MidPicker, function(in_position){                
     
            if (in_position == 3 || in_position == 5 || in_position == 8 || in_position == 10) {          //set the left drum to 1...30 range          
     
                   var item_test = IR.GetPopup("Remote").GetItem("leftPicker"); 
                   IR.DeleteItem(item_test);
     
                   in_oRemotePopup.CreateItem(IR.ITEM_PICKER, "leftPicker", {
                      X: _Left.X - 55,
                      Y: _Left.Y + 6,
                      Min: 1, // Interval
                      Max: 30, //  Interval
                      VisibleCount: 3, //3,5,7,...
                      Template: IR.GetPopup("Template Picker")
                   });  
     
            }
     else if(in_position == 0 || in_position == 2 ||  in_position == 4 || in_position == 6 || in_position == 7 || in_position == 9 || in_position == 11) {    //set the left drum to 1...31 range                                                                      
     
                   var item_test = IR.GetPopup("Remote").GetItem("leftPicker"); 
                   IR.DeleteItem(item_test);
     
                   in_oRemotePopup.CreateItem(IR.ITEM_PICKER, "leftPicker", {
                      X: _Left.X - 55,
                      Y: _Left.Y + 6,
                      Min: 1, // Interval
                      Max: 31, //  Interval
                      VisibleCount: 3, //3,5,7,...
                      Template: IR.GetPopup("Template Picker")
                   });   
     }
    else if(in_position == 1){                                   //set the left drum to 1...28 range  
     
                   var item_test = IR.GetPopup("Remote").GetItem("leftPicker"); 
                   IR.DeleteItem(item_test);
     
                   in_oRemotePopup.CreateItem(IR.ITEM_PICKER, "leftPicker", {
                      X: _Left.X - 55,
                      Y: _Left.Y + 6,
                      Min: 1, // Interval
                      Max: 28, // Interval
                      VisibleCount: 3, //3,5,7,...
                      Template: IR.GetPopup("Template Picker")
                   });       
              }                                   
       });  
     }




    Example of chaning appearance of the date drum depending on the selected month :
    • download
    Источник — «https://dev.iridi.com/index.php?title=List_API/en&oldid=128747»
    Категория:
    • Инструкции
    About us
    Company
    Team
    History
    Philosophy
    Rewards
    Partnership
    Our partner
    Partnership Programs
    Apply for partnership
    products
    iRidium pro
    iRidium lite
    iRidium gate
    iRidium server
    Loads
    iRidium pro
    iRidium lite
    Other version
    Marketing materials
    Support
    On-line courses/Video
    Recommended equipment
    Other version
    iRidium pro
    Documentation
    FAQ
    Forum
    iRidium lite
    Documentation
    Forum
    Projects
    Standart projects
    Smart buildings
    Smart house
    Special solution
    Find a dealer
    News
    Youtube
    Twitter
    VK
    Logo
    contact@iridi.com
    +7 (499) 322-73-29

    Privacy policy