changing button color in Express Version

Recommended Posts


Similar to the thread with the URL I want to change the background color of a button when it is pressed and change the color back when it is either pressed again or when another button is pressed.

When using the source code you have provided in the thread mentioned above, an error occurs. When I only enter the command

backcolor = rgb(255,0,0)

the color of the button changes as it is pressed but I cannot

1. change the color of another button than the one that contains the source code in its "quick sequence"

2. change the color back to the original color when pressing the button again.

Many thanks in advance for your help!

Best regards


Link to comment
Share on other sites

1. to change the color of another button you have to use the button's name. You can assign a name to a component by selecting it, right clicking and selecting "Change Component Name". Then, programmatically you can do MyButton.backcolor = rgb(255,0,0) assuming you named the button MyButton. You don't have to do this from the quick sequence because the quick sequence is inside the button and therefore local to the button.

2. Changing the color back requires a check to see which state you are in. To toggle a button's color on press you'd put this in a quick sequence:

if (backcolor == rgb(255,0,0))
   backcolor = rgb(160,160,160)
   backcolor = rgb(255,0,0)

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.