Jump to content

Layer position


gagabriel

Recommended Posts

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="flipit.png" 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...

Link to post

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);

}

Link to post

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="%StampImage%.png" fontalign="LT" mousecursor="crSizeAll"/>

Link to post

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.

Link to post

Ok, i get it now. But what about refresh intervals? Is this OK?

<xmls>
<xml src="%SiteAddress%" interval="%RefreshDelay%" usewintmp="yes" ongetdata="UpdateMails();"/>
</xmls>
....
var RefreshParam = this.parameters('RefreshDelay');
var RefreshVal = this.controls('RefreshDelay');
RefreshParam.Value = parseInt(RefreshVal.Value);

Link to post

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.

Link to post

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

Link to post

Ah, but i have no timer. I have:

	<xmls>
<xml src="%SiteAddress%" 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?

Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...