I have been trying to add in a left arrow to the weather section. I have tried this code:
imagebutton,119,64,left_arrow.png,t,0,13,var0_-1,1
If I understand the skin reference correctly the -1 should subtract 1 from var0. The problem is if I use the button from the starting point it does not go back to the next city. It just blanks out the weather info. Example: I have 3 cities for weather. If I right arrow to the second or third city the left arrow will go back to the next city. If I start from the first city and tap the left arrow the weather is blanked.
Anyone have an idea.
Oh, as a side note I have also tried to add more on to var0 also. Ex:add 3 to var 0 to make it go all the way around. This way it will move back to the first city. but if I hi the left arrow it stays on the same first city.
BW:
You need to include a routing that tests the value of your weather city variable.
You read in the number of citites in a variable early on:
calcvar,var29,fromconfig,numcities
Then, in your weather sec, you include something that looks like the following:
//create variable controlled by arrow keys
initvar,var0,1
//define buttons and how they affect var0
imagebutton,119,64,left_arrow.png,t,0,13,var0_-1
imagebutton,130,64,right_arrow.png,t,0,13,var0_1
//test var0 for value (can't be > var29 or <1)
if,var,var0,,>,%var29%
storevar,var0=1
else
endif
if,var,var0,,<,1
storevar,var0=%var29%
else
endif
You'll need to modify the x,y values to meet your skin, but this should do the hi/low test for you.
And I can't claim credit for this myself...this is just a minor mod of the code in the RSS Headline section from Slider - which hasppens to do the test you want it to.
Hope this helps,
DP1Don
Tried that changed X & Y, all it did was prevented TodayPlus form loading at all.
Don't know what you did wrong, Joel...
it works for me.
dp1don
dp1don, Thanks for the suggestion. it does work to a certain extent. However, instead of going to the third city when you tap on it half of the region disappears(not the weather region but in region 0 where I have this code(I might need to change something there)). It then goes to the 2nd city with no problems. Which is almost the same with out adding that code. Any more ideas?
I know this doesn't help Blazingwolf (sorry :cry: ) - but the code works for me, no problems....
Scotty
Quote from: ScottyI know this doesn't help Blazingwolf (sorry :cry: ) - but the code works for me, no problems....
Scotty
Are you using this in just the regular weater section? I'm wondering if it has to do with the fact I have some of the code in the 0 region.
More Information!!!
We have the current weather conditions in region 0, and the 5 day forecast in the weather region.
We need a left arrow button to scroll back through the cities. If any one knows how to achieve this pleaser post. Thanks.
So I know what you are looking for, Joel:
Current Weather for your home city is in region 0, and 5 day forecast is in your standard weather region.
So, when you wish to scroll through cities, which do you wish to change:
1) Both Current weather and 5-day forecast?
2) Current Weather only?
3) 5- day forecast only?
Let me know....I think I might have an answer for you...
Both the current weather and the five day.
As far as I have found (with testing and the limited documentation online)...it can't be done.
The reason is that it seems that each region updates independently... so while we can use the load command to tie the ciity value to a variable, and use the arrows in one section to modify that variable, and thus change the display in that section...I don't believe the changes cross over globally...
In other words, the refresh only occurs in the active section, not in all sections...
I'm going to experiment with this over the next couple of days and see if there is a way around it...
SRS, Eitel...anytime you want to chime in and say I'm wrong, please do so!
dp1don
Hi Blazingwolf:
Yes, it's in the weather section. I don't really want weather info in region 0. Just a matter of individual preference. I have, though, been playing around with the weather section, and have it set so that the home city automatically shows a 5 day forecast, with no "current conditions" information (I reckon I can look out of the window for that, and it's more accurate :wink: ), but when I scroll to any "non-home" city, the display changes automatically to show current conditions (and update time), followed by a 4-day forecast. I attach a couple of jpgs.
All the best....................Scotty
Scotty
dp1don,
I see what you are saying but it makes no sense that we can arrow through with the right arrow and not the left. If you look at the skin on this page (http://www.dark-mojo.com/todayplus/viewtopic.php?t=1201&start=20) you will notice that the right arrow works both regions. The left arrow works to a certain extent, at least until I try to go from city 1 to city 3( not in the skin). As far as active sections, both sections are active(or even if region 0 only was active) so I am not sure why this wouldn't work.
I have also tried to make the weather section in region 0 it's own region but that is not working either. :(
Perhaps it is impossible but this program does so much why not that.
Scotty, Thank you for letting me know.
Quote from: dp1donBW:
You need to include a routing that tests the value of your weather city variable.
You read in the number of citites in a variable early on:
calcvar,var29,fromconfig,numcities
Then, in your weather sec, you include something that looks like the following:
//create variable controlled by arrow keys
initvar,var0,1
//define buttons and how they affect var0
imagebutton,119,64,left_arrow.png,t,0,13,var0_-1
imagebutton,130,64,right_arrow.png,t,0,13,var0_1
//test var0 for value (can't be > var29 or <1)
if,var,var0,,>,%var29%
storevar,var0=1
else
endif
if,var,var0,,<,1
storevar,var0=%var29%
else
endif
You'll need to modify the x,y values to meet your skin, but this should do the hi/low test for you.
And I can't claim credit for this myself...this is just a minor mod of the code in the RSS Headline section from Slider - which hasppens to do the test you want it to.
Hope this helps,
DP1Don
I've somehow been missing this thread... Anyway, here's what you do...
You need an if statement that redraws your image button...
[pseudocode]
if city=1
imagebutton that makes var0 = 3, and refreshes both sections
else
imagebutton var0_=1
endif
[/pseudocode]
That
should work. You may need to add a button to refresh the section or something. I'm not sure.
I haven't tried to make a "left arrow" for the weather region, but I have been able to make one for both my Launcher and Clock regions. See this post (http://www.dark-mojo.com/todayplus/viewtopic.php?p=5501#5501). Maybe the code for my Launcher region might be helpfully.
region,16,0,-1
updateregions,18
initvar,var16,1
region,18,0,-1
imagebutton,3,3,left_arrow.png,t,16,13,var16_-1
if,var,var16,,>,%var18%
storevar,var16=1
else
endif
if,var,var16,,<,1
storevar,var16=%var18%
else
endif
<Insert Region Code Here>
imagebutton,226,2,right_arrow.png,t,16,13,var16_1
endregion,18,0
endregion,16,0
Note: I only kept the code that is required to actually control the "left arrow" and "right arrow." The variable "var18" is for the maximum number of items defined.
I'll see what I can do about making adding a "left arrow" to my weather region after lunch.
Edit: While I was at lunch, I had a thought of allowing the user to scroll thru different forecast days for a city. The code (I won't post it) for my clock region can be modified to do this.
Quote from: dp1donAs far as I have found (with testing and the limited documentation online)...it can't be done.
The reason is that it seems that each region updates independently... so while we can use the load command to tie the ciity value to a variable, and use the arrows in one section to modify that variable, and thus change the display in that section...I don't believe the changes cross over globally...
In other words, the refresh only occurs in the active section, not in all sections...
dp1don
Although I don't want weather in my region 0, I decided to take a quick look at this issue. I put code for current conditions (icon & temperature) in region 0, and when I scroll through the weather section (using either the left or right arrow in the weather section), the display in region 0 changes. It takes a few seconds to "catch up" (I have region 0 set to refresh every 10 seconds, because I have a digital clock there in my normal skin), but then it's fine. I attach a couple of jpgs....
All the best..................Scotty
The difference is that 1. the arrows left and right will be in region 0 and that we have five days of weather in weather region and current weather in region 0.
Ok. That makes even less sense. If scotty can do what we want from region 1 to 0 then why not vice versa?
MadTxn,
tried your suggestion and can't get it to work that either. :(
Ok. To give a little more graphic representation to the probem I am having I took 2 screen captures. 1 is with the screen normally and seeing the weather for city 1. The 2nd is after pressing the left arrow once.
Weather code from region 0:
initvar,var0,1
imagebutton,131,64,right_arrow.png,t,0,13,var0_1,1
if,var,var0,,>,%var29%
storevar,var0=1
else
endif
imagebutton,120,64,left_arrow.png,t,0,13,var0_-1,1
if,var,var0,,<,1
storevar,var0=%var29%
else
endif
load,city,%var0%
changefont,tahoma,11,b
text,105,52,[name],c
changefont,tahoma,12,
todayicon,90,64,,t
button,90,64,34,34,3,4,100,1
if,refresh
color,font,125_125_125
else
color,font,-1_4_-1
endif
today,realtemp,128,75,,°,c
today,humidity,130,87,,H,c
if,refresh
color,font,-1_4_-1
else
endif
One problem is in this section:
imagebutton,131,64,right_arrow.png,t,0,13,var0_1,1
if,var,var0,,>,%var29%
storevar,var0=1
else
endif
Your imagebutton acts on region 0, and refreshes region 1. That last command should be 1,0, so that it will refresh both regions. Secondly, the storevar,var0=1 happens AFTER the region is refreshed, so you won't see the proper value. I'm not sure why your calendar and everything else is disappearing tho...
Quote from: joelw135The difference is that 1. the arrows left and right will be in region 0 and that we have five days of weather in weather region and current weather in region 0.
Hi joelw135
I now have it so that the weather region does have 5 days forecast. Region 0 shows current conditions, which is what you wanted, I think. The only thing I haven't done is put the scrollers in region 0.....
FYI, I have (i) current weather in region 0 (ii) it scrolls as you use R/L arrows in weather region (both reported above), but in the past couple of hours I have added (iii) it now updates region 0
immediately when the weather is scrolled and (iv) clicking on current weather in region 0 opens the detailed current conditions......seems to me that the only thing "missing" is the scroll arrows in region 0.................I don't plan to do that
All the best.......................Scotty
Please post the code so we can take a look. Maybe we could figure out how to reverse the location. I tried to use the code, it worked somewhat by going right OK but left skipped cities.
Hi all
Happy to post the code. Works perfectly on my iPaq....hope it works for you. I have included the // comments (which I include in my skins because I don't always remember why I included a particular line.... :D)
At the bottom of this post you'll see a jpg showing the current conditions (in region0) and the 5-day forecast for "University City" (a region of San Diego, where I live). Using the left or right arrows in the weather region changes the city forecast, and ALSO results in an immediate update of current conditions in region0 (this is achieved by the "overlapping button" in region 3 referred to below )
Note that my code has two different results of clicking on the current conditons icon (CCI) in region 0. :
1. If the weather region is ALREADY ACTIVE, clicking on CCI opens the "detail view" for current conditions.
2. If the weather region is INACTIVE, clicking on CCI opens the weather region to the 5-day forecast; a 2nd click on CCI will then open the current conditions detail....
My final comment before giving you the code is that my weather region is region 1, with subregion 3, by the way....
So, here's the code :
First, I put initvar,var0,1 near the top of the skin (with other initvars), and removed it from region 3. It needs to be at the top of the skin because I added code to region to region 0 that refers to var0.
Then, in region0, I have:
// jlw add current weather for the city that's showing in the weather region, and the last updatetime; with button to open region 3, if not already open, and show current details; var0 if/else arguments are needed to allow correct refresh when scrolling using weather left / right arrows
changefont,tahoma,10,b
color,font,255_255_255
image,105,16,big_box.png,tr
if,region,1,0
button,105,16,44,50,3,4,100,1
else
button,105,16,44,50,1,4,0,-1
button,105,16,44,50,0,4,0,-1
endif
if,var,var0,,>,%var29%
storevar,var0=1
else
endif
if,var,var0,,<,1
storevar,var0=%var29%
else
endif
load,city,%var0%
text,128,17,[name],c
todayicon,110,25,,t
text,128,56,[updatetime],c,l
changefont,tahoma,11
color,font,0_0_0
// end current weather
Then, in region 3, I have :
// initvar,var0,1 JLW MOVED TO BEGINNING
imagebutton,228,0,right_arrow.png,t,1,13,var0_1
imagebutton,216,0,left_arrow.png,t,1,13,var0_-1
// update region0 whenever weather is scrolled using a button that overlaps the scroll buttons
button,216,0,24,12,0,4,0,0
// if var0 is greater than numcities (var29), it resets to 1
if,var,var0,,>,%var29%
storevar,var0=1
else
endif
// if var0 is less than 1, it resets to var29 (numcities
if,var,var0,,<,1
storevar,var0=%var29%
else
endif
load,city,%var0%
and so on (the usual stuff for the 5 day forecast).
I'm sure similar code can be used to place effective scroll arrows in region 0. As I said, I don't want them there, so I haven't done it..
Good luck !!............................Scotty
Quick follow-up:
While cleaning up the code yesterday, I forgot to delete a line that proved unnecessary. It's in region0. The line is :
button,105,16,44,50,0,4,0,-1
I don't think it does much harm (I don't see any perceptible difference in the speed of execution with or without the line), but it's not needed.
All the best.........Scotty
Here's the code that (i) puts current weather in region (ii) adds scroll arrows to region 0, allowing one to scroll between cities (without the weather region being open) (iii) clicking on the current weather icon opens the weather region, showing a 5-day forecast for the city (assuming you have the weather region set up for 5 days) and (iv) a second click on the current weather icon opens the detail view for the current weather for the city shown. I attach an animated gif.
// jlw add current weather for the city that's showing in the weather region, and the last updatetime
//with button to open region 3, if not already open, and show current details//
//var0 if/else arguments are needed to allow correct refresh when scrolling using weather left / right arrows
changefont,tahoma,10,b
color,font,255_255_255
image,105,16,big_box.png,tr
if,region,1,0
button,105,16,44,50,3,4,100,1
else
button,105,16,44,50,1,4,0,-1
endif
if,var,var0,,>,%var29%
storevar,var0=1
else
endif
if,var,var0,,<,1
storevar,var0=%var29%
else
endif
if,refresh
color,font,125_125_125
else
color,font,255_255_255
endif
load,city,%var0%
text,128,17,[name],c
todayicon,111,25,,t
text,128,56,[updatetime],c,l
changefont,tahoma,11
color,font,0_0_0
// end current weather
// add arrows to scroll weather, & refresh regions 0 & 1
imagebutton,91,46,right_arrow.png,t,1,13,var0_1
imagebutton,91,58,left_arrow.png,t,1,13,var0_-1
button,91,46,12,24,0,4,0,0
All the best...............Scotty
Scotty, When you use the left arrow are you going from your first city to your last city? This is where I am having a problem. It works fine if I go from 3,2,1 but not 1,3,2. Does this make sense? Thanks for your help.
I got it working!!
imagebutton,144,23,right_arrow.png,t,0,13,var0_1,1
//resets cities to home
imagebutton,144,41,left_arrow.png,t,0,13,var0_-1,1
if,var,var0,,>,%var29%
storevar,var0=1
else
endif
endif
Hi Blazingwolf
Yes, the code I posted works exactly as you guys wanted - the arrows in region0 move flawlessly through the various cities, including from last-to-first (right arrow), and from first to last (left arrow)
All the best
Scotty
I have no idea why but adding in the third endif like joelw135 talked about made it work. There is no open if statement in the code but it works and that is all that matters.
Thanks everyone for the help.
Hi Blazingwolf
Obviously, the ifs & endifs should cancel each other out - so if there is an extra endif, there's a problem - even if it "works" - and - frankly - I don't agree that that's "all that matters" - we need to understand WHY it works (or doesn't) :wink: otherwise, we're building a house of cards.
Presumably, you & I are using different skins, so is it possible that yours has an open "if" somewhere? As you'll see, the code I posted has an equal number of ifs & endifs....
One other thought (and I know this will sound bizarre) - but did you TYPE the code, or copy 'n' paste it? If the latter, that may be the problem. A couple of weeks ago, I copied some code from the board, & pasted it into my skin- and it didn't work. I read, and re-read, the code.....and couldn't see the problem. Then, I typed it into my skin, letter by letter, comma by comma....and it worked fine. I think (though I can't prove) that copying / pasting the text from the web site carried over some undesirable material (ASCII? HTML? I have no idea), which stopped it from working in the skin. OK, as I said, it seems pretty near incredible (in the literal meaning of the word) but honestly, that's what happened.
Anyhow, I promise you, the code I posted works perfectly for me.
By the way, thanks for all the excellent code you have contributed .....I know I've benefited from your input (and from srs, LT, rgb08, MadTxn, and so on....)
All the best......Scotty
Scotty, I agree with you to one point, doing the copy and paste in this program sometimes doesn't work. But this time I typed it in, the reason I had my first problem is because I typed something wrong. If I removed the last endif, it crashed. Still can't figure it out.
Now here is a good one we ran into. I attempted to change the color of the temp high and lows for each day. Added the code and it didn't work at first until I removed some of the blank spaces. Then the weirdest thing happened. On refresh the first day dimmed but the buffer was not replaced. How can a can a color change affect the code so drastically?
Hi joelw135
Can you post your skin - I'll take a look. As I say above, I can't just accept that you need an extra endif -- darn it, the things should balance out !
Interesting that you, too, found that copy / paste didn't work.....I thought I was losing my mind :D
All the best
Scotty
Here is the skin, have fun. What ever you do don't purge the buffer, I am working on the update time turning red when information is 1 hour old. But if there is nothing in buffer it crashes. Maybe you can figure that one out.
Scotty,
It was all typed in by me. No cut and paste. I am still playing, but if it works I ain't going to complain.
Thanks, I'll take a look
Question: above, in the code you posted, you wrote:
storevar,var0=1,0
what is the extra term at the end (,0)?? Why not just storevar,var0=1 ???
I suspect maybe things have changed (I am not enrolled as a beta tester, and the only reference file that I have access to is for 10.2 - and in that, the storevar command doesn't have the extra term that you included....)
All the best.......Scotty
Quote from: BlazingwolfScotty,
It was all typed in by me. No cut and paste. I am still playing, but if it works I ain't going to complain.
I do know what you mean - but it should make sense......
All the best..............Scotty
I would like it to make sense also. The code I am using does not have the extra ,0 in like joelw135's and it still works like that. Here is the code in question:
initvar,var0,1
imagebutton,131,64,right_arrow.png,t,1,13,var0_1
button,131,64,12,24,0,4,0,0
imagebutton,120,64,left_arrow.png,t,1,13,var0_-1
button,120,64,12,24,0,2,0
if,var,var0,,>,%var29%
storevar,var0=1
else
endif
if,var,var0,,<,1
storevar,var0=%var29%
else
endif
endif
You can see where I added in some of the code you posted.
I am looking at the code, I don't no where you see that!
I think he meant the code you typed in an earlier post.
Hi joelw135
there is, I think, an extra endif in the skin that you posted. I have made your skin red, and the extra endif is in green.
// Icon is button to weather section
initvar,var0,1
imagebutton,144,23,right_arrow.png,t,1,13,var0_1
button,144,23,12,24,0,4,0,0
imagebutton,144,41,left_arrow.png,t,1,13,var0_-1
button,144,41,12,24,0,2,0
if,var,var0,,>,%var29%
storevar,var0=1
else
endif
if,var,var0,,<,1
storevar,var0=%var29%
else
endif
endif
load,city,%var0%
changefont,Frutiger Linotype,11,b
text,128,0,[name],c
changefont,Frutiger Linotype,12,
todayicon,114,23,,t
button,90,64,33,36,3,4,100,1
if,region,1,999
button,90,64,34,34,1,4,0,-1
button,90,64,34,34,4,4,999
button,90,64,34,34,10,4,999
else
endif
if,refresh
color,font,125_125_125
else
color,font,-1_4_-1
endif
color,font,0_255_255
today,realtemp,123,11,,°,c
color,font,255_255_255
color,font,255_153_0
today,humidity,142,11,,H,c
color,font,-1_4_-1
if,refresh
color,font,-1_4_-1
else
endif
if,region,1,0
button,120,0,30,12,1,4,999,-1
else
button,120,0,30,12,1,4,0,-1
button,120,0,30,12,4,4,999
button,120,0,30,12,10,4,999
if,region,4,0
else
if,region,10,0
else
button,169,0,11,11,-1,-1,0,-1
endif
endif
endif
Gotta go - my beloved is asking why I spend so much time at the computer :wink:
All the best.....Scotty
That is the extra endif that makes this work for our skin. Can you see why we need it. I can't find anything that would need it.
That is the endif we are talking about, with out it the darn thing wouldn't work. Like you said it could be anything in the way the code was placed in the skin. I have had problems with spacing causing problems.
Hi again
I left my wife watching TV :)
I loaded joelw135's skin, and the scrolling worked....then I deleted the endif that we all agree should not be there -- and it STILL WORKED :shock:
Curioser & curioser......
Just FYI, here's my skin (you'll recognize a lot of the code, Blazingwolf :wink: ).....it's not really a ZIP, just DL, & change the extension from ZIP to TXT... then load it, and see if the scrolling works for you. Some of the images may not be there (we use different weather icons, and I've modifed a number of the buttons) but that's a detail...
Let me know....Scotty
Strange your works on my unit also. I think I will rewrite the whole section and see waht happens. Still doesn't make sense but we will see what happens.
One thing I have noticed about joelw135's skin:
Quoteimagebutton,144,23,right_arrow.png,t,1,13,var0_1
button,144,23,12,24,0,4,0,0
imagebutton,144,41,left_arrow.png,t,1,13,var0_-1
button,144,41,12,24,0,2,0
Several of the buttons overlap. Look at the left arrow button, drawn at 144,41. the "invisible" button drawn at 144,23 overlaps it (because that button is 12 by 24, so it extends down over the left arrow); and the top half of the "invisible" button at 144,41 also overlaps it....
Not sure if this is the problem.....but it means that, when you click on the left arrow, you activate 3 lines of code....
All the best.....Scotty
Sorry I missed typed those lines they should have been 12 by 12. Anyway I removed those lines as I didn't need them. I have started retyping the region and so far the buttons work the way they are suppossed to without the extra endif. Hopefully it will stay that way.
I rewrote the code and removed the endif, and it seems to be working. That is sort of a de-lima, since we now know code even when typed correctly mite not work. I know now that spacing also has something to do with the code also.
Quote from: BlazingwolfSorry I missed typed those lines they should have been 12 by 12. Anyway I removed those lines as I didn't need them. I have started retyping the region and so far the buttons work the way they are suppossed to without the extra endif. Hopefully it will stay that way.
Quote from: joelw135I rewrote the code and removed the endif, and it seems to be working.
Glad it's working. I have no good explanation for why you needed the "extra" endif, and can only assume that there's some strange character in there somewhere (I even cut & pasted into Word, and turned on "show all characters" - but didn't see anything untoward).
All the best....................Scotty
Dam this turned into a big thread for a not so hard button. lmao. Remember you have to be careful when copying code.
Lordtwisted :D
There seems to be a problem when you cut and paste, or have blank spaces in certain code. The code can look identical but yet won't work.
joelw135,
Oh i know, i found that out the hard way, in the begining of todayplus.
Lordtwisted :D
This is like erector set, take the pieces or modules and create almost anything you want in reason. But this little quirk makes it a bit harder.
A TAB character after a command can cause problems as well. This might happen if you delete enough text at the end of a command that causes a following blank line (which may have an imbedded TAB) to move up.
On a PC you can using something like Word and force it to display formatting characters. If editing on the PDA, use the keyboard's right arrow key to move to the end of the line. If at the end of the command, pressing the arrow key causes the cursor to jump to the next line, then you should be OK, otherwise you may have additional whitespace characters (i.e. spaces, Tabs, etc.) which may need to be deleted.
I normally use notepad to edit, much easier and faster loading than word.
I use notepad as well (but also do alot of editing on my PDA), but Word is useful for periodically checking for formatting that might be causing problems.
Quote from: fishboyI use notepad as well (but also do alot of editing on my PDA), but Word is useful for periodically checking for formatting that might be causing problems.
Same here. As noted above, I copied joelw135's text into Word precisely for that reason - to look for unexpected characters, as an explanation of why he & BW needed an extra endif - but didn't see anything.
Good to know that others (see LT post above) also found that copy / paste sometimes doesn't work. I wasted probably three hours, tearing my hair out, looking at 4 simple lines of code that I had copied / pasted, but didn't work. Then I typed them, and voila......
All the best..........................Scotty
Hi- I have also experienced some problems with what appear to be spurious characters in a skin file. Now, as a matter of course, I always edit any skin file I work with using TextPad 4. Saving a file in this (PC based) editor strips all white space from the file. In addition I convert all tabs to just two spaces so that indentation is still visible but the file can easily be viewed with Pocket Word.
Closer to the topic, this has been a very valuable thread. I have learned a lot just following the discussion. Thank you to all participants!:)
Regards
swm1605