Материал из for iRidium developers
Перейти к: навигация, поиск
Эта страница является переводом страницы GUI API. Перевод выполнен на 100%.

Other languages:
English • ‎русский

Methods

IR object - it is a global object containing all iRidium API functions and constants . Methods of the IR object enable reference to pages and popups of visualization interfaces. They also enable executions of commands related to OS work.
The chain of commands applied to the IR object provide access to any interface object and enable reference to properties. The object hierarchy: IR > Page / Popup > Item > State.


IR.CreateItem

to create a graphic item on the current project page. The page can be determined with the help of CurrentPage property of IR object. To create an item on a random page, use the CreateItem method to the reference to the Page/Popup object received with the help of the IR.GetItem method.

Syntax

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

input value description
item_type IR.ITEM_BUTTON type: Object
the graphic item type
name "Button 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 800 type: Number
the item width
height 150 type: Number
the item height
output
Object [Object DialogItemPrototype] type: Object
the instance of the graphic item


Sample

IR.AddListener(IR.EVENT_START,0, function()
{
    var src = IR.CreateItem(IR.ITEM_BUTTON,"Button 1",30,40,800,150); 
    IR.Log(src) // [Object DialogItemPrototype]
});

Types of dialog items:

  • IR.ITEM_PAGE - Page
  • IR.ITEM_POPUP - Popup
  • IR.ITEM_BUTTON - Button
  • IR.ITEM_TRIGGER_BUTTON - Trigger Button
  • IR.ITEM_MUTI_STATE_BUTTON - Multistate Button
  • IR.ITEM_UPDOWN_BUTTON - Up/Down Button
  • IR.ITEM_LEVEL - Level
  • IR.ITEM_MUTI_STATE_LEVEL - Multistate Level
  • IR.ITEM_EDIT_BOX - EditBox
  • IR.ITEM_VIRTUAL_KEY_BUTTON - Virtual Key
  • IR.ITEM_JOYSTICK - Joystick
  • IR.ITEM_LISTBOX - List


To create a dialog item on a particular page, use .CreateItem to the reference to the page/popup:

    var src = IR.GetItem("Page 1").CreateItem(IR.ITEM_BUTTON,"Button 1",30,40,800,150); 
    IR.Log(src) // [Object DialogItemPrototype]


The constructor has only the basic item properties - you cannot create an item without them. All items also have a set of additional properties and a set of properties specific for the item type. See the Properties section.
Items created using IR.CreateItem have a font cour.ttf size 20. How to change?


IR.DeleteItem

to delete a popup or dialog item. Pages cannot be deleted

Syntax

IR.DeleteItem(popup)

input value description
page "Popup 1" type: String
the page/popup name
output

-


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  IR.DeleteItem("Popup 1");
});

To delete the item on the page, write the reference to it in the variable and use IR.DeleteItem for the received reference:

var item = IR.GetItem("Page 1").GetItem("Item 1");
IR.DeleteItem(item);




IR.GetPage

to get access to the project page (Page). Having access to the page, you can refer to item of the page using the method .GetItem

Syntax

IR.GetPage(page)

input value description
page "Page 1" type: String
the page name
output
Object [Object DialogItemPrototype] type: Object
the reference to the page instance


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  IR.GetPage("Page 1");
});

Having access to the page, you can refer to items on it using the .GetItem method:

    var Item = IR.GetPage("Page 1").GetItem("Item 1");
    IR.Log(Item); //    [object DialogItemPrototype]




IR.GetPopup

to get access to the project popup (Popup). Having access to the popup, you can refer to items on it with the help of the method .GetItem

Syntax

IR.GetPopup(popup)

input value description
popup "Popup 1" type: String
the popup name
output
Object [Object DialogItemPrototype] type: Object
the reference to the popup instance


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  IR.GetPopup("Popup 1");
});

Having access to the popup, you can refer to items on it with the help of the .GetItem method:

    var Item = IR.GetItem("Popup 1").GetItem("Item 1");
    IR.Log(Item); //    [object DialogItemPrototype]




IR.ShowPage

to show the page by its name (Page)

Syntax

IR.ShowPage(page)

input value description
page "Page 1" type: String
the page name
output

-


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  IR.ShowPage("Page 1");
});

the object does not have methods and properties


IR.ShowPopup

to show the popup by its name (Popup)

Syntax

IR.ShowPopup(popup, <effect_group>)

input value description
popup "Popup 1" type: String
the popup name
effect_group 1 type: Number
the number of the group of effects created using IR.CreateEffect
output

