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
      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 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
    • Hi,

      you have to use the GUI_MAKE_COLOR to make colors from hex values (like GUI_MAKE_COLOR(0x00FF0000)). The predefined color macros don't need the GUI_MAKE_COLOR macro, so just enter e.g. GUI_BLUE as parameter.

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