• Welcome to TodayPlus Boards v2.
 

Weather left arrow

Started by Blazingwolf, January 11, 2004, 10:17:33 AM

Previous topic - Next topic

Scotty

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

joelw135

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.
Dell Axim X3i, Windows Mobile 2003
512mb Kingston SD card
256mb Lexar SD card
Today Plus
WisBar Advanced
PIEPlus
DotPocket

Blazingwolf

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. :(
Toshiba E800 WM2003 SE
Ipaq 3955 WM2003, SD and CF,Pocket Informant
Dell Axim X5 PPC2002 SD and CF (Wife's)

Blazingwolf

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
Toshiba E800 WM2003 SE
Ipaq 3955 WM2003, SD and CF,Pocket Informant
Dell Axim X5 PPC2002 SD and CF (Wife's)

MadTxn

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

Scotty

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

joelw135

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.
Dell Axim X3i, Windows Mobile 2003
512mb Kingston SD card
256mb Lexar SD card
Today Plus
WisBar Advanced
PIEPlus
DotPocket

Scotty

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

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

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

Blazingwolf

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.
Toshiba E800 WM2003 SE
Ipaq 3955 WM2003, SD and CF,Pocket Informant
Dell Axim X5 PPC2002 SD and CF (Wife's)

joelw135

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
Dell Axim X3i, Windows Mobile 2003
512mb Kingston SD card
256mb Lexar SD card
Today Plus
WisBar Advanced
PIEPlus
DotPocket

Scotty

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

Blazingwolf

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.
Toshiba E800 WM2003 SE
Ipaq 3955 WM2003, SD and CF,Pocket Informant
Dell Axim X5 PPC2002 SD and CF (Wife's)

Scotty

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