SkinFlex Buttons

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

    • SkinFlex Buttons

      I have 4 buttons in a window. I used the following code to set a new color to one button.

      C Source Code

      1. BUTTON_SetSkinFlexProps(&Props, BUTTON_SKINFLEX_PI_ENABLED);

      C Source Code

      1. hB0 = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);

      C Source Code

      1. WM_Invalidate(hB0);


      My problem is that if I touch another button, also the other button is colored with the new colors.
      Why is that? Is there a way to keep the other buttons the same even if they are pressed?
      Thanks
    • SkinFlex Buttons

      Hi,
      As far as I understood, setting skinflex properties for a button is a global property. Even though, we pass the specific button handle to WM_Invalidate(hB0);,
      it will change the global skinning properties of the buttons.

      If you are in same window having different buttons, you can use the BUTTON_SetSkin() function passing the handle of the item and pointer to custom draw function.


      BUTTON_SetSkin(hB0, _ButtonCustomSkin);



      int _ButtonCustomSkin(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo)

      {

      switch (pDrawItemInfo->Cmd)
      {
      case WIDGET_ITEM_DRAW_BACKGROUND:
      switch (WM_GetId(pDrawItemInfo->hWin))
      {
      case ID_BUTTON_B0:
      /* Set button color here using GUI_SetColor() */
      break;
      default:
      BUTTON_DrawSkinFlex(pDrawItemInfo);
      break;
      }
      }

      }


      Hope this helps.


      Thank you,
      Lullaby.
    • Button skinflex

      int _ButtonCustomSkin(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo)

      {
      int Id;

      switch (pDrawItemInfo->Cmd)
      {
      case WIDGET_ITEM_DRAW_BACKGROUND:
      Id = WM_GetId(pDrawItemInfo->hWin);
      switch (Id)
      {
      case ID_BUTTON_B0:
      /* Set button color here using GUI_SetColor() */ break;
      }
      default:
      BUTTON_DrawSkinFlex(pDrawItemInfo);
      break;
      }
      return 0;
      }

      Try this code snippet..