-


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  IR.ShowPopup("Popup 1");
});

the object does not have methods and properties


IR.HidePopup

to hide the popup by its name (Popup)

Syntax

IR.HidePopup(popup, <effect_group>)

input value description
popup "Popup 1" type: String
the popup name
effect_group 1 type: Number
the number of the group of effects created using IR.CreateEffect
output

-


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  IR.HidePopup("Popup 1");
});

the object does not have methods and properties


IR.HideGroup

hide the popup from specified Popup Group. Only one popup from the Group could be displayed at the same time and this popup will be hide when you call this method. The names of Popup Groups you can see in "Manage Popup Groups" menu

Syntax

IR.HideGroup(group)

input value description
popup "Popup Group 1" type: String
the name of Group
output

-


Sample

function hide_1 ()
{
  IR.HideGroup("Popup Group 1");
}

more about Popup Groups


IR.TogglePopup

to hide the popup if it is shown; to show the popup if it is hidden

Syntax

IR.TogglePopup(popup, <effect_group>)

input value description
popup "Popup 1" type: String
the popup name
effect_group 1 type: Number
the number of the group of effects created using IR.CreateEffect
output

-


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  IR.TogglePopup("Popup 1");
});

the object does not have methods and properties


IR.HideAllPopups

to hide all popups on the indicated page

Syntax

IR.HideAllPopups(page)

input value description
page "Page 1" type: String
the page name
output

-


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  IR.HideAllPopups("Page 1");
});

the object does not have methods and properties


IR.CreateEffect

to create an animation effect during application work and use it at popup opening/closing.

Syntax

var name = IR.CreateEffect(effect)

input value description
name name type: string
the name of the variable for saving the group of effects, it is required for assigning the number and other parameters to the group
effect IR.EFFECT_FADE type: object
the effect type
output
object [object EffectPrototype] type: object
the reference to the group of animation effects


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
   var Fade = IR.CreateEffect(IR.EFFECT_FADE); // create a group, save it in the variable  
       Fade.Group = 1000; // assign the number to the group 
       Fade.Delay = 0; // the delay for executing effects
       Fade.Duration = 400; // the effect duration
       Fade.Tween = 0; // the formula for effect calculation (tweener)
    IR.ShowPopup("Popup 1", 1000) // show the popup with effects of group 1000 
});

Effects:

  • IR.EFFECT_FADE - gradual appearance/ disappearance;
  • IR.EFFECT_ROTATE - rotation about axis, the center of rotation - the middle of the popup;
  • IR.EFFECT_SCALE - scaling up/down;
  • IR.EFFECT_SLIDE - sliding to/from the side;
  • IR.EFFECT_TVSCAN - horizontal shrinking;


Properties of effects:

  • Group (number) - the number of the group of effects where the effect is allocated. It is recommended to use the numbers of groups beginning with 1000 - it will help you to avoid coinciding with groups of effects created by the editor. If you need to add to groups of effects created in the editor effects created dynamically, you must do it deliberately.
  • Delay (number, ms)- the delay before executing the effect;
  • Duration (number, ms) - the effect duration;
  • Tween (number) - the calculation formula, see IR.Tween




IR.ShowKeyboard

to show the system keyboard of the iOS or Android device

Syntax

IR.ShowKeyboard(type)

input value description
type 1 type: Number
the keyboard type: 1- alphabet, 2 - numbers
output

-


Sample

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

keyboard types:

  • 1- alphabet
  • 2 - numbers


On iOS you can use the IR.ShowKeyboard(0) command to hide the keyboard, it will not work on Android.
To open a keyboard, all other keyboards have to be hidden. If the keyboard is opened (for example, the numeric one), the command to open the alphabet keyboard will not work.
To open the keyboard on Windows, use the IR.Execute("osk") command.


IR.PasteFromClipboard

Paste the text from clipboard to an active EditBox Item. Only the Text will be pasted (not an images or other data). Cursor will be positioned after the text

Syntax

IR.PasteFromClipboard()

input value description

-

output

-


Sample

IR.AddListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("Paste Button"),function()
{
   IR.PasteFromClipboard();  
});

how to use: create the item "Paste text" beside of EditBox Item


IR.GetClipboard

Receive the text from clipboard

Syntax

IR.GetClipboard()

input value description

-

output

-


Sample

var clipboard = IR.GetClipboard();

how to use: send the text from clipboard to JS


IR.ShowPasteHelper

