button color change

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

    • button color change

      Hi
      I am using GUI builder tool of emwin V5.48 free tool only.
      But I can't able to change button color using this tool.
      But this tool created a library in which I can able to see the
      library function for my need as i mentioned below.

      BUTTON_SetBkColor(hItem_color_new_try,0,0x00FF00); //to set background color as green
      BUTTON_SetFrameColor(hItem_color_new_try,0x00FF00); //to set frame color as green
      BUTTON_SetFocusColor(hItem_color_new_try,0x00FF00); //to set focus color as green
      BUTTON_SetFont(hItem_color_new_try, GUI_FONT_32B_ASCII); //to set font size as 32B ASCII
      BUTTON_SetText(hItem_color_new_try, "check 3"); //to set text
      BUTTON_SetTextColor(hItem_color_new_try,0,0x00); //to set text color as green

      But the button color is not changed
      Please help me i solving this

      Thanks
      R Sridhar
    • Hello,

      you have to enter valid GUI_COLORs. You can use the predefined colors (GUI_WHITE, GUI_GREEN, etc...) or make your own colors using the GUI_MAKE_COLOR() macro.

      The colors are entered into this macro in the format ABGR. The alpha value is stored in the highest 16 bits. 00 is opaque, FF is transparent.

      For example, opaque blue looks like this: GUI_MAKE_COLOR(0x00FF0000). I'd suggest you to also read the "Colors" chapter in the manual to learn more about emWin's color format.

      Best regards,

      Florian
    • Hi floriann

      Thanks for your answer
      I have done as per your suggestion,but still not getting colors on button
      BUTTON_SetBkColor(hItem_color_new_try,0,GUI_MAKE_COLOR(GUI_BLUE));
      BUTTON_SetFrameColor(hItem_color_new_try,GUI_MAKE_COLOR(GUI_GREEN));
      BUTTON_SetFocusColor(hItem_color_new_try,GUI_MAKE_COLOR(GUI_LIGHTGREEN));
      BUTTON_SetFont(hItem_color_new_try, GUI_FONT_32B_ASCII);
      BUTTON_SetText(hItem_color_new_try, "check 3");
      BUTTON_SetTextColor(hItem_color_new_try,0,GUI_MAKE_COLOR(GUI_ORANGE));
      Thanks
      R Sridhar
    • Hello,

      the routines BUTTON_SetBkColor() and BUTTON_SetFocusColor() only work in conjunction with the classic skin. The classic skin can be enabled by calling BUTTON_SetSkinClassic().

      To change the color properties of a button that uses the default skin, skinning props should be used. With skinning props, the user enters the desired properties of a widget (e.g. the focus and background color of a button) into a static array. These properties can then be applied with BUTTON_SetSkinFlexProps().

      I've attached a sample that demonstrates this. You can find more details about skinning in the user manual.

      Best regards,

      Florian
      Files