Author Topic: Button colour switch  (Read 2220 times)

Timmy

  • TodayPlus Veteran
  • *****
  • Posts: 640
Button colour switch
« on: January 05, 2005, 10:44:26 AM »
@All,

In my latest skin, I've made eightteen new buttons, as you can see here:


I've worked the whole afternoon, but did not succeed in the following: when I click on a button, the clicked button must remain black, untill I click on another button.

Here's a little part (an example) of my skin text:
Code: [Select]
initvar,var1,0

imagebutton,230,8,Knop_1.png,,-1,0,\Program Files\ImageViewer\1.imv
button,230,8,8,8,-1,6,var1=1
imagebutton,221,8,Knop_2.png,,-1,0,\Program Files\ImageViewer\2.imv
button,221,8,8,8,-1,6,var1=2

if,var,var1,,=,1
image,230,8,knop-zwart.png,
else
if,var,var1,,=,2
image,221,8,knop-zwart.png,
else
endif
endif


What am I doing wrong???????????

Timmy
Toshiba e750BT, WM 2003, Today Plus 0.11.0, WISbar Adv, Agenda Fusion, Pocket Slides, TomTom

uk_skinner

  • Global Moderator
  • TodayPlus Veteran
  • *****
  • Posts: 1313
Button colour switch
« Reply #1 on: January 05, 2005, 11:20:21 AM »
Timmy:

  This might not be the best way, but here is my first solution.  You got 18 different size of buttons., so you need 18 "if..else..endif" to determine their status.  

if,var,var1,,=,1
   image,230,8,knop-zwart.png,
else
   image,230,8,button-black.png
endif

if,var,var1,,=,2
 image,230,8,knop-zwart.png,
else
  image,230,8,button-black.png
endif


Alternatively, you can create 18 different png in which one "activate" 17 "inactivated" one and name the files like knop-zwatr1.png,knop-zwatr2.png...etc .  Then you can just need one code.  

image,230,8,knop-zwart%var1%.png

Timmy

  • TodayPlus Veteran
  • *****
  • Posts: 640
Button colour switch
« Reply #2 on: January 05, 2005, 03:16:16 PM »
UK_skinner,

With your help I won!  But it costs me bload, sweat and tears to fix it... The main problem was that I had to stop and reload TodayPlus. Then, at once. it worked!

Here's my skin code:
Code: [Select]
button,230,8,8,8,0,6,var1=1
button,221,8,8,8,0,6,var1=2
button,212,8,8,8,0,6,var1=3
button,203,8,8,8,0,6,var1=4

if,var,var1,,=,1
image,230,8,Zwart0.png
else
image,230,8,knop1.png
endif

if,var,var1,,=,2
image,221,8,Zwart0.png
else
image,221,8,Knop2.png
endif

if,var,var1,,=,3
image,212,8,Zwart0.png
else
image,212,8,Knop3.png
endif

if,var,var1,,=,4
image,203,8,Zwart0.png
else
image,203,8,Knop4.png
endif

button,230,8,8,8,-1,0,\Program Files\ImageViewer\1.imv
button,221,8,8,8,-1,0,\Program Files\ImageViewer\2.imv
button,212,8,8,8,-1,0,\Program Files\ImageViewer\3.imv
button,203,8,8,8,-1,0,\Program Files\ImageViewer\4.imv

  ... and so on for the other 14 buttons.


Thanks again!
Timmy
Toshiba e750BT, WM 2003, Today Plus 0.11.0, WISbar Adv, Agenda Fusion, Pocket Slides, TomTom

Timmy

  • TodayPlus Veteran
  • *****
  • Posts: 640
Button colour switch
« Reply #3 on: January 05, 2005, 04:52:27 PM »
And here are the images:




Timmy
Toshiba e750BT, WM 2003, Today Plus 0.11.0, WISbar Adv, Agenda Fusion, Pocket Slides, TomTom