This method shows the native Paste dialog above the EditBox item. This dialog includes the text "Paste" and performs the action IR.PasteFromClipboard();. when you press on it. If you press on any other item it will close this dialog

Syntax

IR.ShowPasteHelper()

input value description

-

output

-


Sample

IR.AddListener(IR.EVENT_ITEM_HOLD, IR.GetItem("Page 1").GetItem("EditBox"),function()
{
   IR.ShowPasteHelper();  
});

How it works on Editbox Item:

  • Windows:
    • When you press CTRL+V, the metod IR.PasteFromClipboard(); occures if the clipboard is not empty and it is the Text there
    • If you press on EditBox with rhe right mouse button, you'll see the standard Paste dialog
    • cursor will be positioned in the end of pasted string
  • iOS, Android:
    • When you hold the EditBox 1 second, IR.ShowPasteHelper(); occures
    • cursor will be positioned in the end of pasted string




IR.SelectNextEditBox();

Move the focus from the current input field (editbox) to the next one. The order of the input fields determinated with the Z-order of the items that you can see with "Show Items In Tree" option turned on in iRIdium Studio (Tools > Options > Show > Show Items In Tree). The focus automatically switches to the next input field by Tab on Windows within a page or popup

Syntax

IR.SelectNextEditBox();

input value description

-

output

-


Sample

IR.AddListener(IR.EVENT_ITEM_CHANGE, IR.GetItem("Page 1").GetItem("Item 1"), function (action, key)
{
    if (action == 2)  // press Enter
    {
        IR.SelectNextEditBox();
    }
});





IR.GetItem

to get access to the page/popup. Having access to the page/popup, you can refer to items on it with the help of the method .GetItem

Syntax

IR.GetItem(item)

input value description
item "Page 1" type: String
the page/popup name
output
Object [object DialogItemPrototype] type: Object
the reference to the interface object


Sample

IR.AddListener(IR.EVENT_START,0, function()
{
    var DialogItem = IR.GetItem("Popup 1");
    IR.Log(DialogItem); //  [object DialogItemPrototype]
});

When using the IR.GetItem method you get the reference to DialogItem - the object of iRidium interfaces: a page, popup or graphic item.
The reference to the dialog item can be received using the methods IR.GetItem, IR.GetPage, IR.GetPopup.
For example, having access to the page/popup, you can refer to items on it with the help of the .GetItem method:

    var Item = IR.GetItem("Popup 1").GetItem("Item 1");
    IR.Log(Item); //    [object DialogItemPrototype]

See available methods below:


.GetItem

to get access to the graphic item on the page/popup.

Syntax

IR.GetItem(page).GetItem(item);

input value description
page "Page 2" type: String
the page/popup name
item "Item 2" type: String
the name of the graphic item on the page/popup
output
Object [Object DialogItemPrototype] type: Object
the reference to the object


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  var DialogItem = IR.GetItem("Page 2").GetItem("Item 2");
  IR.Log(DialogItem) // [Object DialogItemPrototype]
});

Properties of Item objects are available


.CreateItem

to create a graphic item on the page/popup.

Syntax

IR.GetItem(page).CreateItem(item_type, name, X, Y, width, height);

input value description
page "Page 1" type: String
the page/popup name
item_type IR.ITEM_BUTTON type: Object
the graphic item type
name "Button 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 800 type: Number
the item width
height 150 type: Number
the item height
output
Object [Object DialogItemPrototype] type: Object
the instance of the graphic object


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  IR.GetItem("Page 2").CreateItem(IR.ITEM_BUTTON, "Button 1", 30, 40, 800, 150);  
});

Types of dialog items:

  • IR.ITEM_PAGE - Page
  • IR.ITEM_POPUP - Popup
  • IR.ITEM_BUTTON - Button
  • IR.ITEM_TRIGGER_BUTTON - Trigger Button
  • IR.ITEM_MUTI_STATE_BUTTON - Multistate Button
  • IR.ITEM_UPDOWN_BUTTON - Up/Down Button
  • IR.ITEM_LEVEL - Level
  • IR.ITEM_MUTI_STATE_LEVEL - Multistate Level
  • IR.ITEM_EDIT_BOX - EditBox
  • IR.ITEM_VIRTUAL_KEY_BUTTON - Virtual Key
  • IR.ITEM_JOYSTICK - Joystick
  • IR.ITEM_LISTBOX - List

Properties of Item objects are available


.Clone

to clone a page, popup, graphic item on the page/popup.

Syntax

