Please help on refreshing dialog after error 
Author Message
 Please help on refreshing dialog after error

What i am trying to do is the following:
I have a dialog where the user can input the data file. When this is not
valid, he gets an output message through the message box like so:

if (!datafile.is_open())
{
MessageBox("The file was not opened.\n Please retry", "Error message",
MB_OK | MB_ICONINFORMATION);

Quote:
}

Now, i want after i click OK on that message box, to get the original
dialog again to give me a chance to input another file. What happens
now, is that after i click OK on the message box, the program just
continues skipping the dialog.

How can i correct this?

Thanks,
Elias



Sun, 17 Aug 2003 11:30:11 GMT  
 Please help on refreshing dialog after error
What i am trying to do is the following:
I have a dialog where the user can input the data file. When this is not
valid, he gets an output message through the message box like so:

if (!datafile.is_open())
{
MessageBox("The file was not opened.\n Please retry", "Error message",
MB_OK | MB_ICONINFORMATION);

Quote:
}

Now, i want after i click OK on that message box, to get the original
dialog again to give me a chance to input another file. What happens
now, is that after i click OK on the message box, the program just
continues skipping the dialog.

How can i correct this?

Thanks,
Elias



Sun, 17 Aug 2003 11:31:38 GMT  
 Please help on refreshing dialog after error

Quote:

> What i am trying to do is the following:
> I have a dialog where the user can input the data file. When this is not
> valid, he gets an output message through the message box like so:

> if (!datafile.is_open())
> {
> MessageBox("The file was not opened.\n Please retry", "Error message",
> MB_OK | MB_ICONINFORMATION);
> }

> Now, i want after i click OK on that message box, to get the original
> dialog again to give me a chance to input another file. What happens
> now, is that after i click OK on the message box, the program just
> continues skipping the dialog.

> How can i correct this?

> Thanks,
> Elias

Why does it skip the dialog?  Are you calling the dialog's OnOK or OnCancel?  Do
you close the dialog before displaying the message box?  You are not explaining
what is happening so it is difficult to help you stop it from happening.  

I could suggest that you try executing a return when the user clicks OK on the
message box, but you are not revealing any code context so it is only a wild
guess.

--
Scott McPhillips [VC++ MVP]



Sun, 17 Aug 2003 11:46:04 GMT  
 Please help on refreshing dialog after error
OK, i hope this will be more clear:
I call my mainprogram function (where the data file is tested for existence and
other calculations are performed), from the OnOK() function

void CDialog1Dlg::OnOK()
{
 mainprogram();  //Calls the function mainprogram When this process ends, the
estimator finishes.

 CDialog::OnOK();

 MessageBox("The Estimator has finished.", "Simulation Finished", MB_OK |
MB_ICONINFORMATION);

Quote:
}

The check for the data file is in the main program as shown below:
 if (!datafile.is_open())
 {
 MessageBox("The file was not opened.\n Please retry", "Error message",
 MB_OK | MB_ICONINFORMATION);
 }

So, i guess one solution would be to take it above before mainprogram is even called
but i prefer to have it in the main program since that is the place from where i
read the data from the file.

Do you have any suggestions on that? Can you show me some code as well so that i
will be sure i don't{*filter*}up?

Thanks,
Elias

Quote:


> > What i am trying to do is the following:
> > I have a dialog where the user can input the data file. When this is not
> > valid, he gets an output message through the message box like so:

> > if (!datafile.is_open())
> > {
> > MessageBox("The file was not opened.\n Please retry", "Error message",
> > MB_OK | MB_ICONINFORMATION);
> > }

> > Now, i want after i click OK on that message box, to get the original
> > dialog again to give me a chance to input another file. What happens
> > now, is that after i click OK on the message box, the program just
> > continues skipping the dialog.

> > How can i correct this?

> > Thanks,
> > Elias

> Why does it skip the dialog?  Are you calling the dialog's OnOK or OnCancel?  Do
> you close the dialog before displaying the message box?  You are not explaining
> what is happening so it is difficult to help you stop it from happening.

> I could suggest that you try executing a return when the user clicks OK on the
> message box, but you are not revealing any code context so it is only a wild
> guess.

> --
> Scott McPhillips [VC++ MVP]



Sun, 17 Aug 2003 13:40:00 GMT  
 Please help on refreshing dialog after error
Have your mainprogram() return true/false based on whether the file was
valid/opened. Call CDialog::OnOK() only if the mainprogram() returns true.

HTH,
Ganesh


Quote:
> OK, i hope this will be more clear:
> I call my mainprogram function (where the data file is tested for
existence and
> other calculations are performed), from the OnOK() function

> void CDialog1Dlg::OnOK()
> {
>  mainprogram();  //Calls the function mainprogram When this process ends,
the
> estimator finishes.

>  CDialog::OnOK();

>  MessageBox("The Estimator has finished.", "Simulation Finished", MB_OK |
> MB_ICONINFORMATION);
> }

> The check for the data file is in the main program as shown below:
>  if (!datafile.is_open())
>  {
>  MessageBox("The file was not opened.\n Please retry", "Error message",
>  MB_OK | MB_ICONINFORMATION);
>  }

> So, i guess one solution would be to take it above before mainprogram is
even called
> but i prefer to have it in the main program since that is the place from
where i
> read the data from the file.

> Do you have any suggestions on that? Can you show me some code as well so
that i
> will be sure i don't{*filter*}up?

> Thanks,
> Elias



> > > What i am trying to do is the following:
> > > I have a dialog where the user can input the data file. When this is
not
> > > valid, he gets an output message through the message box like so:

> > > if (!datafile.is_open())
> > > {
> > > MessageBox("The file was not opened.\n Please retry", "Error message",
> > > MB_OK | MB_ICONINFORMATION);
> > > }

> > > Now, i want after i click OK on that message box, to get the original
> > > dialog again to give me a chance to input another file. What happens
> > > now, is that after i click OK on the message box, the program just
> > > continues skipping the dialog.

> > > How can i correct this?

> > > Thanks,
> > > Elias

> > Why does it skip the dialog?  Are you calling the dialog's OnOK or
OnCancel?  Do
> > you close the dialog before displaying the message box?  You are not
explaining
> > what is happening so it is difficult to help you stop it from happening.

> > I could suggest that you try executing a return when the user clicks OK
on the
> > message box, but you are not revealing any code context so it is only a
wild
> > guess.

> > --
> > Scott McPhillips [VC++ MVP]



Mon, 18 Aug 2003 01:24:33 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Please help on refreshing dialog after error

2. Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!

3. Parameters.Refresh fails - ATL- Please help!!!!

4. Please help!!!!Please help!!!!Please help!!!!

5. Refresh one Dialog after pressing OK in an other dialog

6. help please error c2059 token error.

7. Help on my C code, dont understand how to fix my compiler errors (PLEASE HELP)

8. Please help me help myself: Dialog basics

9. Please help on how to show a help window on clicking a dialog button

10. Stop Refresh, Add Controls, Continue Refreshing WinForm.

11. Refresh Dialog box???

12. Refreshing dialog

 

 
Powered by phpBB® Forum Software