dialog box function problem
Hello people. I have the following very easy problem:
After pressing a button a dialog box appears. I want this dialog box to automatically do a StepIt() (CprogressCtrl) and then to be released when the user presses the Ok button.
Is there a function that is called after the dialog box is created so I can perform my task?
Thank you in advanced!
Re: dialog box function problem
Not sure what you are looking for here. Is the progress control located in the dialog? What happens when the user presses okay? Does the dialog go away or does the progress control get incremented?
Arjay
Re: dialog box function problem
Suppose a dialog box.When you press button "foo" a new dialog appears.
This new dialog has a progress control and an OK button.
I want this new dialog to automatically do something (stepit()) to the progress control and wait until ok is pressed.
(foo button is pressed)
newwindow bar;
bar.DoModal(); -> i want here the new dialog to automatically StepIt() (the progress control) and wait until the ok button is pressed!
Thanks!
Re: dialog box function problem
Quote:
Originally Posted by tasoss
Suppose a dialog box.When you press button "foo" a new dialog appears.
This new dialog has a progress control and an OK button.
I want this new dialog to automatically do something (stepit()) to the progress control and wait until ok is pressed.
(foo button is pressed)
newwindow bar;
bar.DoModal(); -> i want here the new dialog to automatically StepIt() (the progress control) and wait until the ok button is pressed!
Thanks!
This still doesn't make sense. Step it how many times? I believe the upper limit is 64K, which would occur before the user could get their mouse anywhere near the okay button. Please, tell us exactly what you want to do. Holding back information doesn't help you, and it wastes everybody else's time.
Re: dialog box function problem
Maybe my english are very bad...
I'm trying to learn the progress control.I may have a for loop and stepit 10 times.Why does it matter?
I don't want to waste your time really but i made it as simple as it could be.
When the new dialog box appears it has a progress control and an OK button.
You could implement a button like "test progress" which would call stepit so i can see how progress control works!!!!
Instead of that i want this action to be performed automatically after
newwindow bar;
bar.DoModal();
that.
Really,sorry for bothering i hope someone will understand my question it's so simple really.
ps:i'm searching,maybe, for a function ,like OnInitDialog(), which is called after the dialog is created and the controls are placed in the dialog!
Re: dialog box function problem
My point was that in a tight loop, the steps would go by so quickly you couldn't possibly do what you're asking. If you just want to play and learn, your best bet would be to set up a button, that when pressed, calls StepIt() once, so you can watch it.
Re: dialog box function problem
OnInitDialog is the right place to step the control before the dialog is displayed.
Code:
BOOL newwindow::OnInitDialog()
{
CDialog::OnInitDialog();
m_ProgressCtrl.StepIt();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
I agree with GCDEF that you will learn more about the progress control using buttons.
Re: dialog box function problem
OnInitDialog is the right place to step the control before the dialog is displayed.
Ok suppose you want to step it AFTER the dialog is displayed(using a ::Sleep) so you can see what is going on?
(or suppose, you generally want to do something AFTER the dialog is displayed)
Thanks again!!!
Re: dialog box function problem
Quote:
Originally Posted by tasoss
OnInitDialog is the right place to step the control before the dialog is displayed.
Ok suppose you want to step it AFTER the dialog is displayed(using a ::Sleep) so you can see what is going on?
(or suppose, you generally want to do something AFTER the dialog is displayed)
Thanks again!!!
You're not listening.
Re: dialog box function problem
Quote:
Originally Posted by tasoss
Ok suppose you want to step it AFTER the dialog is displayed(using a ::Sleep) so you can see what is going on?
(or suppose, you generally want to do something AFTER the dialog is displayed)
Here is where a button in your newwindow class will help. Add the button and handle the BN_CLICK message to step the control. If you really want it to step the control without toucking it, look at the OnTimer function.
Re: dialog box function problem