Hi All,
Thank you for the fast response, I didn't initially realise that the button press colour change was done within our code instead of the EVE.
The idea about using the OPT_FLAT is a good one which we already use for 3D buttons, but the buttons I am drawing are always drawn flat (in my opinion they look smarter), so colour-change is needed to signify the difference between pressed and not pressed. I went back through the code and found that when we define a button, we add the following to the display list:
#define FGCOLOR 0x003870
#define BGCOLOR 0x002040
#define GUI_BUTTON(tag,x,y,w,h,font,flat,str) \
{ \
bool pressed = ((tag) == current_tag); \
uint16_t toggle_flat = (pressed ? FT_OPT_FLAT : 0); \
if (pressed) ft_cpcmd_fgcolor(avgcolour(FGCOLOR, BGCOLOR)); \
ft_cpcmd(FT_DL_TAG(tag)); \
ft_cpcmd_button(x, y, w, h, font, (flat == 1 ? FT_OPT_FLAT : toggle_flat), str);
if (pressed) ft_cpcmd_fgcolor(FGCOLOR); \
}
As you can see, the issue is that the FG_COLOR (and BG_COLOR) is hardcoded for these items. I was getting lucky by calling the 'ft_cpcmd_fgcolor' command in my main display list, which is setting the colour on the EVE and when not pressed this structure/function is not adding any additional colour commands to the display list. However, when it is being pressed, the redraw over-rides any colour changes I make and auto-sets it to an average of the FG and BG colours, which is what causes the issue.
If I add an intermediate function for setting FG colour that sets the value locally (and change from a constant to a global variable) and then call the ft_cpcmd_fgcolor function with that colour then it will probably work.
Thanks for all your help guys, sometimes you just need someone to point out your own mistakes! Great community, keep it up