TodayPlus Boards v2

Programming and MOD Forums => Developer's Corner Discussion => Topic started by: Timmy on January 05, 2005, 10:44:26 AM

Title: Button colour switch
Post by: Timmy on January 05, 2005, 10:44:26 AM
@All,

In my latest skin, I've made eightteen new buttons, as you can see here:
(http://www.jhollin1138.com/forums/files/imageviewer_01.gif)

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: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
Title: Button colour switch
Post by: uk_skinner 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
Title: Button colour switch
Post by: Timmy 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: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
Title: Button colour switch
Post by: Timmy on January 05, 2005, 04:52:27 PM
And here are the images:

(http://img115.exs.cx/img115/6427/radarbuttons7dq.gif)


Timmy