Эта страница является
переводом страницы
IRidium studio 2019 Programming. Перевод выполнен на 86%.
Actions when an interface item is pressed
Interface items, that do commands when they are pressed are pages, graphic items - text, buttons, levels, joysticks, etc.
Popups can't do commands when they are pressed.
Besides presses, pages can process gestures, for example, swipes.
There are graphic items on pages and popups of a visualization interface. They do certain actions when they are pressed or change their appearance when data are received from equipment. Item behavior depends on its settings, all commands that it sends are shown in the PROGRAMMING folder.
Select an item in the workspace and open the PROGRAMMING tab to see what actions and when it will do:
Press, release and move are different events, a graphical interface can react to. Pages, graphical items, list items support different sets of events, thus they follow different rules to send commands.
Main events:
- Press sends a command the moment a button is pressed;
- Release sends a command the moment a button is released;
- Hold sends commands in cycles as long as an item is held;
- End Of Hold send a command one time when a button is released after it is held for a long time;
- Move sends commands when a slider bar or a joystick is moved;
- Select selects an item and a subite in a List (script list). Access via List API;
- Enter - pressing the Enter button in Edit Box;
- Change - an event of entering a simbol in Edit Box. Access via GUI API;
- Lost Focus - an event generated by any item regardless of its type and conditions the moment an item is released. The event means that an item lost focus (activity). The event is available for processing only via GUI API;
- Gestures - gestures (swipe). A gesture can be processed only by a page (a gesture for a popup or area or item can't be set). A gesture can start on the page itself, on a graphical item or in a popup, but it is sent to the parent page and commands set for a page are done. There is an exception: Level, Joystic, List and Static List, that proccess Move event instead of gestures. Download an example of gesture use.
Sequence of interface events
On pages and popups which are not parts of Static List or List, buttons behave as follows:
- short press on an item generates the Press > Release events;
- long press on an item generate the Press > Hold > End Of Hold events;
- moving of Level and Joystick slider generates the Press > Move > Releaseevents;
- release of any item generates the Lost Focus event.
In List and Static List the sequence of events can be interrupted with scrolling a list. Scrolling can start on a popup and a graphical item, that stops doing commands:
- start of scrolling turns off the Release event. That's why when there is a short press and a shoft, the Press event of a button is activated and then scrolling;
- start of scrolling turns off the Hold event and End Of Hold is generated;
- When any item is released the Lost Focus event is generated.
Tips on setting commands:
- If a button works on a regular page, commands must be assigned to the Press event, if a button is in a list - to the Release event;
- If a button must do different commands by short and long press, assign the "short" command to Release, and the "long one" to Hold and then set HoldTime;
- If an pulse must be sent (first 1, then 0) by short press, there are two ways:
- assign sending 1 to Press 1, and sending 0 - to Release. It allows to control the length of pulse with the time a button is held. But in the list, scrolling cancels the Release event, that's whye sending 0 must be repeated in End Of Hold;
- assign both 1 and 0 commands to Release and set a Delay between them. The pulse has a set length and it's work is predictable in a list.
Macros Editor
Commands that are done when an event happens are macros, They are set by clicking [+] next to the name of an event:
Macros commands are done one after another from top to bottom. Here are possible commands:
- Actions (commands to change pages):
- Show page [page name]. Open a page (only one page can be opened at a time in a project). The name of the page that must be opened is entered in the parameters of the command;
- Show previous page. Show the previous open page of the project;
- Show popup [popup name]. Show a popup (numerous popups can be opened at a time). The name of the popup that must be opened is entered in the parameters of the command and optionally coordinates of the place where to show it can be entered;
- Hide popup [popup name]. Hide a popup;
- Toggle popup [popup name]. Toggle a popup (show if it is hidden, hide if it is shown);
- Hide popup group [name of popup group]. Hide popups, included in the group;
- Hide popups on page [page name]. Hide all popups on the page;
- Hide all popups. Hide all popups in the interface.
- Sounds (control of sounds):
- Play sound [file, track number, volume, cycle]. Start playing an audio file;
- Play system sound [sound, track number, volume]. Play a standard sound;
- Stop sound [file]. Stop playing an audio file;
- Stop slot [track number]. Stop playing an audio file on a selected track;
- Stop all sounds. Stop playing all sounds in a project;
- Send to driver (sending values to driver commands):
- Number. Send a constant, a decimal number (DEC);
- Text. Send a constant, data string (ASCII);
- Data. Send a constant, binary data (BIN);
- Value from object. Send data extracted from project variables (Value, coordinates, dimensions, etc., value variables defined by object properties).
- Send to object (sending data to variables - element properties, drivers, project tokens):
- Number. Write a constant number (DEC) to a variable;
- Text. Write a constant string (ASCII) to a variable;
- Value from object. Write a variable to a variable (e.g., an element property to a project token).
- Other (other commands):
- Delay [ms]. Set a delay between macros commands (set as required);
- Script Call. Call iRidium Script function by name;
- Keyboard [type of keyboard]. Show a virtual keyboard of a control panel;
- Hide keyboard. Hide a virtual keyboard of a control panel;
- Minimize (for Windows). Minimize i3 pro app;
- Execute [command line]. Do a standard command of the operation system, for example, open a link http://iridi.com/ in a browser, send a letter to a certain address (mailto:example@mail.ru), open a calculator and othe standard commands for different operation systems;
- Show system menu. Open the system menu;
- Show project menu. Open the side menu for choosing i3 pro projects;
- Paste from clipboard. Paste text from the clipboard into the active Editbox;
- Show paste helper. Above the cursor in the active EditBox will display a native, scalable popup window according to the project resolution: PasteHelper with the caption Paste, similar to the Paste tool on iOS and Android devices. Pressing this popup window executes the "Paste from clipboard" command. Clicking the paste window, clicking the input field again, or changing the focus will immediately close PasteHelper;
- Exit. Close iRidium App on a control panel (only for Windows and Android).
- Routines ( setting up editable routines):
- Reset settings of all routines. Reset all routines settings;
- Edit routine settings [routines name]. Edit routine settings;
- Show list of all routines. Open the list of all routines available for editing;
- Edit routine settings in list [routines name] (old). Edit routine settings in list.
Script Call. Activating JS functions
Script Call macro calls a JS function that is created in the Script editor but it can't send it the call parameters. But a link to the items that called the function is sent as the call context (this).
Here is an example of a function that takes a value from the Text property of an item that called the function, increases it by one and writes back:
var a = 0;
function action() {
a += 1;
this.Text = a; // this - element that called the function, .Text - item "text" property
IR.Log(this.Name); // name of the item that called the function
IR.Log(this.Parent.Name); // name of the page on which the element that called the function is located
};
Relations: item relations
Connections to send data from one object to another are created in the Relations window:
For example, with the help of a value received from the slider of Item 1 level you can change the coordinate of Item 2 item. Interaction can be set between graphical items, pages and popups, as well as, channels and tokens (global variables).