IR.GetItem(page).Clone(new_page_name);
IR.GetItem(page).GetItem(item).Clone(new_item_name);

input value description
page "Page 1" type: String
the page/popup name
new_page_name "Page 2" type: String
the name of the new page/popup (clone)
item "Item 1" type: String
the name of graphic item
new_item_name "Item 2" type: String
the name of the new graphic item (clone)
output
Object [Object DialogItemPrototype] type: Object
the reference to the object


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  IR.GetItem("Page 1").Clone("Page 2"); 
  IR.GetItem("Page 1").GetItem("Item 1").Clone("Item 2");
  // result:
  IR.Log(IR.GetItem("Page 2")) // [object DialogItemPrototype]
  IR.Log(IR.GetItem("Page 1").GetItem("Item 2")) // [object DialogItemPrototype]
});





.GetPopup

to get the popup shown on the page by its index. The index - the number of the shown popup from 0 to n. null is returned if there is no popup with such index.

Syntax

IR.GetItem(page).GetPopup(index);

input value description
page "Page 1" type: String
the page name
index 0 type: Number
the sequence number of the popup in the list of popups, beginning with zero
output
Object [Object DialogItemPrototype] type: Object
the popup instance


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
  var DialogItem = IR.GetItem("Page 1").GetPopup(0);
  IR.Log(DialogItem) // [Object DialogItemPrototype]
});

Properties of Popup objects are available


.StartActions

to execute actions assigned to the graphic item event

Syntax

IR.GetItem(page).GetItem(item).StartActions(event);

input value description
page "Page 1" type: String
the page name
item "Item 1" type: String
the graphic item name
event IR.EVENT_ITEM_PRESS type: object
the graphic item event which actions must be executed
output

-


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
   IR.GetItem("Page 1").GetItem("Item 1").StartActions(IR.EVENT_ITEM_PRESS);
});

see all interface events in the section Events
item actions will be executed but it will not participate in the process visually
at execution only macros set up in the editor are considered. actions called from scripts will not be executed


.GetState

to get the graphic item state as an object

Syntax

IR.GetItem(page).GetItem(item).GetState(state_index);

input value description
page "Page 1" type: String
имя страницы
item "Item 1" type: String
the graphic item name
state_index 0 type: Number
the state sequence number, beginning with zero
output
Object [Object DialogItemPrototype] type: Object
the reference to the item state


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
   var DialogItem = IR.GetItem("Page 1").GetItem("Item 1").GetState(0);
   IR.Log(DialogItem); // [Object DialogItemPrototype]
});

Properties of State objects are available


.CreateState

to add a state to the graphic item

Syntax

IR.GetItem(page).GetItem(item).CreateState();

input value description
page "Page 1" type: String
the page name
item "Item 1" type: String
the graphic item name
output
Object [Object DialogItemPrototype] type: Object
the reference to the object


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
   IR.GetItem("Page 1").GetItem("Item 1").CreateState();
});

the number of States should not be more than Item type supports


.ShowPopup

to show the popup on the page

Syntax

IR.GetItem(page).ShowPopup(popup, <effect_group>);

input value description
page "Page 1" type: String
the page name
popup "Popup 1" type: String
the popup name
effect_group 1 type: Number
the number of the group of effects created using IR.CreateEffect
output

-


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
   IR.GetItem("Page 1").ShowPopup("Popup 1");
});





.HidePopup

to hide the popup on the page

Syntax

IR.GetItem(page).HidePopup(popup, <effect_group>);

input value description
page "Page 1" type: String
the page name
popup "Popup 1" type: String
the popup name
effect_group 1 type: Number
the number of the group of effects created using IR.CreateEffect
output

-


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
   IR.GetItem("Page 1").HidePopup("Popup 1");
});





.TogglePopup

to hide the popup if it is shown; to show the popup if it is hidden

Syntax

IR.GetItem(page).TogglePopup(popup, <effect_group>);

input value description
page "Page 1" type: String
the page name
popup "Popup 1" type: String
the popup name
effect_group 1 type: Number
the number of the group of effects created using IR.CreateEffect
output

-


Sample

IR.AddListener(IR.EVENT_START, 0, function()
{
   IR.GetItem("Page 1").TogglePopup("Popup 1");
});





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



Example:

IR.AddListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log("pressed!");
});

IR.EVENT_ITEM_PRESS

the identifier of the event which is activated on pressing on the graphic item

Syntax

IR.AddListener(IR.EVENT_ITEM_PRESS, item, function, [pointer]);

input value description
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the interface object
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
output

