Solved

Multiple Dialog Boxes

Posted on 2001-07-03
1
277 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 300 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

26 Experts available now in Live!

Get 1:1 Help Now