 |
geniusclown Magician

Joined: 23 Apr 2003 Posts: 358 Location: USA
|
Posted: Mon Sep 06, 2004 6:27 pm
defining button color with variable? |
Is there a way to define a button's color with a variable? I have a particular button whose purpose is to show me the status of a complex multistate trigger, and I would like it to change color depending on what state the trigger is in. I've tried defining the button with a color of @buttoncolor, then changing the value of @buttoncolor, but it takes the value when first defined, but won't change.
I've considered using a statusline, which I can change the color of with a variable, but I use that for another purpose.
I also tried playing with a multistate button to see if I could just set different states for different colors, but I'm having little luck. Besides, having the little drop-down arrow reduces how much room on the button I have for the caption.
I'm open to other suggestions... |
|
_________________ .geniusclown |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Tue Sep 07, 2004 1:47 am |
Sure you can. %btncol is a function and can be used directly in the caption of the button. Of course since it is a function it returns a value, and you don't really want that to show up in the caption. To overcome that we simply use another function that we can have always return null.
%if(%btncol(IDofButtonIwantColored,@buttoncolor))
Voila, the button automatically changes color. I do similar things with %btnenable to have buttons turn on and off when those potrions of my scripts are unavailable, but I don't want the layout to shift. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
mr_kent Enchanter
Joined: 10 Oct 2000 Posts: 698
|
Posted: Tue Sep 07, 2004 1:51 am |
I'd give the button an id if you haven't done so already, then use
#CALL %btncol( button_id,new_color,)
in each state of the trigger. |
|
|
|
 |
geniusclown Magician

Joined: 23 Apr 2003 Posts: 358 Location: USA
|
Posted: Wed Sep 08, 2004 12:57 am |
Awesome. I'll have to play with it next time I'm at my PC....
|
|
_________________ .geniusclown |
|
|
 |
|
|
|