-


Sample

IR.AddListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log("action"); // action
});





IR.EVENT_ITEM_RELEASE

the identifier of the event which is activated when releasing the graphic item

Syntax

IR.AddListener(IR.EVENT_ITEM_RELEASE, item, function, [pointer]);

input value description
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the interface object
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
output

-


Sample

IR.AddListener(IR.EVENT_ITEM_RELEASE, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log("action"); // action
});





IR.EVENT_ITEM_HOLD

the identifier of the event which is activated when holding the graphic item

Syntax

IR.AddListener(IR.EVENT_ITEM_HOLD, item, function, [pointer]);

input value description
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the interface object
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
output

-


Sample

IR.AddListener(IR.EVENT_ITEM_HOLD, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log("action"); // action
});





IR.EVENT_ITEM_END_HOLD

the identifier of the event which is activated in the end of holding the graphic item (when releasing the item after the HOLD event)

Синтаксис

IR.AddListener(IR.EVENT_ITEM_END_HOLD, item, function, [pointer]);

на входе значение описание
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the interface object
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
на выходе

-


Пример

IR.AddListener(IR.EVENT_ITEM_END_HOLD, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log("action"); // action
});





IR.EVENT_ITEM_LOST_FOCUS

the identifier of the event which is activated at release of any graphic item (with Release or End Of Hold). The event indicates that the item lost the focus

Синтаксис

IR.AddListener(IR.EVENT_ITEM_LOST_FOCUS, item, function, [pointer]);

на входе значение описание
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the interface object
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
на выходе

-


Пример

IR.AddListener(IR.EVENT_ITEM_LOST_FOCUS, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log("action"); // action
});





IR.EVENT_ITEM_CHANGE

the identifier of the event which is activated when inputting text in EditBox. It is possible to distinguish input of a symbol and sending of a command such as Del or Enter.


The event returns:

action - the action identifier:

0 - NONE				11 - NEXT							22 - BANK_2_MOMENTARY_SELECT
1 - INSERT_TEXT			12 - PREVIOUS						23 - BANK_3_MOMENTARY_SELECT
2 - ENTER				13 - HOME							24 - BANK_4_MOMENTARY_SELECT
3 - UP					14 - END							25 - BANK_5_MOMENTARY_SELECT
4 - DOWN				15 - INSERT							26 - PAGE_UP
5 - LEFT				16 - BANK_1_LOCKING_SELECT			27 - PAGE_DOWN
6 - RIGHT				17 - BANK_2_LOCKING_SELECT			28 - FUNCTION
7 - DELETE				18 - BANK_3_LOCKING_SELECT			29 - CTRL
8 - CLEAR				19 - BANK_4_LOCKING_SELECT			30 - ALT
9 - ABORT				20 - BANK_5_LOCKING_SELECT			31 - SCANCODE
10 - EXIT				21 - BANK_1_MOMENTARY_SELECT


key - the key identifier giving more accurate representation about the action.
For example: action: 30 (ALT), key: 56 (LEFT ALT), 90 (RIGHT ALT)

0 - NONE = 0		26 - BRACKET_LEFT		52 - PERIOD				78 - KEYPAD_ADD
1 - ESCAPE			27 - BRACKET_RIGHT		53 - SLASH				79 - KEYPAD_1
2 - 1				28 - RETURN				54 - SHIFT_RIGHT		80 - KEYPAD_2
3 - 2				29 - CONTROL_LEFT		55 - KEYPAD_MULTIPLY	81 - KEYPAD_3
4 - 3				30 - A					56 - ALT_LEFT			82 - KEYPAD_0
5 - 4				31 - S					57 - SPACE				83 - KEYPAD_PERIOD
6 - 5				32 - D					58 - CAPS_LOCK			84 - F11
7 - 6				33 - F					59 - F1					85 - F12
8 - 7				34 - G					60 - F2					86 - KEYPAD_ENTER
9 - 8				35 - H					61 - F3					87 - CONTROL_RIGHT
10 - 9				36 - J					62 - F4					88 - KEYPAD_DIVIDE
11 - 0				37 - K					63 - F5					89 - PRINT_SCREEN
12 - MINUS			38 - L					64 - F6					90 - ALT_RIGHT
13 - EQUAL			39 - SEMICOLON			65 - F7					91 - HOME
14 - BACKSPACE		40 - APOSTROPHE			66 - F8					92 - UP
15 - TAB			41 - GRAVE				67 - F9					93 - PAGE_UP
16 - Q				42 - SHIFT_LEFT			68 - F10				94 - LEFT
17 - W				43 - BACKSLASH			69 - KEYPAD_NUM_LOCK	95 - RIGHT
18 - E				44 - Z					70 - SCOLL_LOCK			96 - END
19 - R				45 - X					71 - KEYPAD_7			97 - DOWN
20 - T				46 - C					72 - KEYPAD_8			98 - PAGE_DOWN
21 - Y				47 - V					73 - KEYPAD_9			99 - INSERT
22 - U				48 - B					74 - KEYPAD_SUBTRACT	100 - DELETE
23 - I				49 - N					75 - KEYPAD_4			101 - PAUSE
24 - O				50 - M					76 - KEYPAD_5			102 - WINDOWS_LEFT
25 - P				51 - COMMA				77 - KEYPAD_6			103 - WINDOWS_RIGHT

