Hi,
My progress bar is filling strange ..
You can see the progress bar running in the movie (uploaded via YouTube): ProgBar Movie
or check the image (progab_filling_strange.png) below
Display All
In my Paint function of the active Window, I loop over 0 - 100% to set the progress bar as demo.
Any idea why the progress bar is filling to strangly? At 50% it fills OK ..
When I set it on a fixed value, it can draw the progress bar OK. See image (progbar.png)below. what is strange aswell is that instead of drawing per 5 % block it is drawing per 10% (so alwayas adding per 2 green blocks)
My progress bar is filling strange ..
You can see the progress bar running in the movie (uploaded via YouTube): ProgBar Movie
or check the image (progab_filling_strange.png) below
C Source Code
- case WIDGET_ITEM_DRAW_BACKGROUND:
- {
- // Receive the area of the PROGBAR widget
- WM_GetClientRectEx(pDrawItemInfo->hWin, &Rect);
- // Draw a white rounded rect over the whole PROGBAR area, but the drawing will be visible only in the area of the cliprect.
- GUI_SetColor(FIT_COLOR_1_BLACK);
- GUI_FillRoundedRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1, 0);
- // Draw a green rounded rect over the complete area, this gets (partially) overwritten by a white one
- GUI_SetColor(FIT_COLOR_7_GREEN);
- int blocks = PROGBAR_GetValue(hProg) / 10 * 2; // need to show block per 5 %
- int x0, x1 = 0;
- for (int k = 0; k < blocks; k++)
- {
- x0 = x1;
- if (k != 0) { x0 += 3; } // per green block, 3 px in between
- x1 = 8 + x0; // block is 8 px wide
- GUI_FillRoundedRect(x0, Rect.y0, x1, Rect.y1, 0);
- // Set a user cliprect
- UserRect.x0 = x0;
- UserRect.y0 = pDrawItemInfo->y0;
- UserRect.x1 = x1;
- UserRect.y1 = pDrawItemInfo->y1;
- WM_SetUserClipRect(&UserRect);
- //GUI_FillRoundedRect(x0, Rect.y0, x1, Rect.y1, 0);
- GUI_FillRoundedRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1, 0);
- }
- // Very important, restore the the clipping area
- WM_SetUserClipRect(NULL);
- l_return = 0;
- } break;
In my Paint function of the active Window, I loop over 0 - 100% to set the progress bar as demo.
Any idea why the progress bar is filling to strangly? At 50% it fills OK ..
When I set it on a fixed value, it can draw the progress bar OK. See image (progbar.png)below. what is strange aswell is that instead of drawing per 5 % block it is drawing per 10% (so alwayas adding per 2 green blocks)
The post was edited 3 times, last by Pieter Eggermont ().