How to set the color of a button from code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-20 1:45 AM
Hello,
Is there a way to change the color of a botton directly from the code?
Thanks.
Solved! Go to Solution.
- Labels:
-
TouchGFX
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-20 2:00 AM
Hi @GMeur​,
There are multiple types of buttons. If you're using a standard Button it requires an image for both released and pressed states so you would have to have assets in the color of your choice.
If you're using a flex button, you might be using a "Box with Border" - And here you can change the color of the box (and thus button) directly.
/Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-20 2:00 AM
Hi @GMeur​,
There are multiple types of buttons. If you're using a standard Button it requires an image for both released and pressed states so you would have to have assets in the color of your choice.
If you're using a flex button, you might be using a "Box with Border" - And here you can change the color of the box (and thus button) directly.
/Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-20 2:28 AM
Thanks for your quick reply.
Therefore, if I want to design a keyboard whose color of the keys can be changed easily from the code, I must use flex buttons for them and implement the 'clicklistener' function, right? Can you think of any easier ways of doing it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-20 2:53 AM
That's one way of doing it yeah.
