Skip to main content

iRidi API. Pages and items

Functions, methods, and object properties for controlling graphical items, pages, and popups in an iRidi project

Methods​

IR is the global object containing all iRidi API functions and constants. Its graphical interface methods provide access to interface pages and popups and execute operating system commands.

A chain of commands applied to IR provides access to any interface object, its methods, and its properties. Object hierarchy: IR > Page / Popup > Item > State.

IR.CreateItem()​

Create a graphical item on the current project page. Identify the page using the property CurrentPage of IR. To create an item on another page, apply CreateItem to a Page or Popup object reference obtained using IR.GetItem().

Syntax

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

InputValueDescription
item_typeIR.ITEM_BUTTONtype: Object
graphical item type
name"Button 1"type: String
item name, unique within the page
X30type: Number
X coordinate
Y40type: Number
Y coordinate
width800type: Number
item width
height150type: Number
item height
Output
Object[Object DialogItemPrototype]type: Object
graphical object instance

Example

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]
});

Notes

Tip
  • Dialog item types:

  • IR.ITEM_PAGE - page (Page)

  • IR.ITEM_POPUP - popup (Popup)

  • IR.ITEM_BUTTON - button (Button)

  • IR.ITEM_TRIGGER_BUTTON - toggle button (Trigger Button)

  • IR.ITEM_MUTI_STATE_BUTTON - animated button (Multistate Button)

  • IR.ITEM_UPDOWN_BUTTON - increment/decrement button (Up/Down Button)

  • IR.ITEM_LEVEL - level (Level)

  • IR.ITEM_MUTI_STATE_LEVEL - animated level (Multistate Level)

  • IR.ITEM_MULTI_STATE_CIRCLE_LEVEL - animated circular level (Multistate Circular Level)

  • IR.ITEM_EDIT_BOX - input field (EditBox)

  • IR.ITEM_VIRTUAL_KEY_BUTTON - virtual key (Virtual Key)

  • IR.ITEM_JOYSTICK - joystick (Joystick)

  • IR.ITEM_LISTBOX - dynamic list (List)

  • IR.ITEM_STATIC_LISTBOX - popup list (Static List)

  • To create a dialog item on a specific page, apply .CreateItem() to the page or popup reference:

var src = IR.GetItem("Page 1").CreateItem(IR.ITEM_BUTTON,"Button 1",30,40,800,150);
IR.Log(src) // [Object DialogItemPrototype]
  • The constructor lists only the basic properties required to create the item. All items also have a common set of additional properties and properties specific to their type. See Properties.
  • Items created using IR.CreateItem() have the fixed font cour.ttf, size 20. How do I change the font?

Multistate Circular Level​

To create a Multistate Circular Level, use type IR.ITEM_MULTI_STATE_CIRCLE_LEVEL (not IR.ITEM_MULTI_STATE_CIRCULAR_LEVEL).

var item = IR.CreateItem(IR.ITEM_MULTI_STATE_CIRCLE_LEVEL, "ClimateCircle", 0, 0, 200, 200);

item.MinValue = 16;
item.MaxValue = 30;
item.MinAngle = 135;
item.MaxAngle = 405;

var state = item.CreateState();
state.Image = "climate_state_1.png";

After creating the item, add states using CreateState(). States are created with default properties; set images and appearance manually.

PropertyDescription
MinValueMinimum value
MaxValueMaximum value
MinAngleScale start angle
MaxAngleScale end angle

IR.DeleteItem()​

Delete a Popup or dialog item. A page cannot be deleted.

Syntax

IR.DeleteItem(popup)

InputValueDescription
page"Popup 1"type: String
page or popup name
Output
-

Example

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

Notes

Tip

To delete an item on a page, store its reference in a variable and pass that reference to IR.DeleteItem()

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

IR.GetPage()​

Access a project page (Page). Once you have the page reference, access its items using .GetItem().

Syntax

IR.GetPage(page)

InputValueDescription
page"Page 1"type: String
page name
Output
Object[Object DialogItemPrototype]type: Object
reference to the page instance

Example

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

Notes

Tip
  • Once you have the page reference, access its items using .GetItem():
var Item = IR.GetPage("Page 1").GetItem("Item 1");
IR.Log(Item); // [object DialogItemPrototype]