Синтаксис

IR.AddListener(IR.EVENT_ITEM_CHANGE, item, function (action, key) {}, [pointer]);

на входе значение описание
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the EditBox interface object
function function (action, key) {} type: function
the function receiving input parameters from the event:
  • action - the action identifier: input symbol or press of Command key
  • key - the key identifier giving more accurate representation about the action.

For example:: action: 30 (ALT), key: 56 (LEFT ALT), 90 (RIGHT ALT)

pointer - type: object
the pointer to the object which serves the function (optional)
на выходе
action 1 type: number
the action identifier: input of a symbol or clicking of the command button
key 0 type: number
the button identifier giving more accurate representation about the action. For example: action: 30 (ALT), key: 56 (LEFT ALT), 90 (RIGHT ALT)


Пример

IR.AddListener(IR.EVENT_ITEM_CHANGE, IR.GetItem("Page 1").GetItem("Item 1"), function (action, key)
{
    if (action == 1)  // insert text
    {
        IR.Log("new string: " + IR.GetItem("Page 1").GetItem("Item 1").Text)
    }
});





IR.EVENT_MOUSE_DOWN

the identifier of the event which is activated when pressing on the mouse button (Windows)

Syntax

IR.AddListener(IR.EVENT_MOUSE_DOWN, item, function, [pointer]);

input value description
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the interface object
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
output

-


Sample

IR.AddListener(IR.EVENT_MOUSE_DOWN, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log("action"); // action
});





IR.EVENT_MOUSE_UP

the identifier of the event which is activated when releasing the mouse button (Windows)

Syntax

IR.AddListener(IR.EVENT_MOUSE_UP, item, function, [pointer]);

input value description
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the interface object
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
output

-


Sample

IR.AddListener(IR.EVENT_MOUSE_UP, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log("action"); // action
});





IR.EVENT_MOUSE_MOVE

the identifier of the event which is activated when dragging the mouse cursor with the pressed left button (Windows). You'll get new coordinates of cursor on the function output.

Syntax

IR.AddListener(IR.EVENT_MOUSE_MOVE, item, function, [pointer]);

input value description
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the interface object
function function() {} type: function
the unnamed function or reference to the function. Parameters:
  • х - the horizontal coordinate of the cursor
  • y - the vertical coordinate of the cursor
pointer - type: object
the pointer to the object which serves the function (optional)
output
x 120 type: number
the horizontal coordinate of the cursor
y 240 type: number
the vertical coordinate of the cursor


Sample

IR.AddListener(IR.EVENT_MOUSE_MOVE, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log(x + ":" + y); // new coordinates on move
});





IR.EVENT_TOUCH_DOWN

the identifier of the event which is activated on pressing on the item (iOS, Android)

Syntax

IR.AddListener(IR.EVENT_TOUCH_DOWN, item, function, [pointer]);

input value description
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the interface object
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
output

-


Sample

IR.AddListener(IR.EVENT_TOUCH_DOWN, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log("action"); // action
});





IR.EVENT_TOUCH_UP

the identifier of the event which is activated on pressing on the item (iOS, Android)

Syntax

IR.AddListener(IR.EVENT_TOUCH_UP, item, function, [pointer]);

input value description
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the interface object
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
output

-


Sample

IR.AddListener(IR.EVENT_TOUCH_UP, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log("action"); // action
});





IR.EVENT_TOUCH_MOVE

the identifier of the event which is activated when moving a finger on the item (iOS, Android) . You'll get new coordinates of cursor on the function output.

Syntax

IR.AddListener(IR.EVENT_TOUCH_MOVE, item, function, [pointer]);

