Changing label text color in D4d (EGUI)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Changing label text color in D4d (EGUI)

1,348 Views
MarkW_
Contributor I

I am working with MQX 3.8 and EGUI on an MK60FX512 and I am attempting to produce labels with multiple text colors on a single screen.  Of course this should be feasible using different color schemes for each call to D4D_DECLARE_LABEL. However, when I try to do that the compiler (Ewarm 6.3) produces an error stating that the pscheme must be a constant..  This is despite the fact that I am creating the alternate color schemes using exactly the same call as that used to created the default color scheme:


D4D_DECLARE_CLR_SCHEME(d4d_clr_scheme_default, \
D4D_COLOR_SCR_DESKTOP, D4D_COLOR_SCR_OUTLINE, D4D_COLOR_SCR_TITLEBAR, D4D_COLOR_SCR_TILTLETEXT, D4D_COLOR_SCR_EXIT_BTN_FORE, D4D_COLOR_SCR_EXIT_BTN_BCKG,\
D4D_COLOR_BCKG_NORM, D4D_COLOR_BCKG_DISABLED, D4D_COLOR_BCKG_FOCUS, D4D_COLOR_BCKG_CAPTURE,\
D4D_COLOR_FORE_NORM, D4D_COLOR_FORE_DISABLED, D4D_COLOR_FORE_FOCUS, D4D_COLOR_FORE_CAPTURE,\
D4D_COLOR_GAUG_HUB, D4D_COLOR_GAUG_POINTER,\
D4D_COLOR_SLDR_BAR_BCKG, D4D_COLOR_SLDR_BAR_FORE, D4D_COLOR_SLDR_BAR_START, D4D_COLOR_SLDR_BAR_END,\
D4D_COLOR_CHECKBOX_ICON_BCKG,\
D4D_COLOR_GRAPH_GRID,\
D4D_COLOR_PRGRS_BAR_BAR_BCKG, D4D_COLOR_PRGRS_BAR_BAR_FORE, D4D_COLOR_PRGRS_BAR_BAR_END\
)

static D4D_CLR_SCHEME *pSchemeGreen = (D4D_CLR_SCHEME*)&d4d_clr_scheme_default;

 

When I try to use pSchemeGreen the compiler throws an error "expression must have a constant value"

 

I am guessing that this is something obvious, but I am stuck so any help would be appreciated.


Thanks.

0 Kudos
3 Replies

728 Views
Ali_Pina
NXP Employee
NXP Employee

Hi Mark,

I just received a similar question and I developed a simple screen example that uses two labels. The first one uses the color scheme I created (check below, only font color was changed) and the seconde one the default scheme.

D4D_DECLARE_CLR_SCHEME(d4d_clr_scheme_one, \

        D4D_COLOR_SCR_DESKTOP, D4D_COLOR_SCR_OUTLINE, D4D_COLOR_SCR_TITLEBAR,      D4D_COLOR_SCR_TILTLETEXT, D4D_COLOR_SCR_EXIT_BTN_FORE, D4D_COLOR_SCR_EXIT_BTN_BCKG,\         

        D4D_COLOR_BCKG_NORM_ONE, D4D_COLOR_BCKG_DISABLED, D4D_COLOR_BCKG_FOCUS, D4D_COLOR_BCKG_CAPTURE,\

        D4D_COLOR_FORE_NORM_ONE, D4D_COLOR_FORE_DISABLED, D4D_COLOR_FORE_FOCUS, D4D_COLOR_FORE_CAPTURE,\

        D4D_COLOR_GAUG_HUB, D4D_COLOR_GAUG_POINTER,\

        D4D_COLOR_SLDR_BAR_BCKG, D4D_COLOR_SLDR_BAR_FORE, D4D_COLOR_SLDR_BAR_START, D4D_COLOR_SLDR_BAR_END,\

        D4D_COLOR_CHECKBOX_ICON_BCKG,\

        D4D_COLOR_GRAPH_GRID,\

        D4D_COLOR_PRGRS_BAR_BAR_BCKG, D4D_COLOR_PRGRS_BAR_BAR_FORE, D4D_COLOR_PRGRS_BAR_BAR_END\

        )

D4D_DECLARE_RLABEL_AUTOSIZE(LBL_ONE,"ONE", 40, 40, 3, D4D_LBL_F_DEFAULT, (D4D_CLR_SCHEME*)&d4d_clr_scheme_one, FONT_ARIAL7_BIG, NULL, NULL)

D4D_DECLARE_RLABEL_AUTOSIZE(LBL_TWO,"TWO", 80, 80, 3, D4D_LBL_F_DEFAULT, NULL, FONT_ARIAL7_BIG, NULL, NULL)

Hope you find it useful.

-Ali

729 Views
Monica
Senior Contributor III

How is the project going guys?

Freescale's Techs are working to help you out ASAP...thanks for your patience!

Regards!

Monica.

0 Kudos

729 Views
james07
Contributor I

Hello Mark, i´m in the same trouble, have you alredy fixed? Can you help me?

Thiago

0 Kudos