2025-02-28 3:47 AM
I googled how to make this change. I found several references to class members setBackgroundColor, setButtonColor, setBoxColor but none of them work (are members). I checked BoxWithBorderButtonStyle.hpp and could find no reference to any of these nor any (obvious) function that would allow me to change the color. The documentation that I can find online does not match my results. Any feedback would be helpful. I am using TouchGFX 4.24.2
Solved! Go to Solution.
2025-02-28 5:12 AM - edited 2025-02-28 5:54 AM
Hello,
I think you need to use:
/**
* Sets the colors.
*
* colorReleased The color released.
* colorPressed The color pressed.
* borderColorReleased The border color released.
* borderColorPressed The border color pressed.
*/
void setBoxWithBorderColors(const colortype colorReleased, const colortype colorPressed, const colortype borderColorReleased, const colortype borderColorPressed)
{
up = colorReleased;
down = colorPressed;
borderUp = borderColorReleased;
borderDown = borderColorPressed;
handlePressedUpdated();
}
Tip: how did I find it?
Create a flex button and change the background colors.
Go to the ScreenXXXViewBase in "generated" folder and check what was the call corresponding to the color settings:
flexButton1.setBoxWithBorderColors(touchgfx::Color::getColorFromRGB(168, 209, 230), touchgfx::Color::getColorFromRGB(54, 68, 217), touchgfx::Color::getColorFromRGB(255, 255, 255), touchgfx::Color::getColorFromRGB(250, 250, 250));
The two first parameters correspond to the pressed/released background colors.
Hope that helps.
2025-02-28 5:12 AM - edited 2025-02-28 5:54 AM
Hello,
I think you need to use:
/**
* Sets the colors.
*
* colorReleased The color released.
* colorPressed The color pressed.
* borderColorReleased The border color released.
* borderColorPressed The border color pressed.
*/
void setBoxWithBorderColors(const colortype colorReleased, const colortype colorPressed, const colortype borderColorReleased, const colortype borderColorPressed)
{
up = colorReleased;
down = colorPressed;
borderUp = borderColorReleased;
borderDown = borderColorPressed;
handlePressedUpdated();
}
Tip: how did I find it?
Create a flex button and change the background colors.
Go to the ScreenXXXViewBase in "generated" folder and check what was the call corresponding to the color settings:
flexButton1.setBoxWithBorderColors(touchgfx::Color::getColorFromRGB(168, 209, 230), touchgfx::Color::getColorFromRGB(54, 68, 217), touchgfx::Color::getColorFromRGB(255, 255, 255), touchgfx::Color::getColorFromRGB(250, 250, 250));
The two first parameters correspond to the pressed/released background colors.
Hope that helps.
2025-02-28 6:04 AM
Thank you so much - that was most helpful.