Is it possible to change the x and y position of a layer through controls and parameters? Because I can't do it. I do modify things like images, but i'm unable to change the positions...
I can post the code if you need to see it...
Is it possible to change the x and y position of a layer through controls and parameters? Because I can't do it. I do modify things like images, but i'm unable to change the positions...
I can post the code if you need to see it...
function onclick()
{
this.layers("somelayername").x = this.layers("somelayername").x + 1;
}
Like this?
I'm using sth like:
function ApplyAdvSettings(){
this.parameters('FlipX').Value = parseInt(this.controls('FlipX').Value);
this.FlipTo(0);
this.ReDraw(true);
}and i have
<layer name="FrontFlip" x="%FlipX%" y="%FlipY%" width="13" height="13" src="../../unavailable.html" onclick="!FLIP:1" mousecursor="crDefault" alpha="0" fontalign="LT" fullhittest="yes"/>
}
But it does not seem to work... I tried without the parseInt , but does not work either...
Ah, rebinding the parameter is not automatically, unfortunately. So, you'll need to modify to code with:
function ApplyAdvSettings(){
var newXval = parseInt(this.controls('FlipX').Value);
this.parameters('FlipX').Value = newXval;
this.layers("FrontFlip").x = newXval;
this.FlipTo(0);
this.ReDraw(true);
}
I understand. Thanks you very much!!
But one question: why does this work?
function ApplySettings(){
var StampParam = this.parameters('StampImage');
var StampImage = this.controls('StampImage');
StampParam.Value = StampImage.Value;
this.FlipTo(0);
this.ReDraw(true);
}
...
<layer name="FrontBG" x="59" y="41" width="128" height="128" src="../../unavailable.html" fontalign="LT" mousecursor="crSizeAll"/>
maybe redraw auto rebinds images? better let phil answer... ![]()
Position isn't auto rebounded. Actually position at first wasn't even allowed to be parameters. I added parameter option a couple of version ago so I would be able to have rebinding option available in the near future.
The image is auto rebinding.
The only reason was I was trying to conserve Memory space so I don't store the parameter information "string" value in memory but since the source is stored in string it is autorebinding.
The last version I introduced the option to force a "Rebind" on layers. Layers.ReloadSkin which makes all layers rebind.
I'm debating on making it more flexible at the cost of more memory for the future version.
Ok, i get it now. But what about refresh intervals? Is this OK?
<xmls>
<xml src="../../unavailable.html" interval="%RefreshDelay%" usewintmp="yes" ongetdata="UpdateMails();"/>
</xmls>
....
var RefreshParam = this.parameters('RefreshDelay');
var RefreshVal = this.controls('RefreshDelay');
RefreshParam.Value = parseInt(RefreshVal.Value);
YEs that will work, BUT (always a but) you will need to call the Resettimer for the new value to take effect. For speed purpose I don't compare the timer every millisec doing a convert of string to a value so that I can see if its ok. I instead convert on start of a timer and use the converted value until the timer is reset.
Sorry, but i don't understand how to call the ResetTimer. Could you give an example?
(I did look in the SDK, but i didn't get it from those examples)
When you create a timer, you have an object that you can call, just like a layer.
So if you have a timer called 'EveryDayTimer'
You can do the following to reset
timer = desklet.timers('EveryDaytimer'); //Get the timer in question
timer.ResetTimer(); //To reset the timer
Ah, but i have no timer. I have:
<xmls>
<xml src="../../unavailable.html" interval="%RefreshDelay%" usewintmp="yes" ongetdata="UpdateMails();"/>
</xmls>
....
<param name="RefreshDelay" default="2" save="yes" onupdate=""/>
.....
var RefreshParam = this.parameters('RefreshDelay');
var RefreshVal = this.controls('RefreshDelay');
RefreshParam.Value = parseInt(RefreshVal.Value);
Do I have to use a timer to change the interval attribute?
XML does the same thing, it doesn't recheck the parameter every time.
The only thing you can do is onupdate of the param you can call a XML.Reset() which will then reset the values of the xml.