Updating to version 5.42.9 made my listboxes background transparent

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

  • Updating to version 5.42.9 made my listboxes background transparent

    Hi everyone,
    I use the Keil Middleware with emWin. The last days I updated to version 5.42.9 and now all my LISTBOX widgets have a transparent background. I use a custom skin. What can cause this behaviour? Here is my relevant code.

    C Source Code

    1. viewWin = WM_CreateWindow(0, 0, XSIZE_PHYS, YSIZE_PHYS, WM_CF_SHOW, displaySettingsViewWinCallback, 0);


    C Source Code

    1. skinSelector = DROPDOWN_CreateEx(SKIN_SELECTOR_POS_X_px, SKIN_SELECTOR_POS_Y_px, SKIN_SELECTOR_WIDTH, SKIN_SELECTOR_HEIGHT, viewWin, WM_CF_SHOW, DROPDOWN_CF_AUTOSCROLLBAR, SKIN_DROPDOWN_ID);
    2. skinDropdownMenue(skinSelector);


    C Source Code

    1. const SCROLLBAR_SKINFLEX_PROPS scrollbarSkinLight =
    2. {
    3. {BG_COLOR_LIGHT, TEXT_COLOR_LIGHT, BG_COLOR_LIGHT},
    4. {BG_COLOR_LIGHT, BG_COLOR_LIGHT},
    5. {BG_COLOR_LIGHT, BG_COLOR_LIGHT},
    6. {BG_COLOR_LIGHT, BG_COLOR_LIGHT},
    7. TEXT_COLOR_LIGHT,
    8. BG_COLOR_LIGHT,
    9. };
    10. void enableScrollbarDefaultSkins(void)
    11. {
    12. SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX);
    13. DROPDOWN_SetDefaultSkin(DROPDOWN_SKIN_FLEX);
    14. SCROLLBAR_SetSkinFlexProps(&scrollbarSkinLight, SLIDER_SKINFLEX_PI_PRESSED);
    15. SCROLLBAR_SetSkinFlexProps(&scrollbarSkinLight, SLIDER_SKINFLEX_PI_UNPRESSED);
    16. }
    Display All


    C Source Code

    1. const DROPDOWN_SKINFLEX_PROPS dropDownSkinLight =
    2. {
    3. {TEXT_COLOR_LIGHT, GUI_RED, GUI_RED},
    4. {GUI_RED, GUI_RED},
    5. {GUI_RED, GUI_RED},
    6. TEXT_COLOR_LIGHT,
    7. TEXT_COLOR_LIGHT,
    8. TEXT_COLOR_LIGHT,
    9. 1
    10. };
    11. const DROPDOWN_SKINFLEX_PROPS dropDownSkinDark =
    12. {
    13. {GUI_GREEN, GUI_GREEN, GUI_GREEN},
    14. {GUI_GREEN, GUI_GREEN},
    15. {GUI_GREEN, GUI_GREEN},
    16. TEXT_COLOR_DARK,
    17. TEXT_COLOR_DARK,
    18. TEXT_COLOR_DARK,
    19. 1
    20. };
    21. void skinDropdownMenue(DROPDOWN_Handle dropdown)
    22. {
    23. //Do not skin invalid dropdowns
    24. if(dropdown == 0)
    25. return;
    26. DROPDOWN_SetFont(dropdown, &GUI_FontMerge16BGo);
    27. DROPDOWN_SetScrollbarWidth(dropdown, 32);
    28. DROPDOWN_SetItemSpacing(dropdown, 15);
    29. DROPDOWN_SetTextAlign(dropdown, GUI_TA_VCENTER);
    30. DROPDOWN_SetTextHeight(dropdown, 23);
    31. DROPDOWN_SetAutoScroll(dropdown, true);
    32. if(viewSettings.scheme == GAUGE_VIEW_DARK_SCHEME)
    33. {
    34. DROPDOWN_SetSkinFlexProps(&dropDownSkinDark, DROPDOWN_SKINFLEX_PI_ENABLED);
    35. DROPDOWN_SetSkinFlexProps(&dropDownSkinDark, DROPDOWN_SKINFLEX_PI_EXPANDED);
    36. DROPDOWN_SetSkinFlexProps(&dropDownSkinDark, DROPDOWN_SKINFLEX_PI_FOCUSED);
    37. }
    38. else
    39. {
    40. DROPDOWN_SetSkinFlexProps(&dropDownSkinLight, DROPDOWN_SKINFLEX_PI_ENABLED);
    41. DROPDOWN_SetSkinFlexProps(&dropDownSkinLight, DROPDOWN_SKINFLEX_PI_EXPANDED);
    42. DROPDOWN_SetSkinFlexProps(&dropDownSkinLight, DROPDOWN_SKINFLEX_PI_FOCUSED);
    43. }
    44. }
    Display All


    Here are some screenshots of the device

    picload.org/view/ddidcdra/edit.jpg.html
    picload.org/view/ddidcdrl/editbright.jpg.html

    The post was edited 2 times, last by Jonathan Schubert ().

  • Hi,

    Yes, this is a bug in this version and is already fixed in newer versions.

    As a workaround you can set the has-trans flag by calling WM_SetHasTrans(hWidget) where hWidget is the handle of the LISTBOX. The next release of the KEIL MDK package will contain the bugfix for this.

    Regards
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Sven,
    thank you for the fast reply. I already downgrade my emWin version to 5.36.6 where everything works as expected. I also tried your bugfix but it didn't work for me. I tried:

    C Source Code

    1. void skinDropdownMenue(DROPDOWN_Handle dropdown)
    2. {
    3. ... Code as previously
    4. WM_SetHasTrans(dropdown);
    5. }

    and

    C Source Code

    1. void skinDropdownMenue(DROPDOWN_Handle dropdown)
    2. {
    3. ... Code as previously
    4. LISTBOX_Handle list = DROPDOWN_GetListbox(dropdown);
    5. WM_SetHasTrans(list);
    6. }


    For the future is there a published list of known bugs for emWin?

    Many Thanks,
    Jonathan
  • Hi Jonathan,

    Indeed, it is not as easy as I thought. The LISTBOX gets created on runtime and is not available right after the DROPDOWN has been created.

    You might want to try this as a workaround:

    C Source Code

    1. #include "DIALOG.h"
    2. /*********************************************************************
    3. *
    4. * Static code
    5. *
    6. **********************************************************************
    7. */
    8. /*********************************************************************
    9. *
    10. * _cbBk
    11. */
    12. static void _cbBk(WM_MESSAGE * pMsg) {
    13. switch (pMsg->MsgId) {
    14. case WM_PAINT:
    15. GUI_DrawGradientH(0, 0, LCD_GetXSize() - 1, LCD_GetYSize() - 1, GUI_BLACK, GUI_LIGHTGRAY);
    16. break;
    17. default:
    18. WM_DefaultProc(pMsg);
    19. break;
    20. }
    21. }
    22. /*********************************************************************
    23. *
    24. * _cbDropDown
    25. */
    26. static int _LBOwnerDraw(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo) {
    27. int r;
    28. //
    29. // Set the trans flag
    30. //
    31. WM_SetHasTrans(pDrawItemInfo->hWin);
    32. //
    33. // Draw the LISTBOX in it default look
    34. //
    35. r = LISTBOX_OwnerDraw(pDrawItemInfo);
    36. //
    37. // Clear the trans flag again to make sure the rest will be drawn properly.
    38. //
    39. WM_ClrHasTrans(pDrawItemInfo->hWin);
    40. return r;
    41. }
    42. /*********************************************************************
    43. *
    44. * _cbDropDown
    45. */
    46. static void _cbDropDown(WM_MESSAGE * pMsg) {
    47. WM_HWIN hListBox;
    48. static int _Once;
    49. switch (pMsg->MsgId) {
    50. default:
    51. //
    52. // Handle anything by the default callback of DROPDOWN widget.
    53. // We are just here to manage the LISTBOX.
    54. //
    55. DROPDOWN_Callback(pMsg);
    56. //
    57. // Check for LISTBOX handle
    58. //
    59. hListBox = DROPDOWN_GetListbox(pMsg->hWin);
    60. if (hListBox) {
    61. //
    62. // Make sure we set the owner draw function only once because the owner
    63. // draw function invalidates the LISTBOX and would cause an endless loop.
    64. //
    65. if (_Once == 0) {
    66. LISTBOX_SetOwnerDraw(hListBox, _LBOwnerDraw);
    67. _Once = 1;
    68. }
    69. } else if (_Once) {
    70. //
    71. // If no LB is present, but the _Once flag is set, restore it to 0.
    72. //
    73. _Once = 0;
    74. }
    75. break;
    76. }
    77. }
    78. /*********************************************************************
    79. *
    80. * Public code
    81. *
    82. **********************************************************************
    83. */
    84. /*********************************************************************
    85. *
    86. * MainTask
    87. */
    88. void MainTask(void) {
    89. WM_HWIN hDropdown;
    90. GUI_Init();
    91. WM_SetCallback(WM_HBKWIN, _cbBk);
    92. hDropdown = DROPDOWN_CreateEx(10, 10, 120, 200, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_DROPDOWN0);
    93. //
    94. // Set a callback function for the DROPDOWN widget.
    95. //
    96. WM_SetCallback(hDropdown, _cbDropDown);
    97. DROPDOWN_SetFont(hDropdown,GUI_FONT_24_1);
    98. DROPDOWN_SetBkColor(hDropdown, DROPDOWN_CI_UNSEL, GUI_RED);
    99. DROPDOWN_SetBkColor(hDropdown, DROPDOWN_CI_SELFOCUS, GUI_LIGHTGRAY);
    100. DROPDOWN_SetTextColor(hDropdown, EDIT_CI_ENABLED, GUI_BLACK);
    101. DROPDOWN_SetTextAlign(hDropdown, GUI_TA_LEFT | GUI_TA_VCENTER);
    102. DROPDOWN_AddString(hDropdown,"A");
    103. DROPDOWN_AddString(hDropdown,"B");
    104. DROPDOWN_AddString(hDropdown,"C");
    105. DROPDOWN_AddString(hDropdown,"D");
    106. DROPDOWN_AddString(hDropdown,"E");
    107. DROPDOWN_AddString(hDropdown,"F");
    108. DROPDOWN_AddString(hDropdown,"G");
    109. DROPDOWN_AddString(hDropdown,"H");
    110. DROPDOWN_SetSel(hDropdown, 0);
    111. while (1) {
    112. GUI_Delay(100);
    113. }
    114. }
    Display All


    Regards
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.