Aqua-Soft Forums: Layer position - Aqua-Soft Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Layer position Rate Topic: -----

#1 User is offline   gagabriel Icon

  • Group: Member
  • Posts: 56
  • Joined: 14-June 06

Posted 06 November 2006 - 01:02 PM

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...
0

#2 User is offline   AndreasV Icon

  • Group: Developers
  • Posts: 2,137
  • Joined: 22-November 03

Posted 06 November 2006 - 01:11 PM

function onclick()

{

  this.layers("somelayername").x = this.layers("somelayername").x + 1;

}

Like this?
0

#3 User is offline   gagabriel Icon

  • Group: Member
  • Posts: 56
  • Joined: 14-June 06

Posted 06 November 2006 - 01:37 PM

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...
0

#4 User is offline   AndreasV Icon

  • Group: Developers
  • Posts: 2,137
  • Joined: 22-November 03

Posted 06 November 2006 - 01:45 PM

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

}

0

#5 User is offline   gagabriel Icon

  • Group: Member
  • Posts: 56
  • Joined: 14-June 06

Posted 06 November 2006 - 01:54 PM

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"/>

0

#6 User is offline   AndreasV Icon

  • Group: Developers
  • Posts: 2,137
  • Joined: 22-November 03

Posted 06 November 2006 - 02:44 PM

maybe redraw auto rebinds images? better let phil answer... :P
0

#7 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 07 November 2006 - 02:40 PM

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.
0

#8 User is offline   gagabriel Icon

  • Group: Member
  • Posts: 56
  • Joined: 14-June 06

Posted 07 November 2006 - 08:37 PM

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

0

#9 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 08 November 2006 - 02:02 PM

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.
0

#10 User is offline   gagabriel Icon

  • Group: Member
  • Posts: 56
  • Joined: 14-June 06

Posted 11 November 2006 - 03:28 AM

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

#11 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 11 November 2006 - 02:36 PM

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
0

#12 User is offline   gagabriel Icon

  • Group: Member
  • Posts: 56
  • Joined: 14-June 06

Posted 11 November 2006 - 03:12 PM

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?
0

#13 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 12 November 2006 - 02:19 PM

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.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic