Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

Should All Dialog Boxes be in the same file?

Have made several dialog boxes in different files and I am trying to connect them together. One dialog box is a menu in which I want to call other dialog boxes. How do I open one dialog box from another?
0
troy24
Asked:
troy24
1 Solution
 
jstolanCommented:
No don't put them in the same file.  This is legal, but it's much harder to keep track of them.

Each dialog box should have an associated .h file.  Simply add that to the list of include files for functions that need to access them.  Here is a snippet that assumes you're using classes derived from CDialog for your code.

In dialog box 2 which calls dialog box 1 do this:

#include <stdafx.h>

// other includes

#include "Dialog2.h"


void CDialog1::CallingFunction()
{
    CDialog2 myDlg2;
    myDlg2.DoModal();
}
0
 
nietodCommented:
>> No don't put them in the same file.  This is legal, but it's much harder to keep track of them
That is just a matter of opinion.  You should organize them however is convenient for your project.  I have a project with 100s of dialogs.  I would not like to have each on in a seperate file.  
0
 
troy24Author Commented:
Thanks for the Help
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now