Access to Objects and their Properties
From iRidium Mobile Wiki
In iRidiumScript you can receive access to objects and their properties in a number of ways:
- Referring by indicating the upper level item:
IR.GetItem("Page 1").GetItem("Item 1").GetState(0).FillColor- Page 1 - a first level item
- Item 1 - a second level item
- GetState(0) - a third level item(1 state)
- FillColor - a fourth level item
- Referring by indicating the page:
IR.GetPage("Page_Name").GetItem("Item_Name")- GetPage("Page_Name") - Referring to the page with the name "Page_Name"
- GetItem("Item_Name") - Referring to the item which is located on the page we refer to
- Referring by indicating the popup:
IR.GetPopup("Popup_Name").GetItem("Item_Name")- GetPopup("Popup_Name") - Referring to the popup with the name "Popup_Name"
- GetItem("Item_Name") - Referring to the item which is located on the popup we refer to
- Referring to the item on the current page:
IR.CurrentPage.GetItem("Item_Name")- IR.CurrentPage - Referring to the current page
- GetItem("Item_Name") - Referring to the item on the current page
- Referring to the item through the variable:
var item = IR.GetPage("Page_Name").GetItem("Item_Name")- item - the variable to which we assign the item we refer to
- IR.GetPage("Page_Name") - Referring to the page with the name "Page_Name"
- GetItem("Item_Name") - Referring to the item which is on the page we refer to
IR.AddListener(IR.EVENT_START,0,function() //Event is activated at the application launch { IR.GetItem("Page 1").GetItem("Item 1").Width = 100; //Referring by GetItem("Item_Name") IR.GetPage("Page 1").GetItem("Item 1").Height = 50; //Referring by GetPage("Page_Name") IR.GetPopup("Popup 1").GetItem("Item 1").Text = "This is text"; //Referring by GetPopup("Popup_Name") IR.CurrentPage.GetItem("Item_Name").Text = "This is item on current page"; //Referring to the current page var item = IR.GetPage("Page_Name") //Writing the object identifier into the variable item.X = 20; //Referring to the object property through the variable }
Each item has several states and each state has its own properties. To refer to a property of a state use GetState(State_Number), where State_Number is the number of the state (numeration begins with zero):
IR.AddListener(IR.EVENT_START,0,function() //Event is activated at the application launch { //Changing the text on the second state of the indicated item(as the numeration begins with zero the number of the second state is 1) IR.GetItem("Page 1").GetItem("Item 1").GetState(1).text = 'This is text on second state'; }