0
Waiting for user's reply

How to change X and Y of popup

Jackie Roos 8 years ago in iRidium Script / Interface scripts updated by Dmitry - support (expert) 8 years ago 2

In my script, when I show a particular popup I want to change its position:

    IR.Log( 'IR.GetPopup("Room24_AC").Y ' + IR.GetPopup("Room24_AC").Y)
    IR.GetPopup("Room24_AC").Y = 115;
    IR.Log( 'IR.GetPopup("Room24_AC").Y ' + IR.GetPopup("Room24_AC").Y) 


And this shows as you would expect in the log

[27-05-2016 16:34:15.849]    INFO    IR.GetPopup("Room24_AC").Y 2
[27-05-2016 16:34:15.860]    INFO    IR.GetPopup("Room24_AC").Y 115


However, It does not show in the Emulator as moved, it is still at X = 2


And on hide I want to change it's position back, so it will be in the default position for use elsewhere in the project

 IR.Log( 'IR.GetPopup("Room24_AC").Y ' + IR.GetPopup("Room24_AC").Y)
IR.GetPopup("Room24_AC").Y = 2;
IR.Log( 'IR.GetPopup("Room24_AC").Y ' + IR.GetPopup("Room24_AC").Y)   


However this always gives

[27-05-2016 16:34:26.402]    INFO    IR.GetPopup("Room24_AC").Y 2
[27-05-2016 16:34:26.413]    INFO    IR.GetPopup("Room24_AC").Y 2 


I expected if the popup's X coordinate was successfully moved, it should be 115 for the first line and 2 for the second line


How can I change the position of a popup in by script (without deleting it and recreating it)

Waiting for user's reply

Hello!


Try adding a small delay before changing the coordinate of the element.

For example:

IR.AddListener(IR.EVENT_ITEM_SHOW,IR.GetItem("Popup 1"),function()
{

    IR.Log( 'IR.GetPopup("Popup 1").Y ' + IR.GetPopup("Popup 1").Y)
    
    
    IR.SetTimeout(50, function(){ 
    IR.GetPopup("Popup 1").Y = 115;
    IR.Log( 'IR.GetPopup("Popup 1").Y ' + IR.GetPopup("Popup 1").Y) 
    });
            
})