Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I want to change the color of a button depending on whether the button is activated or deactivated.
I tried the following:
- Setting up a variable Button
- Set variable on Button Click (Variable = vbutton, Value = 1)
Then I set up a calculated button color:
If(vButton = 1, RGB(20, 255, 8), RGB(247, 159, 8,))
The result is, that the button color changes when selecting the button. So far so good. I want the button color to change back to the original color though when I am pressing the button again (which means "deselection" in my application, because I defined a toggle selection on button click as well).
How can I do this?
Thanks very much in advance
Rgds Stephan
Hi
Change the value in the action to the expression:
=If(vButton = 0, 1, 0)
This will toggle the button between 1 and 0. Your colour expression should work fine.
HTH
Jonathan
like this?
Update : Change color according to your need.
Hi
Change the value in the action to the expression:
=If(vButton = 0, 1, 0)
This will toggle the button between 1 and 0. Your colour expression should work fine.
HTH
Jonathan
PFA
set variable should be
=if(vButton=1,0,1) or as Jonathan suggest
and calculated color should be
If( vButton = 1, RGB(20, 255, 8), RGB(247, 159, 8))
instead of (removelastcomma)
If(vButton = 1, RGB(20, 255, 8), RGB(247, 159, 8,))
you can use an input box to check your variable
Thanks all, this really worked well - I was not aware of the 0,1,0 logic.
Bloody beginner me
Follow these easy steps
1. Create a variable vChange and assign value to 1
2. Select a button object and give proper name.
In the button properties
-> In general tab Color property-> Add calculated color expression : =If(vChange=1,Green(),Red())
In the Actions tab-> Add actions as Setvariable
-> Variable : vChange (without "=")
-> Value : =If(vChange=1,0,1)
Now click and see