Swipelist transparency

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

    • Swipelist transparency

      Can the SWIPELIST widget support a transparent background?

      I have tried:
      (1) SWIPELIST_SetBkColor(hItem, SWIPELIST_CI_BK_ITEM_UNSEL, GUI_MAKE_COLOR(GUI_TRANSPARENT));
      (2) WM_SetHasTrans(hItem);
      (3) a custom owner draw function

      emWin 5.38

      The post was edited 1 time, last by Matt S ().

    • Hi,

      this can be done for all widgets, just make sure to set the WM_CF_HASTRANS create flag via WM_SetHasTrans() or upon creation and set a transparent background color.

      Best regards,

      Florian
      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.
    • It seems the only thing that is working for me is upgrading to emWin 5.50g (was 5.38a) and also using an owner draw function like this:

      C Source Code

      1. /* Owner draw function for SWIPELIST style */
      2. int _SwipelistOwnerDraw(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo)
      3. {
      4. switch (pDrawItemInfo->Cmd)
      5. {
      6. case WIDGET_ITEM_DRAW_BACKGROUND:
      7. // Transparent background - do nothing
      8. break;
      9. default:
      10. return SWIPELIST_OwnerDraw(pDrawItemInfo);
      11. }
      12. return 0;
      13. }
      Display All
      Note I am using the NXP compiled library so perhaps there is a difference from the standard/full emWin version.

      Thanks,
      Matt
    • Hi,

      I wasn't aware about the version you are using, I used the latest version (V6.10f) to test this. But I'm happy to hear that it's working for you now.

      By the way, the precompiled libraries from vendors like NXP use the same source code as standard emWin.

      Best regards,

      Florian
      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.
    • On topic with original thread... Can we use WIDGET_ITEM_DRAW_OVERLAY in a custom owner draw function with the SWIPELIST widget? I have used it successfully on a LISTWHEEL, but it does not seem to work on the SWIPELIST.
    • Hi,

      the command WIDGET_ITEM_DRAW_OVERLAY only gets sent to LISTWHEEL widgets. As stated in the manual, only the following commands get sent to an OwnerDraw routine of a SWIPELIST:

      • WIDGET_ITEM_DRAW_BACKGROUND
      • WIDGET_ITEM_DRAW_TEXT
      • WIDGET_ITEM_DRAW_BITMAP
      • WIDGET_ITEM_DRAW_SEP

      This is because the SWIPELIST widget does not have that specific overlay unlike the LISTWHEEL. If you want to draw something like an overlay, it makes more sense to use an overwritten callback to draw freely instead of using an OwnerDraw routine.

      Best regards,

      Florian
      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.