?
Solved

Multiple Dialog Boxes

Posted on 2001-07-03
1
Medium Priority
?
293 Views
Last Modified: 2013-11-20
I would like to create an application in which the user initially encounters a dialog box to input information.  Upon selecting a "Next Screen" button on the interface, I would like the user to be directed to another dialog box that also allows user input.

I'm currently reading a book, however, that states for dialog based projects....

"There is only one dialog box window and all the available controls ususally are initially visible.  There are no hidden dialog boxes or menu items, and the user can usually see exactly which operations should be carried out."

Does anyone know a way in which a button on a particular dialog box can be used to call another dialog box?  Some sample code would be REALLY helpful. Thanks so much!!!
0
Comment
Question by:cneaton
1 Comment
 
LVL 49

Accepted Solution

by:
DanRollins earned 600 total points
ID: 6249888
In the Dialog editor, create a dialog box named Main.  In it put a button named "Advanced."  Also create another dlg box named Advanced Settings (make its ID IDD_Advanced).  Double-click the title baar of each dialog box and let the ClassWizard create code for both dialogs.  Let's say they are named CDlgMain and CDlgAdvanced.

Now, back in the Main dialg, double-click the button named advanced.  The Class Wizard will generate code for a handler, named, probably CDlgMain::OnAdvanced() and will put your cursor there.

Now add code like this:

void CDlgMain::OnAdvanced()
{
   CDlgAdvanced dlg;
   dlg.m_sTextVar= "some initial value";
   int nRet= dlg.DoModal();
   if (nRet == IDOK ) {
       // save the modified values to a file or something
   }
}

-==-=-=-=-=-=-=-=-=-
as to the quote:
>> "There is only one dialog box window and all the available ...should be carried out."

I've read it several times and it does not make any sense.  You can have a dialog that has a button that opens another dialog that has a button that opens another dialog... as deeply as you want to go (however, a good UI will rarely go more than teo levels deep).

-==-=-=-=-=-=-=-=-=-
On re-reading your question, it begins to sound as if you want to create what is called a "Wizard" -- A series of dialog boxes in which the user clicks [Next] and [Previous].  Is that what you want?  If so, use the CPropertyPage class.

-- Dan

P.S.  This sounds a lot like another clueless question that I fielded recently.  Is this homework?

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month15 days, 9 hours left to enroll

850 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