03-07-2011 06:25 AM
I use a progress bar control and set ATTR_USE_PROGESS_BAR_VISUAL_STYLES attribute. It works perfect in Windows XP. The progress bar looks identical to Windows ones. Though now check how it looks in Windows 7. No matter either aero windows style is on or off, the progress bar looks very strange. It does not fill smoothly and fill not the whole control - the edges are left unfilled.
I have attached the screenshot.
Any ideas what do I do wrong?
Solved! Go to Solution.
03-07-2011 10:06 AM
I found out that it looks better if there is no transparent label control over it. Though even in this case it is filled not cjmpletely. Look, it keeps gray background at left, top and bottom parts.
03-08-2011 04:56 PM - edited 03-08-2011 04:57 PM
Progress bars are somewhat limited when you have other controls overlapping them. If you use the "auto" or "marquee" update modes, then you need to process events in the main thread (the thread that created the panel) in order for the progress bar to update correctly. This limitation is documented in in the progress bar control overview and in the Update Mode attribute help. Are you able to process events while the progress bar is advancing?
As far as the non-overlapped case is concerned, I don't really see the problem that you're referring to. Yes, there is an outline around the green portion of the progress bar. The progress bar is a custom control that is based on a numeric slide control, and this control has a frame, like all other CVI controls. Is the existence of this frame what you are objecting to?
03-09-2011 05:31 AM
I use VAL_PROGRESSBAR_MANUAL_MODE and call ProgressBar_Start (for any case).
I call the updating routine manually and call ProgressBar_SetPercentage function.
After calling it I call ProcessSystemEvents and ProcessDrawEvents (for any case).
It does not matter either another control is shown over it ot it's own label is being placed over the progress bar. In both cases it is drawn incorrect.
I noticed that it try to draw progress bar not a Windows 7 style (one filled green bar) but Windows XP (separated green bars) sometime. So perhaps there is a problem with progress bar drawing routine (just a speculation).
I use CVI 2009 without SP1 (and I did not find a note about fixing something similar in SP1).
As for the outline around the green portion of the progress bar. I do not mind, I just wanted to know if I do something wrong.
Thanks for reply.
03-09-2011 11:07 AM
Okay, I do see the problem. There is, in fact, a bug that is preventing incremental updates to the chart from displaying correctly when the progress bar is overlapped (and a control overlapped by its own label is still overlapped, just as if it were overlapped by a different control).
This bug will fixed in an upcoming release. In the meanwhile, there is a workaround you can use: if you hide and re-show the control immediately before setting the percentage, the drawing artifacts should disappear. For example:
SetCtrlAttribute (panelHandle, PANEL_PROGRESSBAR, ATTR_VISIBLE, 0);
SetCtrlAttribute (panelHandle, PANEL_PROGRESSBAR, ATTR_VISIBLE, 1);
ProgressBar_SetPercentage (panelHandle, PANEL_PROGRESSBAR, newPercentage, NULL);
Let me know whether that fixes it for you.