PROGBAR doesn't change colors

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

    • PROGBAR doesn't change colors

      I use emWin provided by ST (STemWin based on emWin 5.40)

      I tried to change PROGBAR colors but nothing happens.

      I downloaded emWin tutorial (both executables and source code). Also the WIDGET_Progbar sample doesn't change the colors:

      [img]https://s18.postimg.org/y20p2twa1/WIDGET_Progbar-_Sample.png[/img]

      In the source code there is:

      C Source Code

      1. while(1) {
      2. PROGBAR_SetFont(ahProgBar[0], &GUI_Font8x16);
      3. if (LCD_GetDevCap(LCD_DEVCAP_BITSPERPIXEL) <= 4) {
      4. PROGBAR_SetBarColor(ahProgBar[0], 0, GUI_DARKGRAY);
      5. PROGBAR_SetBarColor(ahProgBar[0], 1, GUI_LIGHTGRAY);
      6. } else {
      7. PROGBAR_SetBarColor(ahProgBar[0], 0, GUI_GREEN);
      8. PROGBAR_SetBarColor(ahProgBar[0], 1, GUI_RED);
      9. }
      10. PROGBAR_SetTextAlign(ahProgBar[0], GUI_TA_HCENTER);
      11. PROGBAR_SetText(ahProgBar[0], NULL);
      Display All


      So is it possible to change the colors of the PROGBAR? how?

      best regards
      Max
    • Hi,

      For some widgets it is not possible to change the color with functions like <WIDGET>_SetColor() because they use a skinning routine to draw themself (e.g. the PROGBAR widget).

      To change the colors to be used you can set the properties (like the colors) for the widget with the function <WIDGET>_SetSkinFlexProps() (or in this case PROGBAR_SetSkinFlexProps()).

      Best way is to read the properties and write them back. This allows you to change only one property and leave the other unchanged.

      Another way to change the look of the widgets is to overwrite their callback function or set a skinning/owner-draw function (if available).
      This will give you more control over the look of the widgets.

      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.
    • SEGGER - Schoenen wrote:

      Another way to change the look of the widgets is to overwrite their callback function or set a skinning/owner-draw function (if available).
      I have trobubles setting those settings. I do not manage to edit a progress bar with a SKIN.
      MEaning changing the text color of the progress percentage. In fact I want to remove that text by doing PROGBAR_SetText(hProg, NULL); but this has no effect.

      Any help in this?