input value description
item IR.GetItem("Page 1").GetItem("Item 1") type: object
the reference to the interface object
function function() {} type: function
the unnamed function or reference to the function. Parameters:
  • х - the horizontal coordinate of touch
  • y - the vertical coordinate of touch
pointer - type: object
the pointer to the object which serves the function (optional)
output
x 120 type: number
the horizontal coordinate of the cursor
y 240 type: number
the vertical coordinate of the cursor


Sample

IR.AddListener(IR.EVENT_TOUCH_MOVE, IR.GetItem("Page 1").GetItem("Item 1"), function ()
{
    IR.Log(x + ":" + y); // new coordinates on move
});





IR.EVENT_ITEM_SHOW

the identifier of the event which is activated when showing the page/popup

Syntax

IR.AddListener(IR.EVENT_ITEM_SHOW, item, function, [pointer]);

input value description
item IR.GetItem("Page 1") type: object
the reference to the page/popup
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
output

-


Sample

IR.AddListener(IR.EVENT_ITEM_SHOW, IR.GetItem("Page 1"), function ()
{
    IR.Log("action"); // action
});





IR.EVENT_ITEM_HIDE

the identifier of the event which is activated when hiding the page/popup

Syntax

IR.AddListener(IR.EVENT_ITEM_HIDE, item, function, [pointer]);

input value description
item IR.GetItem("Page 1") type: object
the reference to the page/popup
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
output

-


Sample

IR.AddListener(IR.EVENT_ITEM_HIDE, IR.GetItem("Page 1"), function ()
{
    IR.Log("action"); // action
});





Object Properties

Objects properties are available for reference. The set of properties depends on the object type. Objects received when referring to the lower objects in the hierarchy do not take their properties (for example, when you refer to the Item object you cannot receive the width of the Popup object on which it is placed).


IR

IR.property

ProjectName "Welcome" type: String
the name of project that opened in app right now
PagesCount 4 type: Number
the number of pages in the project
PopupsCount 12 type: Number
the number of popups in the project
CurrentPage [object DialogItemPrototype] type: Object
the reference to the object - the opened project page


Page

IR.GetItem(page).property

ItemsCount 53 type: Number
it gives the number of items on the page
PopupsCount 2 type: Number
it gives the number of popups on the page
PopupsOnPage Array of Objects type: Array
it gives the array of objects - popups on the page
X 100 type: Number
the X coordinate
Y 100 type: Number
the Y coordinate
Width 250 type: Number
the width
Height 400 type: Number
the height
Name "Item 1" type: String
the object name
Type IR.ITEM_BUTTON type: Object
the object type

Popup

IR.GetItem(popup).property

ItemsCount 53 type: Number
it gives the number of items on the popup
Modal 0 / 1 type: Number
the modality property of the popup
X 100 type: Number
the X coordinate
Y 100 type: Number
the Y coordinate
Width 250 type: Number
the width
Height 400 type: Number
the height
Name "Item 1" type: String
the object name
Type IR.ITEM_BUTTON type: Object
the object type
Angle 360 type: Number
the angle of rotation
Parent "Page 1" type: String
the parent object

Item

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

Text "Hello" type: String
text in all item states
State 2 type: Number
to set up the item state, Feefback: Channel
Feedback 4 type: Number
to set up the item feedback type. For Button: 0 - None, 1 - Channel, 2 - InvertChannel, 3 - On, 4 - Momentary, 5 - Blink. For other items - see the properties in Studio
Hit 2 type: Number
to set up reaction on pressings. For Button: 0 - Active Touch, 1 - Bounding Box, 2 - Pass Through. For other items - see the properties in Studio
Password 0 type: Number
to set up the password number, 0 - without any passwords, 1-4 - one of the passwords
Value 1 type: Number
to set up Value of the item
StatesCount 1 type: Number
the number of item states
X 100 type: Number
the X coordinate
Y 100 type: Number
the Y coordinate
Width 250 type: Number
the width
Height 400 type: Number
the height
Name "Item 1" type: String
the object name
Type IR.ITEM_BUTTON type: Object
the object type
Angle 360 type: Number
the rotation angle
ScaleX 100 type: Number
the factor of extension by the Х coordinate
ScaleY 100 type: Number
the factor of extension by the Y coordinate
Visible true type: Boolean
to display
Enable true type: Boolean
the possibility to press
Parent "Page 1" type: String
the parent object
PasswordChar "\u2022" type: String
any character in the EditBox will be changed to the symbol from this property. Can be used to hide a password in EditBox field. You can receive the source text from the .Text property of an Item
zIndex 1 type: Number
Z-Order


