LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Progress Bar doesn't look correct in Windows 7

Solved!
Go to solution

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?

pb_wrong.png

0 Kudos
Message 1 of 6
(4,921 Views)

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.

pb_wrong2.png

0 Kudos
Message 2 of 6
(4,910 Views)

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?

 

Luis

0 Kudos
Message 3 of 6
(4,861 Views)

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.

0 Kudos
Message 4 of 6
(4,844 Views)
Solution
Accepted by topic author ZVS

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.

 

Luis

Message 5 of 6
(4,821 Views)

Yes, Luis, it does fix the problem. Thank you for your help. Smiley Happy

0 Kudos
Message 6 of 6
(4,807 Views)