GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 28-Aug-2008, 07:32
ANJANEYA_PRASAD ANJANEYA_PRASAD is offline
New Member
 
Join Date: Aug 2008
Posts: 1
ANJANEYA_PRASAD is on a distinguished road

Need a help on Multiple Dialog Application...


Hi All ,

This is Anjaneya Prasad. I am very new to Visual C++ 6.0.

I am trying to develop an application which may have two Modal dialogs.
One DoModalling the other.

I tried to overwrite the virtual function OnOK and OnCancel in the second Dialog.

Unfortunately the second Dialog is not yet all closing, and no event is occuring in the second dialog(Even the mouse event events also) .

Do i need to do more than i did?

If i wish to DoModal the Third Dialog from the Second Dialog, how can i do that?

Can any one help me in this regard?

Here i am attaching my code.

Thanks and Regards,
Attached Files
File Type: zip SputnikInterface01.zip (43.4 KB, 5 views)
  #2  
Old 28-Aug-2008, 11:38
TurboPT's Avatar
TurboPT TurboPT is offline
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 995
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Need a help on Multiple Dialog Application...


You are close, but the concept is a little off...

Within the SputnikInterface01Dlg.cpp file is this event handler when the configure button is clicked:
CPP / C++ / C Code:
void CSputnikInterface01Dlg::OnConfigure() 
{
	// TODO: Add your control notification handler code here
      CDialog configDlg(IDD_DIALOG4);

	INT_PTR nRet = -1;
	nRet = configDlg.DoModal();
}
The problem is that a (thought to be) 'configure' dialog is being created from a resource (the IDD_DIALOG4) using the CDialog class. Which is all well and good for having a basic object of CDialog, BUT this is NOT creating an instance of the configureDlg class, which means that none of the 'configure' functions are being called, and so, nothing happens with the button clicks.

Your custom configure class already inherits from CDialog, as shown by the class declaration: [in configureDlg.h]
CPP / C++ / C Code:
class CconfigureDlg : public CDialog  // <-- note the CDialog
So that function above merely needs modifying to use your configureDlg class as so:
CPP / C++ / C Code:
void CSputnikInterface01Dlg::OnConfigure() 
{
	// TODO: Add your control notification handler code here
       CconfigureDlg configDlg;  // use the CconfigureDlg class

	INT_PTR nRet = -1;
	nRet = configDlg.DoModal();
}
Also, note that:
1. The header file for the CconfigureDlg class needs to be added to the SputnikInterface01Dlg.cpp file.
2. In file configureDlg.cpp, keep the CDialog::OnOK() and CDialog::OnCancel() functions enabled, as these are needed for the inherited CDialog class.
3. If the OnClickedCancel(), and OnClickedOk() are extra's (assuming these were created trying to debug the problem) they can probably be eliminated.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
 
 

Recent GIDBlogUS Elections and the ?Voter?s Responsibility? by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Multiple Dialog Frames in a single MFC Application manmfc MS Visual C++ / MFC Forum 7 05-Mar-2008 23:26
Traversing multiple dialog boxes Chronocide MS Visual C++ / MFC Forum 0 05-Sep-2006 00:27
dialog based application hezyse MS Visual C++ / MFC Forum 1 20-Mar-2005 19:16
Help! Some basal questions about MFC xutingnjupt MS Visual C++ / MFC Forum 1 05-Dec-2004 04:38
controling dialog objects & multiple source files omills MS Visual C++ / MFC Forum 0 15-Jul-2004 00:30

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 23:09.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.