Geen vergelijkbare onderwerpen gevonden.
Rotate letters for language Hebrew
function RotateText(){
for(var j = 2; j < IR.PagesCount; j++)
for(var i = 0; i < IR.GetPage(j).ItemsCount; i++)
{
var string = IR.GetPage(j).GetItem(i).GetState(0).Text;
if(string.charCodeAt(0) > 122){
IR.GetPage(j).GetItem(i).GetState(0).Text = "";
for(var k = string.length; k >= 0; k--){
IR.GetPage(j).GetItem(i).Text += string.charAt(k);
}
}
}
for(var j = 0; j < IR.PopupsCount; j++)
for(var i = 0; i < IR.GetPopup(j).ItemsCount; i++)
{
var string = IR.GetPopup(j).GetItem(i).GetState(0).Text;
if(string.charCodeAt(0) > 122){
IR.GetPopup(j).GetItem(i).GetState(0).Text = "";
for(var k = string.length; k >= 0; k--){
IR.GetPopup(j).GetItem(i).Text += string.charAt(k);
}
}
}
}
IR.AddListener(IR.EVENT_START,0,RotateText);
RotateText.irpz
Change a text at Item when Level moves
This example shows you how to change some parameter of the graphic item in your GUI.
We change a text field of the item from the word to the real value received from equipment and back. It is possible using tags of graphic item.
ChangeText-when-lvl-moves.irpz
Open the popup when maximizing the app
If you want to open some default page or popup each time when maximizing the iRidium app, use the example attached
Background-Foreground_mode_iOS.irpz
Color relation
Q:
I use a color picker to fill a global token. But if I use the editor to create a relation it doesn't work.
http://farm9.staticflickr.com/8123/8659810061_9308ffd90e_z.jpg">
If I use Javascript using the following line:
IR.GetItem("Main").GetItem("Item 1").GetState(0).FillColor = IR.GetVariable("Tokens.BannerColor");
It DOES work. But it would be nice if i could use the first option
A:
This fixed! Please try project!
ColorTest__1_.irpz
I use a color picker to fill a global token. But if I use the editor to create a relation it doesn't work.
http://farm9.staticflickr.com/8123/8659810061_9308ffd90e_z.jpg">
If I use Javascript using the following line:
IR.GetItem("Main").GetItem("Item 1").GetState(0).FillColor = IR.GetVariable("Tokens.BannerColor");
It DOES work. But it would be nice if i could use the first option
A:
This fixed! Please try project!
ColorTest__1_.irpz
EVENT_ITEM_CHANGE not send text value
Q:
FullAccessDataItemforListener.irpz
I have a project with:
- 1 Page with name "Eventi"
- 4 EditBox with name in page
- 1 Sound with name "beep.wav"
I need play a sound when text property of one item change and text is "1".
I write in JS this code
var Eventi;
IR.AddListener(IR.EVENT_START, 0, function()
{
Eventi = new Alarm();
});
function Alarm()
{
var ItemList = ["Item 4","Item 1","Item 2","Item 3"];
var Page = IR.GetItem("Eventi");
for(i=0;i<ItemList.length;i++)
{
IR.Log("Generazione evento item "+ItemList[i]);
IR.AddListener(IR.EVENT_ITEM_CHANGE, Page.GetItem(ItemList[i]),function (text)
{
if(text = "1")
{
IR.PlaySound('Alarm.mp3');
}
});
}
};
I run this code with some Log istruction and i see that when i change text on the object, the variable "text" in JS is always "undefined".
This is a bug or I wrong something?
A:
Please try this project.
A:
Please try this project.
FullAccessDataItemforListener.irpz
Image size changing
Q:
When I have an javascript with:
IR.GetItem("Page 1").GetItem("Button").GetState(0).Image = "pict.jpg";
It ads an image to the button.
When I ad:
IR.GetItem("Page 1").GetItem("Button").Width = 500;
IR.GetItem("Page 1").GetItem("Button").Height = 100;
It changes the button size, but not the image size.
How can I change the image size in the javascript?
A:
A:
You can not change image size with script, but you can change image size with item property "image stetch" = propoptional (or full size). if property image stetch = prooportional (or full size) then image auto change size after set.
how change property image stretch? select item, open object properties panel, select tab states and find this property.
Recommended Reading for the Scripts
http://www.w3schools.com/js/default.asp" style="font-size: medium;">http://www.w3schools.com/js/default.asp
The following topics are useful for iRidium Script:
JS Statements JS Comments JS Variables JS Data Types JS Objects JS Functions JS Operators JS Comparisons JS Conditions JS Switch JS Loop For JS Loop While JS Breaks JS Errors JS Validation JS Object JS Number JS String JS Date JS Array JS Boolean JS Math JS RegExp
You don't need to read the sections JS Libraries, JS HTML DOM, JS Windows; because these are specific topics for using javascript for an web browser.
For JSON take a look at:
http://www.w3schools.com/json/default.asp">http://www.w3schools.com/json/default.asp
For XML take a look at http://www.w3schools.com/xml/xml_whatis.asp
Block the button for a while after pressing it
Q:
This is to be used for example when actuating a garage door and the magnetic contact is down. How can the user be sure that he pressed the button if the feedback is connected to this switch placed at end of run of the door? Does the functionality exist? What does it means "holding time"?
A:
This is to be used for example when actuating a garage door and the magnetic contact is down. How can the user be sure that he pressed the button if the feedback is connected to this switch placed at end of run of the door? Does the functionality exist? What does it means "holding time"?
A:
You can use item property Enable with script, when pressing to Item Enable = 0 and command Send.
When receive Feedback then Enable = 1;
Or you use full screen Popup Show when pressing to Item and when receive Feedback then Hide full screen Popup
Holding Time is item property, is time interval of start event pressing to activate event Hold.
screensaver
Q:
In the last mailing from Iridiummobile, when version 2.0.7 was released, there was an item about screensavers.
See image below.
How can I create an analog clock as an screensaver?
A:
A:
You can read how create analog clock an create this
http://www.iridiummobile.net/blog/how-to-create-analogue-clocks-in-iridium-gui-editor">http://www.iridiummobile.net/blog/how-to-create-analogue-clocks-in-iridium-gui-editor
or you can use ready project in gallery iRidium Samples / Screensavers
screensaver.jpg
Create project tokens
Q:
Is it possible to create project tokens with Javascript?
I couldn't find any information about it.
A:
A:
if project token TokenName, not created in project, then script command
IR.SetVariable("Global.TokenName", Value) - will create this token
Selected Item info
Q:
I don't know if it's already possible but I couldn't found it.
What I would like to see is that when I press on an item that the program knows what item is pressed.
I would like to use something like this:
IR.AddListener(IR.EVENT_ITEM_PRESS,IR.GetItem("Page 1").GetItem("Item 1"),function(this)
{
IR.Log(this.Text);
});
I know I could use: 'IR.GetItem("Page 1").GetItem("Item 1").Text'
But it would increase the programming speed and flexibility of the program if you ask me.
I think it would be nice if the program automatically knows whatis happening and we're able to use that during programming.
A:
A:
thank you for your idea! I have transferred it to iRidium programmers. At the moment for increasing the speed of script writing you can use this:
var Item = IR.GetItem("Page 1").GetItem("Item 1");
IR.AddListener(IR.EVENT_ITEM_PRESS, Item ,function()
{
IR.Log(Item.Text);
});
Great guide to object oriented javascript. ))- advanced users
Hi,
This is for the advanced scripters. Watch the video on this site.
thanks,
Roger
Object Playground: The Definitive Guide to Object-Oriented JavaScript
An excellent (and definitive), illustrated guide to JavaScript objects.
How do I call Execute from JS
Q:
How do I call Execute from JS?!
A:
How do I call Execute from JS?!
A:
you can use: http://wiki2.iridiummobile.net/index.php/Systems_API#IR.Execute">http://wiki2.iridiummobile.net/index.php/Systems_API#IR.Execute
Popup page sending states
Q:
for one project I would like to change the state of a button when a popup is shown
is it possible to integrate this and so,
what are the type and feedback relations I have to use?
A:
A:
You can use the following listener events to determine whether a page or popup is shown or not. just change it for your specific popup and add the code to adjust the global variable in the function of the listener.
// triggered when popup 1 is shown
IR.AddListener(IR.EVENT_ITEM_SHOW, IR.GetPopup("Popup 1"), function(){
IR.Log("SHOWING POPUP 1");
});
//triggered when popup 1 is hidden
IR.AddListener(IR.EVENT_ITEM_HIDE, IR.GetPopup("Popup 1"), function(){
IR.Log("HIDING POPUP 1");
});
Project Tokens Scripting
rocfusion:
Hi,
When you are using project tokens in your scripts. Be careful to watch for invalid tokens.
To account for this you could use something like this, it would be placed in the init part of your script.
if(IR.GetVariable("Global.MyToken")==undefined || IR.GetVariable("Global.MyToken")==NaN || IR.GetVariable("Global.MyToken")==null) { IR.SetVariable("Global.MyToken",0) }
Here if MyToken is not valid it will reset to the value of 0.
Thanks,
Roger
Cant fill the value (info)
Q:
The line:
IR.GetItem("Popup").GetItem("Item 1").Value = 50;
Doesn't work in Javascript, If I use Text in stead of Value it works fine.
A:
Please change item property "Feedback" = channel.
A:
Please change item property "Feedback" = channel.
Можно ли в одну структуру AddListener добавить обработку нажатий для нескольких объектов?
На данный момент каждый элемент интерфейса нуждается в своем слушателе:
Возможность обращения к данным достигается путем передачи 4-го параметра в метод AddListener:
Вы можете узнать имя нажатого элемента или подписаться на нажатия всех элементов в проекте, используя следующие инструкции.
// массив элементов var gRegisters = [ {item: IR.GetItem("Page 1").GetItem("1")}, {item: IR.GetItem("Page 1").GetItem("2")}, {item: IR.GetItem("Page 1").GetItem("3")}, ]; function OnPress() { // что-то делаем при нажатии на элемент массива, this. - указатель на item IR.Log("Pressed: " + this.Name); IR.Log(this.Name + " Value: " + this.Value); } // создание слушателей для всех элементов массива function RegisterButton() { for(var i = 0; i < gRegisters.length; i++) { var item = gRegisters[i].item; IR.AddListener(IR.EVENT_ITEM_PRESS, item, OnPress, item); } } // функция, выполняющаяся по старту function Start() { RegisterButton(); } // начинаем создание слушателей IR.AddListener(IR.EVENT_START,0, Start);Что бы получить доступ к данным графического элемента внутри функции OnPress, необходимо обратиться к нему по ссылке this. Например:
function OnPress() { var NameOfItem = this.Name; IR.Log( NameOfItem ); }
Возможность обращения к данным достигается путем передачи 4-го параметра в метод AddListener:
IR.AddListener(IR.EVENT_ITEM_PRESS, item, OnPress, item);
Вы можете узнать имя нажатого элемента или подписаться на нажатия всех элементов в проекте, используя следующие инструкции.
Помогите сделать "бегущую строку"
Если текст не помещается в Item, то нужно его прокручивать. Желательно иметь возможность делать паузу перед началом прокрутки и выбирать скорость. То есть сделать стандартное поле для вывода данных о композиции у плеера.
Customer support service by UserEcho