Uanble to get background drawn in white (Sitronix ST7529)

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Uanble to get background drawn in white (Sitronix ST7529)


    I am displaying a text box widget on the screen wihtout making it a child of another window.
    No matter what I do, the text box is drawn on a black background.

    I have tried the following:
    - WM_SetDesktopColor(GUI_WHITE);
    - TEXT_SetBkColor(hText, GUI_WHITE); (hText being the handle of the TEXT widget)
    - Adding #define TEXT_DEFAULT_BK_COLOR GUI_WHITE to TEXT.h

    The code creating the TEXT widget is:

    void MainTask(void)
    TEXT_Handle hText;
    hText = TEXT_CreateEx(162, 40, 88, 70,0, WM_CF_SHOW, TEXT_CF_HCENTER | TEXT_CF_VCENTER, 0, "Everything you wanted to know about fruit but were too afraid to ask.");
    TEXT_SetBkColor(hText, GUI_WHITE);
    TEXT_SetWrapMode(hText, GUI_WRAPMODE_WORD);
    while (1) {

    The GUI is in another task as follows

    static void DisplayInit(void) {

    OS_Suspend (&TCBMT);//MainTask


    WM_SetCallback(WM_HBKWIN, _cbBkWindow);
    OS_Resume (&TCBMT);//Main Task

    OS_SetPriority(&TCBDI,1); // change priority to lowest

    Help - what am I doing wrong?
  • Hello Lawrence,

    it seems that your display shows inverted colors. If for example WM_SetDesktopColor(GUI_WHITE) results in a black desktop window the display needs to be inverted to show the right colors. This can be done by adding the following lines to the initialization:

    LCD_WRITE_A0(0x30); /* EXT = 0 */
    LCD_WRITE_A0(0xA7); /* Inverse Display */

    I hope this helps.

  • Hi

    I am a little confused, because the problem does not seem to be inverted colors.

    I can get a text box to display black text on white background if I do all of the following:
    1. In the callback for the background window, set background color to BLACK and foreground color to WHITE. (I am being serious).
    2. After creating the text widget, set the widget background to WHITE.
    In this case, the text widgets are drawn as white boxes (with black text) against a black background.

    On the other hand, if I do the following:
    1. In the callback for the background window, set background color to WHITE and foreground color to BLACK.
    2. Invert colors in the driver as you suggested
    then the background is black and the widget text is white (which is correct given that the colors are inverted).

    If I invert colors using your code, the text widgets are drawn ok, with colors inverted (widgets show white text on black background).

    The only thing I can think of is that the background window cannot draw a white background.