Progress bar is not showing on status bar 
Author Message
 Progress bar is not showing on status bar

I cannot get my progress bar to show on the status bar. The
only way I found around it to show is to use
MyPBar.SetWindowPos(...). Doing it this way, though,
mispositions the progress bar on different computers. How
do I lock it to my status bar? Here's what I have:

In MainFrm.cpp:
    CRect rect;
    m_wndStatusBar.GetItemRect(2, &rect);
    m_ProgBar.Create(WS_VISIBLE | WS_CHILD | PBS_SMOOTH,
                     rect, this, ID_INDICATOR_PBAR);
    m_ProgBar.SetRange(0,100);//Set the range to between 0
and 100
    m_ProgBar.SetStep(1);//Set the step amount
    //the line below is brute force, can't find out how to
display ProgBar
    m_ProgBar.SetWindowPos(NULL,782,714,105,16,NULL);

In CView.cpp (or elsewhere):
.
.
.  
CMainFrame* pFrame =
(CMainFrame*)AfxGetApp()->m_pMainWnd;//pointer to mainframe
object
.
.
.
pFrame->m_ProgBar.StepIt();//never shows on status bar

Any suggestions? Thx



Sat, 19 Feb 2005 20:23:39 GMT  
 Progress bar is not showing on status bar

Quote:

> I cannot get my progress bar to show on the status bar. The
> only way I found around it to show is to use
> MyPBar.SetWindowPos(...). Doing it this way, though,
> mispositions the progress bar on different computers. How
> do I lock it to my status bar? Here's what I have:

> In MainFrm.cpp:
>     CRect rect;
>     m_wndStatusBar.GetItemRect(2, &rect);
>     m_ProgBar.Create(WS_VISIBLE | WS_CHILD | PBS_SMOOTH,
>                      rect, this, ID_INDICATOR_PBAR);
>     m_ProgBar.SetRange(0,100);//Set the range to between 0
> and 100
>     m_ProgBar.SetStep(1);//Set the step amount
>     //the line below is brute force, can't find out how to
> display ProgBar
>     m_ProgBar.SetWindowPos(NULL,782,714,105,16,NULL);

CMainframe manages the position of the status bar whenever the window is
resized, but it doesn't know about your progress bar.  To keep it where
it belongs use m_ProgBar.GetItemRect and m_ProgBar.SetWindowPos in the
mainframe WM_SIZE handler.  

P.S. You will need to do this inside a if (m_ProgBar.GetSafeHwnd())
block to avoid assertions caused by nuisance WM_SIZE messages that
arrive before the child windows have been created.

--
Scott McPhillips [VC++ MVP]



Sun, 20 Feb 2005 01:57:35 GMT  
 Progress bar is not showing on status bar
See my essay (link is on my MVP Tips site) on putting a progress bar on the status bar.
                        joe

Quote:

>I cannot get my progress bar to show on the status bar. The
>only way I found around it to show is to use
>MyPBar.SetWindowPos(...). Doing it this way, though,
>mispositions the progress bar on different computers. How
>do I lock it to my status bar? Here's what I have:

>In MainFrm.cpp:
>    CRect rect;
>    m_wndStatusBar.GetItemRect(2, &rect);
>    m_ProgBar.Create(WS_VISIBLE | WS_CHILD | PBS_SMOOTH,
>                     rect, this, ID_INDICATOR_PBAR);
>    m_ProgBar.SetRange(0,100);//Set the range to between 0
>and 100
>    m_ProgBar.SetStep(1);//Set the step amount
>    //the line below is brute force, can't find out how to
>display ProgBar
>    m_ProgBar.SetWindowPos(NULL,782,714,105,16,NULL);

>In CView.cpp (or elsewhere):
>.
>.
>.  
>CMainFrame* pFrame =
>(CMainFrame*)AfxGetApp()->m_pMainWnd;//pointer to mainframe
>object
>.
>.
>.
>pFrame->m_ProgBar.StepIt();//never shows on status bar

>Any suggestions? Thx

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Sun, 20 Feb 2005 04:08:37 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Progress bar not showing visual progress

2. progress bar on a status bar

3. progress bar on a status bar

4. Progress Bar in Status Bar Pane

5. Progress bar in status bar

6. progress bar in the status bar.

7. Progress Bar In A Status Bar

8. How to put a Progress Bar into the Status Bar

9. Adding a progress bar control to the status bar

10. progress bar in status bar

11. Showing file loading/saving progress in progress bar?

12. status bar hidden under START bar (quick-launch bar)

 

 
Powered by phpBB® Forum Software