Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sridhar_sigired
Creator

Button color should change when selected

Hello,

Can anyone please help me to change the color of button when we select it.

Button color is blue right now, where as when we select it should change to green color.

Thanks.

1 Solution

Accepted Solutions
jsingh71
Partner - Specialist

Follow this:

1. Take Three Buttons

     1. First

     2. Second

     3. Third

2. Take one Variable like "vClor" and assign 0 to it.

3. Now on First button set below action on "Set Variable"

  =if(vColor=1 or vColor =2,0,0)

them First button only write below expression under Calculated with in Base color area:

=if(vColor=1 or vColor =2,0,0)

4. follow this step for Second and Third Button

     Second Button:

          =if(vColor=0 or vColor =2,1,1)

          if(vColor=1,Green(), Blue())

     Third Button

          =if(vColor=1 or vColor =0,2,2)

           if(vColor=2,Green(), Blue())

View solution in original post

12 Replies
sunny_talwar

Use calculated Color for button color. Use the same variable use in the button action to control its color

If(vVar = 1, ActiveColor, DeactiveColor)

where vVar is button's action

marcus_sommer

You need to set an extra variable-value by clicking from this button, for example vColor to 0 or 1, maybe in this way:

set variable action

= if($(vColor) = 0, 1, 0)

button-color:

= if($(vColor) = 0, blue(), green())

- Marcus

Not applicable

Hi Sridhar

PFA Qlikview, You have to make you variables and just do some magic. Hope this qvw helps you

Regards

Chitra

sridhar_sigired
Creator
Author

Here i have three actions for button. So do i need to write nested if condition? Can u help on this?

Activate Object - CH02

Activate Object - CH04

Activate Object - CH06

sridhar_sigired
Creator
Author

I have created variable vColor with 0 value and

set variable action as

= if($(vColor) = 0, 1, 0)

button calculated color as

= if($(vColor) = 0, blue(), green())

But it is not working. Any problem in above lines?

jonathandienst
Partner - Champion III

Is there an initial value in vColor? If vColor is null neither expression will be valid and they will both be ignored.

Initialise vColor to 0 or 1 using the variable overview or an input box.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

Please set a variable to change the color and set it in calculated section under backgroud color:

if(vChangeColor=1,RGB(0,255,0),RGB(0,0,255))

marcus_sommer

The remark from jontydkpi is right - you need to initialise this variable (to make another loop within the expressions to fetch this case is possible but not really useful - once set to 0 or 1 and it worked).

- Marcus

awhitfield
Partner - Champion

Hi Sridhar,

simple example attached

HTH - Andy