No similar topics found.
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.
How to add processing of pressings for several objects in one AddListener structure?
At the moment each interface item needs its own listener:
The possibility of reference to the data is achieved by sending the 4th parameter in the AddListener method:
You can learn the name of each item pressed or subscribe for pressings on all items in the project using the following instructions.
// array of items
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()
{
// when we do something when pressing of an array item, this. - an indicator to the item
IR.Log("Pressed: " + this.Name);
IR.Log(this.Name + " Value: " + this.Value);
}
// creation of listeners for all array items
function RegisterButton()
{
for(var i = 0; i < gRegisters.length; i++)
{
var item = gRegisters[i].item;
IR.AddListener(IR.EVENT_ITEM_PRESS, item, OnPress, item);
}
}
// the function which is executed at launch
function Start()
{
RegisterButton();
}
// begin creating listeners
IR.AddListener(IR.EVENT_START,0, Start);To get access to the data of a graphic item inside the OnPress function, it is necessary to refer to it using the link this. For example:function OnPress() {
var NameOfItem = this.Name;
IR.Log( NameOfItem );
}The possibility of reference to the data is achieved by sending the 4th parameter in the AddListener method:
IR.AddListener(IR.EVENT_ITEM_PRESS, item, OnPress, item);
You can learn the name of each item pressed or subscribe for pressings on all items in the project using the following instructions.
Помогите сделать "бегущую строку"
Если текст не помещается в Item, то нужно его прокручивать. Желательно иметь возможность делать паузу перед началом прокрутки и выбирать скорость. То есть сделать стандартное поле для вывода данных о композиции у плеера.
Change Item Opacity (Transparency)
If you want to set the transparency of Item when the Light changes, you can do it directly (send Light Value to Item.Opacity) or via the script.
The script would be needed if your light changes from 0 to 100 untill the Opacity changes from 0 to 255.
// items
var Level = IR.GetItem("Main").GetItem("Light Level 1");
var Item = IR.GetItem("Main").GetItem("Light Item 1").GetState(0);
// driver name
var driver = IR.GetDevice("KNX Router (KNXnet/IP)");
//by Start
Item.Opacity = 0;
// change opacity manually (using ScriptCall function)
function OpacityChange ()
{
Item.Opacity = Level.Value*255/100;
}
// change opacity by Feedback from equipment
IR.AddListener(IR.EVENT_TAG_CHANGE , driver, function(name,value)
{
Item.Opacity = Level.Value*255/100;
});
Opacity Change by Value.irpz
If you want to convert the feedback only use this script:
var FeedbackConvert;
IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("KNX"), function(name, value)
{
if (name == "Address 1")
{
FeedbackConvert = (value*255)/100
IR.GetItem("Page 1").GetItem("Item 1").GetState(0).Opacity = FeedbackConvert;
IR.Log("Value = "+ value)
}else{
IR.Log("unknown")
}
});
Customer support service by UserEcho