Solved

Hide Dialog Box Clicking on the command button?

Posted on 2004-08-27
3
209 Views
Last Modified: 2013-11-20
Hi  all
I would like to explain my question.
I insert three dialog box(d1,d2 and d3) and also make their classes for each dialog box(CD1,CD2 and CD3), derived from CDialog.d1 contains two button "Back and Next".On Clicking on the "Next" button, it calls d2(second dialog box).d2 also contains two button "Continue and Cancel".Again I press the "Continue" button, it calls d3(third dialog box).
Now I want to do that when I click on "Continue" button,it calls d3 and dismiss(hide) the both dialog box(d1 and d2)simultaneously.

I wrote code something like that:

void CD1::OnNext()
{
CD2 dlg2;
dlg2.DoModal();
}
............
..............
void CD2::OnContinue()
{
CD3 dlg3;
dlg3.DoModal();
..............................................
...................................

}

Please help me
How to write code on the "Coninue" button so that d1 and d2 will be hide together?.

Please Excuse my bad writting for i have a poor way of writting

Regards
Rajesh
0
Comment
Question by:RAJESH SHARMA
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
SteH earned 20 total points
ID: 11910914
A way to achieve it without too many modifications would be:

void CD2::OnContinue()
{
CD3 dlg3;
ShowWindow (SW_HIDE); // hide d2
CWnd* pWnd = GetParent (); // parent should be d1;
pEWnd->ShowWindow (SW_HIDE); // and hide it.
dlg3.DoModal(); // and now display the third one.
..............................................
...................................

}
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11911093
Have you looked at a property sheet in wizard mode?  I suspect this is what you are trying to code by hand.
0
 
LVL 13

Expert Comment

by:SteH
ID: 11911592
Thx for the points. I wrote it between the lines what AndyAinscow spoke out loud: Consider a different approach like property sheets, a tabbed dialog with sub-dialogs for these tasks.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 66
ODBC Connection Logging, ADO.NET 6 49
fix34  challenge 9 96
Problem to event 3 49
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now