Help: Updating a Progress Bar 
Author Message
 Help: Updating a Progress Bar

I am doing a MFC based executable, and I placed a progress bar using the
standard control drop in to place it into the dialog box that I am using
in the project I have created.

I want to increment the progress bar, but the descriptions in the Help
Index and everything else that I have seen are really way out there.  I
couldn't pull anything worthwhile from them.

Could someone give me a really simple example using a standard progress
bar?

I'd really appreciate it! :)

Thanks,
John

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Tue, 15 Apr 2003 21:59:21 GMT  
 Help: Updating a Progress Bar
//
CProgressCtrl *pMyBar = (CProgressCtrl *)GetDlgItem( IDC_YOURBAR);
pMyBar->SetRange(0 , 100);   // min 0 max 100
pMyBar->SetPos( 50 );   //half way
pMyBar->SetPos( 75 );   / 3/4 of the way ...
//

you just have to place it where you want ....
The other way is
in your 'h'(header) file
CProgressCtlr m_ctrlMyBar;

//in the cpp file , by the do dataexchange
DDX_Control(pDX, IDC_YOURBAR, m_ctrlMyBar);

// You can then change the values(position) , when you want and call
UpdateData( FALSE ); // to see them on the screen

Florent

Quote:

> I am doing a MFC based executable, and I placed a progress bar using
the
> standard control drop in to place it into the dialog box that I am
using
> in the project I have created.

> I want to increment the progress bar, but the descriptions in the Help
> Index and everything else that I have seen are really way out there.
I
> couldn't pull anything worthwhile from them.

> Could someone give me a really simple example using a standard
progress
> bar?

> I'd really appreciate it! :)

> Thanks,
> John

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Tue, 15 Apr 2003 22:12:38 GMT  
 Help: Updating a Progress Bar

Quote:

>I am doing a MFC based executable, and I placed a progress bar using the
>standard control drop in to place it into the dialog box that I am using
>in the project I have created.

>I want to increment the progress bar, but the descriptions in the Help
>Index and everything else that I have seen are really way out there.  I
>couldn't pull anything worthwhile from them.

>Could someone give me a really simple example using a standard progress
>bar?

Bring up Class Wizard (Ctrl-W) and select the dialog box class then
the member variables tab.  In the control list select the control ID
for the progress bar.  Press the Add Variable button and select the
Control type and give the variable a name, say m_MyProgressBar.  In
the OnInitDialog() member function for the dialog class set the range
for the progress control to display, so for 0 to 100 (percent based
operation) use: m_MyProgressBar.SetRange(0, 100).  Now, in the
function that needs to update the progress bar calculate the progress
to a number between the range limits set for the control in
OnInitDialog() then set the position of the control to the calculated
number: m_MyProgressBar.SetPos(newPosition).

Regards,
David.

--
Spam safe e-mail address (I hope), remove not. both
times it appears to contact me.  I reserve the right
to respond only on a newsgroup if I choose.



Thu, 17 Apr 2003 05:04:39 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help: Update the Progress Bar

2. How to update a Progress bar from different class

3. update progress bar in a popup dialog

4. update progress bar

5. Updating modal progress bar

6. Progress bar not showing visual progress

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

8. progress bar on a status bar

9. progress bar on a status bar

10. Progress bar is not showing on status bar

11. Progress Bar in Status Bar Pane

12. Progress bar in status bar

 

 
Powered by phpBB® Forum Software