Sign in to follow this  
Christian_Bramsiepe

changing button color in Express Version

Recommended Posts

Hi.

Similar to the thread with the URL http://www.azeotech.com/board/index.php?showtopic=2686 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

Christian

Share this post


Link to post
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)
else
   backcolor = rgb(255,0,0)
endif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this