www.digitalmars.com         C & C++   DMDScript  

c++.idde - onOK()

reply Peter <Peter_member pathlink.com> writes:
Hi all,
I have been progressing well but I;ve come accross a couple of hurdles!
Any help would be appreciated.

1)When developing a dialog box in the IDDE. Can I delete the default
instructions under onOK() ?. Up to now I've been changing the OK button title to
Quit but while running the finished program it quits if I accidently press the
return key.( the default writing below onOK() says "Do not delete this code").

2) I'm having touble trying to add a second dialog window to a dialogbox
program. So far I've managed to add the window with the rc editor but I can't
seem to wire it into the main program!
If someone could give a simple explanation or send me some basic code offlist to
give me a starting point i'd appreciate it

Peter
Dec 27 2002
parent reply Arjan Knepper <ask me.to> writes:
I gues you're doing MFC. Than override the member OnOK in your class:

void YourClassDerivedFromCDialog :: OnOK ()
{
    // your checking code here
    ....
    // Realy OK?
    if ( OK )
       CDialog :: OnOK ();
}


I'm not sure about your second question? What are trying to achive? A 
MainDialog app that has a button and when clicked opens an other dialog 
or what else?

Peter wrote:
 Hi all,
 I have been progressing well but I;ve come accross a couple of hurdles!
 Any help would be appreciated.
 
 1)When developing a dialog box in the IDDE. Can I delete the default
 instructions under onOK() ?. Up to now I've been changing the OK button title
to
 Quit but while running the finished program it quits if I accidently press the
 return key.( the default writing below onOK() says "Do not delete this code").
 
 2) I'm having touble trying to add a second dialog window to a dialogbox
 program. So far I've managed to add the window with the rc editor but I can't
 seem to wire it into the main program!
 If someone could give a simple explanation or send me some basic code offlist
to
 give me a starting point i'd appreciate it
 
 Peter
 
 
Dec 27 2002
parent reply Peter <Peter_member pathlink.com> writes:
Yes, I'm just trying to get an additional window to show up on the screen. Kind
of a basis to get me moving on again. So far I have managed to get an additional
window to show but can only cancel it by exiting the main dialog.

void CMainDialog::OnClickedButton1()
{
// to do: Add your notification handler code here
DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1),0,0,0);
return;

} 
Excuse the poor coding. I've only got this far by fumbling in the dark.
If I can get the basic window functioning properlyI will be in a better position
to experiment further.

Peter
Dec 27 2002
parent reply Arjan Knepper <ask me.to> writes:
I suspect your new window is not set modal, iaw does not get the 
keyboard and mouse focus.

void CMainDialog::OnClickedButton1()
{
    // to do: Add your notification handler code here
    Dialog1  dlg1 ( this -> GetSafeHwnd () );
    dlg.DoModal ();

    return;
}


Peter wrote:
 Yes, I'm just trying to get an additional window to show up on the screen. Kind
 of a basis to get me moving on again. So far I have managed to get an
additional
 window to show but can only cancel it by exiting the main dialog.
 
 void CMainDialog::OnClickedButton1()
 {
 // to do: Add your notification handler code here
 DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1),0,0,0);
 return;
 
 } 
 Excuse the poor coding. I've only got this far by fumbling in the dark.
 If I can get the basic window functioning properlyI will be in a better
position
 to experiment further.
 
 Peter
 
 
 
Dec 27 2002
parent Peter <Peter_member pathlink.com> writes:
Thanks Arjan,

I have a fully working second window now but still need a way to kill it. Will
keep trying. It looks like my problem could be that I need to use EndDialog() to
kill a window created by DialogBoxParam()...

Peter.
Dec 28 2002