IR.GetPopup()​

Access a project popup (Popup). Once you have the popup reference, access its items using .GetItem().

Syntax

IR.GetPopup(popup)

InputValueDescription
popup"Popup 1"type: String
popup name
Output
Object[Object DialogItemPrototype]type: Object
reference to the popup instance

Example

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

Notes

Tip
  • Once you have the popup reference, access its items using .GetItem():
var Item = IR.GetItem("Popup 1").GetItem("Item 1");
IR.Log(Item); // [object DialogItemPrototype]

IR.ShowPage()​

Show a page by name (Page)

Syntax

IR.ShowPage(page)

InputValueDescription
page"Page 1"type: String
page name
Output
-

Example

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

Notes

Tip
  • The object has no methods or properties

IR.ShowPopup()​

Show a popup by name (Popup)

Syntax

IR.ShowPopup(popup, <effect_group>)

InputValueDescription
popup"Popup 1"type: String
popup name
effect_group1type: Number
number of the effect group created using [
---------
-

Example

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

Notes

Tip
  • The object has no methods or properties

IR.HidePopup()​

Hide a popup by name (Popup)

Syntax

IR.HidePopup(popup, <effect_group>)

InputValueDescription
popup"Popup 1"type: String
popup name
effect_group1type: Number
number of the effect group created using [
---------
-

Example

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

Notes

Tip
  • The object has no methods or properties

IR.HideGroup()​

Hide a popup group by its name. Only one popup in the group can be open; calling the method closes that popup. Find group names in Manage Popup Groups.

Syntax

IR.HideGroup(group)

InputValueDescription
popup"Popup Group 1"type: String
group name
Output
-

Example

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

Notes

Tip

IR.TogglePopup()​

Show a Popup if hidden, or hide it if shown

Syntax

IR.TogglePopup(popup, <effect_group>)

InputValueDescription
popup"Popup 1"type: String
popup name
effect_group1type: Number
number of the effect group created using [IR.CreateEffect()][(#ircreateeffect)
Output
---------
-

Example

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

Notes

Tip
  • The object has no methods or properties

IR.HideAllPopups()​

Hide all popups (Popup) on the specified page

Syntax

IR.HideAllPopups(page, <effect_group>)

InputValueDescription
page"Page 1"type: String
page name
effect_group1type: Number
number of the effect group created using IR.CreateEffect()
Output
-

Example

IR.AddListener(IR.EVENT_ITEM_PRESS,IR.GetPage("Page 1").GetItem("Item 2"), function()
{
IR.HideAllPopups("Page 1", <1>);
});

Notes

Tip
  • The object has no methods or properties

IR.CreateEffect()​

Create an animation effect at runtime and use it when showing or hiding a popup.

Syntax

IR.CreateEffect(effect);

InputValueDescription
effectIR.EFFECT_FADEtype: object
effect type
Output
object[object EffectPrototype]type: object
animation effect group object

Example

IR.AddListener(IR.EVENT_START, 0, function()
{
var Fade = IR.CreateEffect(IR.EFFECT_FADE); // создаем группу, сохраняем в переменную
Fade.Group = 1000; // присваиваем номер группы
Fade.Delay = 0; // задержка выполнения эффектов
Fade.Duration = 400; // продолжительность эффекта
Fade.Tween = 0; // формула вычисления эффекта (твинер)
IR.ShowPopup("Popup 1", 1000); // покажем попап с эффектами группы 1000
});

Notes

Tip

Effects:

  • IR.EFFECT_FADE - fade in / out;
  • IR.EFFECT_ROTATE - rotate around the popup's center;
  • IR.EFFECT_SCALE - enlarge / shrink;
  • IR.EFFECT_SLIDE - move in / out from a side;
  • IR.EFFECT_TVSCAN - horizontal compression;

Effect properties:

PropertyValueData typeDescription
Group1000numberNumber of the effect group to contain the effect. Using effect group numbers starting at 1000 is recommended to avoid collisions with groups created by the editor. If you need to extend editor-created groups with dynamically created effects, do so deliberately.
Delay2000numberdelay before the effect starts, in milliseconds
Duration5000numbereffect duration in milliseconds
Tween0numbercalculation formula; see IR.Tween
SlideType4numbermovement type:
0 - left to the screen edge (Left Out),
1 - right to the screen edge (Right Out),
2 - up to the screen edge (Top Out),
3 - down to the screen edge (Bottom Out),
4 - left within the popup (Left),
5 - right within the popup (Right),
6 - up within the popup (Top),
7 - down within the popup (Bottom).
For the Slide effect only.

IR.ShowKeyboard()​

Show the iOS or Android device's system keyboard

Syntax

IR.ShowKeyboard(type)

InputValueDescription
type1type: Number
keyboard type: 1 - alphabetic, 2 - numeric
Output
-

Example

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

Notes

Tip
  • On iOS, hide the keyboard using IR.ShowKeyboard(0);; this does not work on Android.
  • All other keyboards must be hidden before opening a keyboard. If one is already open, for example a numeric keyboard, a command to open an alphabetic keyboard will fail.
  • To open the keyboard on Windows, use IR.Execute("osk");.

IR.PasteFromClipboard()​

Paste clipboard text into the active Editbox. Text is pasted only if the clipboard contains text, rather than an image or other content. The cursor is placed after the inserted text

Syntax

IR.PasteFromClipboard()

InputValueDescription
-
Output
-

Example

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

Notes

Tip
  • Use case: a paste-text button placed next to the input field

IR.GetClipboard()​

Get text from the clipboard

Syntax

IR.GetClipboard()

InputValueDescription
-
Output
-

Example

`var clipboard = IR.GetClipboard();`

Notes

Tip
  • Use case: pass clipboard text to a script

IR.ShowPasteHelper()​

Show a native PasteHelper popup above the cursor in the active EditBox, scaled to the project resolution and labeled Paste, similar to the paste tool on iOS and Android. Pressing the popup executes IR.PasteFromClipboard();. Pressing the paste popup, pressing the input field again, or changing focus immediately closes PasteHelper

Syntax

IR.ShowPasteHelper()

InputValueDescription
-
Output
-

Example

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

Notes

Tip

Paste tool behavior (EditBox):

  • Windows:
    • Pressing Ctrl+V automatically calls IR.PasteFromClipboard(); if the clipboard is nonempty and contains text
    • Right-clicking the input field displays the standard paste dialog
    • The cursor moves to the end of the string
  • iOS, Android:
    • Holding a finger on the input field for 1 second automatically calls IR.ShowPasteHelper();; pressing any item hides the Paste dialog
    • The cursor moves to the end of the string

IR.SelectNextEditBox()​

Move focus from the current input field to the next one in the list. Field order is determined by item Z position, visible by enabling items in the project tree (Tools > Options > Show > Show Items In Tree). Pressing Tab on Windows automatically moves focus to the next field within the page or window

Syntax

IR.SelectNextEditBox();

InputValueDescription
-
Output
-

Example

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

IR.SetLifeTime()​

Set how long a popup remains visible, in milliseconds. To show a popup for a fixed time, access its LifeTime property using .SetLifeTime().

Syntax

IR.SetLifeTime(popup, lt)

InputValueDescription
popup"Popup 1"type: String
popup name
lt5000type: number
popup display time (ms)
Output
success-type: boolean
success

Example

function set_lt()
{
IR.SetLifeTime("Popup 1", 5000);
IR.ShowPopup("Popup 1");
}

IR.GetItem()​

Access a page or popup. Once you have its reference, access its items using .GetItem().

Syntax

IR.GetItem(item)

InputValueDescription
item"Page 1"type: String
page or popup name
Output
Object[object DialogItemPrototype]type: Object
reference to an interface object

Example

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

Notes

Tip

IR.GetItem() returns a reference to a dialog item (DialogItem) - an iRidi interface object: a page, popup, or graphical item. Obtain a dialog item reference using IR.GetItem(), IR.GetPage(), IR.GetPopup(). For example, once you have a page or popup reference, access its items using .GetItem():

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

Available methods are listed below:

.GetItem()​

Access a graphical item on a page or popup.

Syntax

IR.GetItem(page).GetItem(item)

InputValueDescription
page"Page 2"type: String
page or popup name
item"Item 2"type: String
name of the graphical item on the page or popup
Output
Object[Object DialogItemPrototype]type: Object
object reference

Example

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

Notes

Tip
  • Item object properties are available

.CreateItem()​

Create a graphical item on a page or popup

Syntax

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

InputValueDescription
page"Page 1"type: String
page or popup name
item_typeIR.ITEM_BUTTONtype: Object
graphical item type
name"Button 1"type: String
item name, unique within the page
X30type: Number
X coordinate
Y40type: Number
Y coordinate
width800type: Number
item width
height150type: Number
item height
Output
Object[Object DialogItemPrototype]type: Object
graphical object instance

Example

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

Notes

Tip

Dialog item types:

  • IR.ITEM_PAGE - page (Page)
  • IR.ITEM_POPUP - popup (Popup)
  • IR.ITEM_BUTTON - button (Button)
  • IR.ITEM_TRIGGER_BUTTON - toggle button (Trigger Button)
  • IR.ITEM_MUTI_STATE_BUTTON - animated button (Multistate Button)
  • IR.ITEM_UPDOWN_BUTTON - increment/decrement button (Up/Down Button)
  • IR.ITEM_LEVEL - level (Level)
  • IR.ITEM_MUTI_STATE_LEVEL - animated level (Multistate Level)
  • IR.ITEM_MULTI_STATE_CIRCLE_LEVEL - animated circular level (Multistate Circular Level)
  • IR.ITEM_EDIT_BOX - input field (EditBox)
  • IR.ITEM_VIRTUAL_KEY_BUTTON - virtual key (Virtual Key)
  • IR.ITEM_JOYSTICK - joystick (Joystick)
  • IR.ITEM_LISTBOX - dynamic list (List)
  • IR.ITEM_STATIC_LISTBOX - popup list (Static List)

Item object properties are available

.Clone()​

Clone a page, popup, or graphical item on a page or popup

Syntax

IR.GetItem(page).Clone(new_page_name);
IR.GetItem(page).GetItem(item).Clone(new_item_name);
InputValueDescription
page"Page 1"type: String
page or popup name
new_page_name"Page 2"type: String
name of the new page or popup (clone)
item"Item 1"type: String
graphical item name
new_item_name"Item 2"type: String
name of the new graphical item (clone)
Output
Object[Object DialogItemPrototype]type: Object
object reference

Example

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]
});
Note

When an item is created using Clone(), most source item properties may be copied. Complete copying of all parameters is not guaranteed. Check the result for the specific item and set any missing properties manually if necessary.

.GetPopup()​

Get a popup displayed on a page by index. The index is the displayed popup's number from 0 to n. Returns null if no popup has that index.

Syntax

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

InputValueDescription
page"Page 1"type: String
page name
index0type: Number
zero-based index in the list of popups displayed on the page
Output
Object[Object DialogItemPrototype]type: Object
popup instance

Example

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

Notes

Tip
  • Popup properties are available

.StartActions()​

Execute actions bound to a graphical item event

Syntax

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

InputValueDescription
page"Page 1"type: String
page name
item"Item 1"type: String
graphical item name
eventIR.EVENT_ITEM_PRESStype: object
graphical item event whose actions should execute
Output
-

Example

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

Notes

Tip
  • For all interface events, see Events
  • The item's actions execute, but the item itself does not participate visually
  • Only macros configured in the editor are executed. Actions declared in scripts are not executed

.GetState()​

Get a graphical item state as an object

Syntax

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

InputValueDescription
page"Page 1"type: String
page name
item"Item 1"type: String
graphical item name
state_index0type: Number
zero-based state index
Output
Object[object StatePrototype]type: Object
reference to the item state

Example

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

Notes

Tip
  • State object properties are available

.CreateState()​

Add a state to a graphical item

Syntax

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

InputValueDescription
page"Page 1"type: String
page name
item"Item 1"type: String
graphical item name
Output
Object[Object DialogItemPrototype]type: Object
object reference

Example

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

Notes

Tip
  • Observe the state-count limit for the selected item!

.ShowPopup()​

Show a popup on a page

Syntax

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

InputValueDescription
page"Page 1"type: String
page name
popup"Popup 1"type: String
popup name
effect_group1type: Number
number of the effect group created using [
---------
-

Example

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

.HidePopup()​

Hide a popup on a page

Syntax

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

InputValueDescription
page"Page 1"type: String
page name
popup"Popup 1"type: String
popup name
effect_group1type: Number
number of the effect group created using [
---------
-

Example

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

.TogglePopup()​

Hide a popup if shown, or show it if hidden

Syntax

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

InputValueDescription
page"Page 1"type: String
page name
popup"Popup 1"type: String
popup name
effect_group1type: Number
number of the effect group created using [
---------
-

Example

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

.Show()​

Show a graphical item or popup on a page (general-purpose method)

Syntax

IR.GetItem(popup).Show();

InputValueDescription
page"Popup 1"type: String
popup name
Output
-

Example

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

.Hide()​

Hide a graphical item or popup on a page (general-purpose method)

Syntax

IR.GetItem(page).Hide();

InputValueDescription
page"Page 1"type: String
page name
Output
-

Example

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

Events​

An event is a process exposed to scripts with an identifier for monitoring.

A listener is a function that executes when its specified event occurs

Add a listener using the method IR.AddListener

IR.AddListener(event, input, action);

  • event is the identifier of the event monitored by the listener
  • input is an input parameter required to create the listener. If there is no parameter, specify 0
  • action is an anonymous function or a reference to a declared function in which actions are performed
  • pointer - optional reference to the listener's invocation context. Access it with this. The context can change while the program runs

Example:

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

IR.EVENT_ITEM_PRESS​

Event identifier triggered when a graphical item is pressed

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object
reference to an interface object
functionfunction() {}type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
-

Example

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

IR.EVENT_ITEM_RELEASE​

Event identifier triggered when a graphical item is released

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object
reference to an interface object
functionfunction() {}type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
-

Example

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

IR.EVENT_ITEM_HOLD​

Event identifier triggered while a graphical item is held

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object
reference to an interface object
functionfunction() {}type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
-

Example

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

IR.EVENT_ITEM_END_HOLD​

Event identifier triggered at the end of a graphical item hold (on release, after HOLD)

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object
reference to an interface object
functionfunction() {}type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
-

Example

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

IR.EVENT_ITEM_LOST_FOCUS​

Event identifier triggered when any interface object is released (together with Release or End Of Hold). It indicates that the item has lost focus

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object
reference to an interface object
functionfunction() {}type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
-

Example

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

IR.EVENT_ITEM_CHANGE​

Event identifier triggered when text is entered in EditBox. It distinguishes character input from commands such as Del or Enter. The event returns:

action - action identifier:

CodeValueCodeValueCodeValue
0NONE11NEXT22BANK_2_MOMENTARY_SELECT
1INSERT_TEXT12PREVIOUS23BANK_3_MOMENTARY_SELECT
2ENTER13HOME24BANK_4_MOMENTARY_SELECT
3UP14END25BANK_5_MOMENTARY_SELECT
4DOWN15INSERT26PAGE_UP
5LEFT16BANK_1_LOCKING_SELECT27PAGE_DOWN
6RIGHT17BANK_2_LOCKING_SELECT28FUNCTION
7DELETE18BANK_3_LOCKING_SELECT29CTRL
8CLEAR19BANK_4_LOCKING_SELECT30ALT
9ABORT20BANK_5_LOCKING_SELECT31SCANCODE
10EXIT21BANK_1_MOMENTARY_SELECT

key - key identifier specifying the action more precisely.

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

When entering a character (action = 1), key is 0.

CodeValueCodeValueCodeValueCodeValue
0NONE26BRACKET_LEFT52PERIOD78KEYPAD_ADD
1ESCAPE27BRACKET_RIGHT53SLASH79KEYPAD_1
2128RETURN54SHIFT_RIGHT80KEYPAD_2
3229CONTROL_LEFT55KEYPAD_MULTIPLY81KEYPAD_3
4330A56ALT_LEFT82KEYPAD_0
5431S57SPACE83KEYPAD_PERIOD
6532D58CAPS_LOCK84F11
7633F59F185F12
8734G60F286KEYPAD_ENTER
9835H61F387CONTROL_RIGHT
10936J62F488KEYPAD_DIVIDE
11037K63F589PRINT_SCREEN
12MINUS38L64F690ALT_RIGHT
13EQUAL39SEMICOLON65F791HOME
14BACKSPACE40APOSTROPHE66F892UP
15TAB41GRAVE67F993PAGE_UP
16Q42SHIFT_LEFT68F1094LEFT
17W43BACKSLASH69KEYPAD_NUM_LOCK95RIGHT
18E44Z70SCOLL_LOCK96END
19R45X71KEYPAD_797DOWN
20T46C72KEYPAD_898PAGE_DOWN
21Y47V73KEYPAD_999INSERT
22U48B74KEYPAD_SUBTRACT100DELETE
23I49N75KEYPAD_4101PAUSE
24O50M76KEYPAD_5102WINDOWS_LEFT
25P51COMMA77KEYPAD_6103WINDOWS_RIGHT

char - Unicode code of the entered character. During text input (action = 1), the character value is passed in char; when a command key is pressed, char is 0.

Typical behavior:

Actionactionkeychar
Character input10unicode
Enter228 (RETURN)0
Delete7100 (DELETE)0
Backspace3114 (BACKSPACE)0

Arrow keys, Home, End, Alt, Ctrl, and Shift do not trigger the event (EditBox does not respond to them).

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object reference to an EditBox interface object
functionfunction (action, key, char) type: function receiving event parameters:• action - action identifier: character input or a command key press• key - key identifier specifying the action more precisely. For example: action : 30 (ALT), key : 56 (LEFT ALT), 90 (RIGHT ALT). For character input, key = 0• char - Unicode code of the entered character. For text input, inspect char (action is always 1); for command keys, inspect action + key (char = 0)
pointer-type: object pointer to the object serving as the function context (optional)
Output
action1type: number action identifier: character input or a command key press
key0type: number key identifier specifying the action more precisely. For example: action : 30 (ALT), key : 56 (LEFT ALT), 90 (RIGHT ALT). For character input, it is 0
char65type: number Unicode code of the entered character. For command keys, it is 0

Example

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

IR.EVENT_MOUSE_DOWN​

Event identifier triggered when a mouse button is pressed (Windows)

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object
reference to an interface object
functionfunction() {}type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
-

Example

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

IR.EVENT_MOUSE_UP​

Event identifier triggered when a mouse button is released (Windows)

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object
reference to an interface object
functionfunction() {}type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
-

Example

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

IR.EVENT_MOUSE_MOVE​

Event identifier triggered when the mouse cursor is dragged with the left button held (Windows). Reports each cursor coordinate change until the left button is released.

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object
reference to an interface object
functionfunction(x, y) {}type: function
anonymous function or function reference. Receives:* x - horizontal cursor coordinate* y - vertical cursor coordinate
pointer-type: object
pointer to the object serving as the function context (optional)
Output
x120type: number
horizontal cursor coordinate
y240type: number
vertical cursor coordinate

Example

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

IR.EVENT_TOUCH_DOWN​

Event identifier triggered when an item is touched (iOS, Android)

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object
reference to an interface object
functionfunction() {}type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
x120type: number
horizontal screen-touch coordinate
y240type: number
vertical screen-touch coordinate
id1type: number
touch id

Example

IR.AddListener(IR.EVENT_TOUCH_DOWN, IR.GetItem("Page 1").GetItem("Item 1"), function (x, y, id)
{
IR.Log(x + " " + y + " " + id);
});

IR.EVENT_TOUCH_UP​

Event identifier triggered when an item is released (iOS, Android)

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object
reference to an interface object
functionfunction() {}type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
x120type: number
horizontal screen-touch coordinate
y240type: number
vertical screen-touch coordinate
id1type: number
touch id

Example

IR.AddListener(IR.EVENT_TOUCH_UP, IR.GetItem("Page 1").GetItem("Item 1"), function (x, y, id)
{
IR.Log(x + " " + y + " " + id);
});

IR.EVENT_TOUCH_MOVE​

Event identifier triggered when a finger moves across an item (iOS, Android)

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1").GetItem("Item 1")type: object
reference to an interface object
functionfunction() {}type: function
anonymous function or function reference. Receives:* x - horizontal screen-touch coordinate* y - vertical screen-touch coordinate
pointer-type: object
pointer to the object serving as the function context (optional)
Output
x120type: number
horizontal screen-touch coordinate
y240type: number
vertical screen-touch coordinate

Example

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​

Event identifier triggered when a page or popup is shown

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1")type: object
page or popup reference
functionfunction() {}type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
-

Example

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

IR.EVENT_ITEM_HIDE​

Event identifier triggered when a page or popup is hidden

Syntax

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

InputValueDescription
itemIR.GetItem("Page 1")type: object
page or popup reference
functionfunction() {}type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
-

Example

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

IR.EVENT_POPUP_ITEM_CHANGE​

Event identifier triggered by any action on a popup item

Syntax

IR.AddListener(IR.EVENT_POPUP_ITEM_CHANGE, item, function (event, popup, item), [pointer]);

InputValueDescription
itemIR.GetPopup("Popup 1")type: object
popup reference
functionfunction type: function
anonymous function or function reference
pointer-type: object
pointer to the object serving as the function context (optional)
Output
event142type: number
event identifier
popup"Popup 1"type: string
popup name
item"Item 1"type: string
item name

Example

IR.AddListener(IR.EVENT_POPUP_ITEM_CHANGE,IR.GetPopup("Popup 1"),function(event, popup, item){
IR.Log(event); // идетификатор события, например 142-Press, 143-Release, 146-Hold
IR.Log(popup.Name); // имя Popup
IR.Log(item.Name); // имя элемента
});

Object properties​

An object property is an accessible characteristic of an object. The available properties depend on its type. Objects accessed lower in the hierarchy do not inherit those properties (for example, an Item reference does not provide the width of the Popup containing it).

IR​

IR.property

PropertyValueData type
ProjectName"Welcome"type: String
name of the project currently open in the application
PagesCount4type: Number
number of pages in the project
PopupsCount12type: Number
number of popups in the project
CurrentPage[object DialogItemPrototype]type: Object
object reference to the project's open page

Page​

IR.GetItem(page).property

PropertyValueData type
ItemsCount53type: Number
number of items on the page
PopupsCount2type: Number
number of popups on the page
PopupsOnPageArray of Objectstype: Array
array of popup objects on the page
X100type: Number
horizontal coordinate
Y100type: Number
vertical coordinate
Width250type: Number
width
Height400type: Number
height
Name"Item 1"type: String
object name
TypeIR.ITEM_BUTTONtype: Object
object type
BlurDepth50type: Number
blur effect depth (Blur)
BlurEnabledtruetype: Boolean
enable the blur effect. It affects only the page image, not its items

IR.GetItem(popup).property

PropertyValueData type
ItemsCount53type: Number
number of items on the popup
Modal0 / 1type: Number
popup modality
X100type: Number
horizontal coordinate
Y100type: Number
vertical coordinate
Width250type: Number
width
Height400type: Number
height
Name"Item 1"type: String
object name
TypeIR.ITEM_BUTTONtype: Object
object type
Angle360type: Number
rotation angle
Parent"Page 1"type: String
parent object
BlurDepth50type: Number
blur effect depth (Blur)
BlurEnabledtruetype: Boolean
the effect applies only to the popup image

Item​

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

PropertyValueData type
Text"Hello"type: String
text in all item states
State2type: Number
item state
Feedback4type: Number
feedback type
Hit2type: Number
press response
Password0type: Number
password number
Value1type: Number
Value value
StatesCount1type: Number
number of states
X100type: Number
X coordinate
Y100type: Number
Y coordinate
Width250type: Number
width
Height400type: Number
height
Name"Item 1"type: String
item name
TypeIR.ITEM_BUTTONtype: Object
item type
Angle360type: Number
rotation angle
ScaleX100type: Number
X scale
ScaleY100type: Number
Y scale
Visibletruetype: Boolean
visibility
Enabletruetype: Boolean
whether presses are enabled
Parent"Page 1"type: String
parent object
PasswordChar"\u2022"type: String
password character
zIndex1type: Number
Z-axis order

Item: Level​

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

PropertyValueData type
Min0type: Number
lower limit
Max100type: Number
upper limit
Empty0 / 1type: Number
empty level
Filled0 / 1type: Number
filled level
Invert0 / 1type: Number
invert the scale
Direction0 / 1type: Number
direction
Slider1type: Number
slider type
SliderColor0xFF0000FFtype: RGBA
slider color

Item: Multistate Level​

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

PropertyValueData type
Min0type: Number
lower limit
Max100type: Number
upper limit
Empty0 / 1type: Number
empty level
Filled0 / 1type: Number
filled level
Invert0 / 1type: Number
invert the scale
Direction0 / 1type: Number
direction

Item: Joystick​

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

PropertyValueData type
ValueX50type: Number
X value
ValueY100type: Number
Y value
Color0xD2D2D2D2type: RGBA
color beneath the cursor
Min0type: Number
minimum
Max100type: Number
maximum
Cursor1type: Number
cursor type
CursorColor0xFF0000FFtype: RGBA
cursor color
GetColorOnCoordinates(x,y)0xB2B2B2FFtype: RGBA
get the pixel color at coordinates x and y
MinX / MinY50type: Number
minimum X / Y coordinate
MaxX / MaxY100type: Number
maximum X / Y coordinate

Item: Up/Down Button​

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

PropertyValueData type
Max100type: Number
limit
Delta1type: Number
step
PressDelta1type: Number
step on press
HoldDelta5type: Number
step while held

Item: Trigger Button​

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

PropertyValueData type
TriggerValue10type: Number
first value
TriggerValue21type: Number
second value

Item: List​

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

PropertyValueData type
Template"Popup 1"type: String
list template
Direction0type: Number
0 - vertical
1 - horizontal
ItemsCount24type: Number
number of entries
Filter"A"type: String
filter

For details, see iRidi JavaScript API. Lists

State​

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

PropertyValueData type
Color0xFF0000FFtype: RGBA
get the state color
FillColor0xFF0000FFtype: RGBA
set the state color
ColorAlphaChannel0xFF0000FFtype: RGBA
get color transparency
Opacity255type: Number
0-255 state transparency
Border1type: Number
specify the border type
BorderColor0xFF0000FFtype: RGBA
set the border color
TextColor0xFF0000FFtype: RGBA
set the text color
Text"string"type: String
text in the item state
TextAlign0type: Number
text alignment method
TextEffectColor0xFF0000FFtype: RGBA
set the effect color
TextPaddingTop0type: Number
upward text offset along Y
TextPaddingLeft0type: Number
leftward text offset along X
TextPaddingRight0type: Number
rightward text offset along X
TextPaddingBottom0type: Number
downward text offset along Y
Image"Image 1.png"type: String
set the image
ImageX0type: Number
image X offset
ImageY0type: Number
image Y offset
ImageAlign0type: Number
image alignment
ImageStretch0type: Number
0 - None
1 - Proportional
2 - FullSize
ImagePaddingTop0type: Number
upward image offset along Y
ImagePaddingLeft0type: Number
leftward image offset along X
ImagePaddingRight0type: Number
rightward image offset along X
ImagePaddingBottom0type: Number
downward image offset along Y
Icon"Image 2.png"type: String
set the icon
IconX0type: Number
icon X offset
IconY0type: Number
icon Y offset
IconAlign0type: Number
icon alignment
IconPaddingTop0type: Number
upward icon offset along Y
IconPaddingLeft0type: Number
leftward icon offset along X
IconPaddingRight0type: Number
rightward icon offset along X
IconPaddingBottom0type: Number
downward icon offset along Y
IconStrech0type: Number
0 - None
1 - Proportional
2 - FullSize
Chameleon"Image 3.png"type: String
chameleon image
ChameleonStrech0type: Number
0 - None
1 - Proportional
2 - FullSize
FontId1001type: Number
font identifier
FontFile"string"type: String
text font
FontSize12type: Number
font size
Spacing0type: Number
character spacing
LineSpacing1type: Number
line spacing
TextX0type: Number
text X offset
TextY0type: Number
text Y offset
TextEffect1type: Number
text effect
TextRotation0
90
180
270
type: Number
text rotation angle
DrawOrder0x34521type: HEX number
layer order:
3 - Icon
4 - Text
5 - Border
2 - Image
1 - Fill
WordWrap0 / 1type: Number
automatic text wrapping
BlurType0type: Number
0 - Default
1 - Background
BlurDepth100type: Number
0-100 blur