Item: Level

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

Min 0 type: Number
the lowest limit of the level
Max 100 type: Number
the highest limit of the level
Invert 0 / 1 type: Number
to invert the level scale
Direction 0 / 1 type: Number
the vertical/horizontal level
Slider 1 type: Number
the slider type, from 0 to N, see the sequence number of the slider in Studio
SliderColor 0xFF0000FF type: ARGB
the slider color


Item: Multistate Level

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

Min 0 type: Number
the lowest limit of the level
Max 100 type: Number
the highest limit of the level
Invert 0 / 1 type: Number
to invert the level scale
Direction 0 / 1 type: Number
the vertical/horizontal level


Item: Joystick

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

ValueX 50 type: Number
the value of Value by the X coordinate
ValueY 100 type: Number
the value of Value by the Y coordinate
Color - type: -
-
PickColor (ColorPicker) - type: -
the color under the joystick cursor
Min 0 type: Number
the lowest limit of the joystick
Max 100 type: Number
the highest limit of the joystick
Cursor 1 type: Number
the joystick cursor type, from 0 to N, see the sequence number of the cursor in Studio
CursorColor 0xFF0000FF type: ARGB
the cursor color

Item: Up/Down Button

IR.GetItem(page/popup).GetItem(Up/Down_Button).property

Max 100 type: Number
the limit of increment/decrement for Up/Down Button
Delta 1 type: Number
the increment/decrement step
PressDelta 1 type: Number
the increment/decrement step on press
HoldDelta 5 type: Number
the increment/decrement step on hold


Item: Trigger Button

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

TriggerValue1 0 type: Number
the first value of the trigger
TriggerValue2 1 type: Number
the second value of the trigger


Item: List

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

Template "Popup 1" type: string
it enables set up or request of the template for items of the list (which is one of the project popups)
Direction 0 type: number
it enables set up or request of the list scrolling direction:
  • 0 - the vertical list
  • 1 - the horizontal list
ItemsCount 24 type: number
it enables request for the number of items in the list
Filter "A" type: string
it enables filtering of the items in the list by their names (part of the name)


see more in JavaScript API iRidium. Lists


State

IR.GetItem(page/popup).GetItem(item).GetState(n).property

Color 0xFF0000FF type: ARGB
to get the state color
FillColor 0xFF0000FF type: ARGB
to set up the state color
Border 1 type: Number
to indicate the border type from 0 to N, see the sequence number of the border in Studio
BorderColor 0xFF0000FF type: ARGB
to set up the border color
TextColor 0xFF0000FF type: ARGB
to set up the text color
Text "string" type: String
the text in the item state
TextEffectColor 0xFF0000FF type: ARGB
to set up the effect color
Opacity 255 type: Number
0-255 the state opacity
Image "Image 1.png" type: String
to set up the image by its name. For dynamic images use the name without the name suffix
ImageX 0 type: Number
the image shift by the X coordinate, for ImageAlign: Absolute
ImageY 0 type: Number
the image shift by the Y coordinate, for ImageAlign: Absolute
ImageAlign 0 type: Number
the way of image aligning
ImageStretch 0 type: Number
the way of scaling: 0 - None; 1 - Proportional; 2 - FullSize
Icon "Image 2.png" type: String
to set up the icon by its name
IconX 0 type: Number
the icon shift by the X coordinate, for IconAlign: Absolute
IconY 0 type: Number
the icon shift by the Y coordinate, for IconAlign: Absolute
IconAlign 0 type: Number
the way of icon aligning
FontId 1001 type: Number
to set up the font by its identifier sample
Font - type: -
-
FontSize 12 type: Number
Get font size
TextAlign 0 type: Number
the way of text aligning
TextX 0 type: Number
the text shift by the X coordinate, for TextAlign: Absolute
TextY 0 type: Number
the text shift by the Y coordinate, for TextAlign: Absolute
TextEffect 1 type: Number
to enable the text effect, from 0 to N, see the effect sequence number in Studio
DrawOrder 0x34521 type: HEX number
The order of drawing of item layers. Each layer described by the number. Top layer is the first number, bottom layer is the last number. The regular order of layers is: 0x34521
  • 3 - Icon
  • 4 - Text
  • 5 - Border
  • 2 - Image
  • 1 - Fill


For example, to show the Text on Icon: 0x43521

WordWrap 0 / 1 type: Number
to enable the auto text wrapping