cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

How to change Text or Color Button by Service

Nguyen_Khue
7-Bedrock

How to change Text or Color Button by Service

Hi, I'm building my smart home. I want to click on Button, it will change color or text for 2 states. How can i do?

NK_9909348_0-1623140766574.png

2 REPLIES 2
odukiya
15-Moonstone
(To:Nguyen_Khue)

Hello @Nguyen_Khue 

 

Please go through the following post to achieve your usecase

How-to-change-Label-and-Colour-of-button-dynamically 

 

Please feel free to revert in case it doesn't resolve your query.

 

Thanks

Om Dukiya

Hi @Nguyen_Khue ,

 

There is a property on each visual widget called CustomClass. You can have your service output to it 2 different strings.

 

Your CSS should look something like this

 

.myFirstButton ptcs-button {
    color: red !important;
    background: yellow !important;
}
.mySecondButton ptcs-button {
    color: yellow !important;
    background: purple !important;
}

 

"myFirstButton" and "mySecondButton" being the 2 different strings you output from your service. ofc you can change them to whatever fits your context.

 

Good luck,

Gabriel

Top Tags