Author Topic: Variables in TP: What lesson we have learned so far???  (Read 1927 times)

uk_skinner

  • Global Moderator
  • TodayPlus Veteran
  • *****
  • Posts: 1313
Variables in TP: What lesson we have learned so far???
« on: January 14, 2005, 09:32:44 AM »
With the more possible new features from TP codes, it seemed to be an issue that we start to run out off variables.  Although several discussion had been posted here, and I would like share my experience here with you.  And please welcome to make any comment or suggestion.

In a thread, I tried to test the possible vars beyond 33 http://www.jhollin1138.com/forums/viewtopic.php?t=1627.  With some success, I assumed that it is safe to use var41 – var85.  However, with recent one case, I need to revisit this issue.  In the recent Hammerskin 1.05, Wichtel used var51 in satellite/radar image section.  This caused a problem in Spanish OS and resulted a totally failure in the skin.  By replacing var51 with var2, the skin worked.  

The proposed workaround is to re-use the variables in different regions.  How does this idea work?

An example from Hammerskin, replace var51 with var2:

The var2 was used as RSS number in RSS region and was reset back to “1” each time you enter to the RSS region (“button,211,148,29,29,-1,6,var2=1”in region 1 codes).  Therefore, it is possible to use var2 in other regions since no matter how var2 changes, it will be reset before jumping to RSS region.  In the case of fixing Hammerskin for Spanish OS, I replaced all var51 in satellite/radar section with var2.

So based on this ideas, a lot of variables can be free to be used.  For instance, var26 and var27 were used for position of scrolling bar in RSS region and also be reset to default values each time.  These two can be re-used in other regions.  So are var12 and var18.  The list can go on if you look the codes in region 1.

The only thing, you have to be careful is to make sure: don’t reuse the variables if two regions are in the same page.  For example, region 5 (main page agenda) and region 2 (main page) are in the same “screen”.  If you reuse the variables then you will run into the problem.  Also there are some pop-up windows in the region 3. (weather or radar image).  I would suggest not apply this strategy between region 3 and region 7.  

In conclusion, I feel this way is much better than use the variables beyond 33.  It should be more acceptable for different language OS or device.  Again, this remain to be seen in the feature.

Geezer

  • TodayPlus Expert
  • ****
  • Posts: 201
Variables in TP: What lesson we have learned so far???
« Reply #1 on: January 14, 2005, 09:43:25 AM »
Great idea UK, I'm going to persue this in the 2B-VGA skin.  I'll keep you posted this weekend how it goes.  I have to work on Saturday so that may put me back several hours.  Once again, ya da man...   :bow:
Toshiba e800, PPC2003 SE, 2.2 Gb MicroDrive, 512 CF, 512 SD, 2 Extended Batteries, Plus other excentric goodies.

Wichtel

  • Global Moderator
  • TodayPlus Veteran
  • *****
  • Posts: 550
Variables in TP: What lesson we have learned so far???
« Reply #2 on: January 14, 2005, 09:48:55 AM »
I take this into my ToDo list and convert this in the Next Version

uk_skinner

  • Global Moderator
  • TodayPlus Veteran
  • *****
  • Posts: 1313
Variables in TP: What lesson we have learned so far???
« Reply #3 on: January 14, 2005, 09:58:13 AM »
I forgot to mention this:

It is also better (I believe) to add reset code for any re-use variables in region 1(Hammerskin).  That way, you can ensure the variables you reuse always are the default ones before go into the regions.

Like the example of var51 replacing with var2.  The reset code should be also added into the region 1 for region 3:

if,region,3,0
      imagebutton,211,32,wetterbutton_grau.png,t,3,4,0,1
      button,211,32,29,29,-1,6,var9=1
                button,211,32,29,29,-1,6,var2=1

........
........