XWidgetSoft Forum https://www.bbs.xwidget.com/ |
|
Weather/temp txt position https://www.bbs.xwidget.com/viewtopic.php?f=8&t=4519 |
Page 1 of 1 |
Author: | Jimking [ May 8th, 2014, 9:09 am ] |
Post subject: | Weather/temp txt position |
I port this widget from Android using the same technique/script style with my "3D Dock Weather" widget: http://jimking.deviantart.com/art/3D-Do ... -411020516 ![]() Quote: var lowtemp = new Array(); var hightemp = new Array(); var days = 6; //cnweathercore:days range from 1 to 6 //accweathercore:days range from 1 to 7 function accweathercore1OnUpdate(Sender) { var i; var lowest = parseInt(accweathercore1.get("%lowtemp1")); var highest = parseInt(accweathercore1.get("%hightemp1")); for(i=1;i<=days;i++) { lowtemp[i] = parseInt(accweathercore1.get("%lowtemp"+i)); if(lowest>lowtemp[i]) lowest = lowtemp[i]; hightemp[i] = parseInt(accweathercore1.get("%hightemp"+i)); if(highest<hightemp[i]) highest = hightemp[i]; } var rang = highest - lowest; for(i=1;i<=days;i++) { lowtemp[i] = (lowtemp[i] -lowest)/rang*80 + 15; hightemp[i] = (hightemp[i]-lowest)/rang*80 + 15; } for(i=1;i<=days;i++) { eval('phigh'+i).Percent = hightemp[i]; eval('plow'+i).Percent = lowtemp[i]; eval('thigh'+i).top = eval('phigh'+i).thumb.top +98; //thumb must have image even you don't use thumb eval('tlow'+i).top = eval('plow'+i).thumb.top + 94; //thumb must have image even you don't use thumb } } But in this widget, the wth icons and the temp txts are not change their vertical position..I don't understand! Where is the error..? ![]() Here is the widget. I don't finish it yet. Are missing some parts but nothing to do with the script.. I wanted to do exactly like the original but the accuweather core has not support for hourly wth prevision.. (Click on the "lines" and "clock" button to flip the widget) |
Author: | hamid [ May 8th, 2014, 1:39 pm ] |
Post subject: | Re: Weather/temp txt position |
i think you didn't read this comment in the code: //thumb must have image even you don't use thumb this mean you should select an image for every thumb in the designer, even if you don't want to have thumb (you should select an image for them, but no need to enable the thumb checkbox for them) |
Author: | Jimking [ May 8th, 2014, 1:46 pm ] |
Post subject: | Re: Weather/temp txt position |
Let me check hamid... Thanks Edit: What a weird thing! ![]() Now works properly. I only need to change the values for the height of the icons and txt but this is easy.. Thanks for the clarification man! ![]() |
Author: | hamid [ May 8th, 2014, 2:04 pm ] |
Post subject: | Re: Weather/temp txt position |
jimking wrote: I only need to change the values for the height of the icons and txt what do you mean by this? i don't see any bad height there, maybe you mean the +number in that line of code |
Author: | meme [ May 8th, 2014, 2:13 pm ] |
Post subject: | Re: Weather/temp txt position |
![]() |
Author: | Jimking [ May 8th, 2014, 2:13 pm ] |
Post subject: | Re: Weather/temp txt position |
hamid wrote: jimking wrote: I only need to change the values for the height of the icons and txt what do you mean by this? i don't see any bad height there, maybe you mean the +number in that line of code I mean the distance between the top of the bars and the weather icons/position of the temperatures. This can be changed from these two lines: eval('thigh'+i).top = eval('phigh'+i).thumb.top +98; //thumb must have image even you don't use thumb eval('tlow'+i).top = eval('plow'+i).thumb.top + 94; //thumb must have image even you don't use thumb I know this because I already test it.. ![]() |
Author: | Jimking [ May 8th, 2014, 2:14 pm ] |
Post subject: | Re: Weather/temp txt position |
meme wrote: :mrgreen: Nice job jimking & hamid Thanks meme!!! Wait for the final version. ![]() I have to put some things to finish it.. |
Author: | Jimking [ May 9th, 2014, 6:41 pm ] |
Post subject: | Re: Weather/temp txt position |
Posted: ![]() viewtopic.php?f=11&t=4528 |
Page 1 of 1 | All times are UTC - 8 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |