Easy Dialog Pop up question

This is a discussion on Easy Dialog Pop up question within the Windows Programming forums, part of the Platform Specific Boards category; Please help me with this. An SDI Application based off of a database in Microsoft Access. In order to collect ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    31

    Exclamation Easy Dialog Pop up question

    Please help me with this.

    An SDI Application based off of a database in Microsoft Access. In order to collect information, and make the application user friendly, I've added buttons to optional information that pops up a new window. Problem is, I can't figure it out. I have added a class for each pop-up and it has its own header file. What's my next step in order to assign the dialog to the button? In some books it tells me to add a line like this:
    Code:
     #include "Dialog*.h"
    Is this correct or am I to do something else. I am a beginner programmer, and can't figure this out. Thanks for your help.
    Last edited by Prog.Patterson; 04-16-2002 at 11:29 AM.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    77
    if im not wrong
    you will have to add the header file of the dialog and at then button coding .


    dialog* n_dlg;
    n_dlg.DoModel();


    this shoud be able to do it

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    31
    Could you explain how to use that? I know that in the Program.cpp file at the top I add
    Code:
    #include "dialog1.h"
    . Now, for Button #1 I add this
    Code:
    //To do: Add extra Initialization Here
    dialog* n_dlg;
    n_dlg.DoModel();
    . How does that work? Is the "*" supposed to be replaced with my dialog name, IDD_DIALOG1, IDD_DIALOG2, etc, so it should look like this?
    Code:
    //To Do: Add Extra Initialization Code Here
    dialogIDD_DIALOG1 n_dlg;
    n_dlg.DoModel();
    I'm a little confused. THanks for the help though.
    Last edited by Prog.Patterson; 04-17-2002 at 12:27 PM.
    "Some succeed because they are destined to, others succeed because they are determined to."
    ~Anonymous

    "A shorn scrotum is quite breathtaking, I suggest you try it."
    ~Dr. Evil

    EMT/Firefighter
    Eagle Scout

  4. #4
    Registered User
    Join Date
    Feb 2002
    Posts
    591
    If you are using MFC this is a way to do it.

    If the name of your dialog that you want to open is Dialog1 you add this (as you said) in the top of the program.cpp

    #include "Dialog1.h"

    You then add a member variable OR pointer to that Dialog in your CView class..like this

    Member variable "CDialog1 m_dDialog1;"
    Pointer "CDialog1 *pDialog1;"

    Now all you have to do is to call the method DoModal to open the dialog.

    m_dDialog1.DoModal();
    or
    pDialog1->DoModal();

    If you want to do something when the user close the dialog you can do this
    Code:
    if(m_dDialog1.DoModal() == IDOK)
    {
        DoSomething();
    }
    Last edited by Barjor; 04-17-2002 at 02:45 PM.

  5. #5
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    You don't need to declare your dialog as a pointer unless you're using the modeless function to call the dialog.

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    31
    Thank you for all of your help. So far, I think that it works. I can't run my application because it doesn't "create an empty document", or atleast that's the error that comes up. If you could help, go over to my other post called .Database Access Problem. Thanks for all your help
    "Some succeed because they are destined to, others succeed because they are determined to."
    ~Anonymous

    "A shorn scrotum is quite breathtaking, I suggest you try it."
    ~Dr. Evil

    EMT/Firefighter
    Eagle Scout

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. This is hopefully an extremely easy question...
    By rachaelvictoria in forum C Programming
    Replies: 2
    Last Post: 11-07-2005, 01:36 AM
  2. 4 easy question
    By Zeratulsdomain in forum C++ Programming
    Replies: 2
    Last Post: 10-15-2005, 11:43 PM
  3. Lame question on dialog controls appearance
    By Templario in forum Windows Programming
    Replies: 2
    Last Post: 03-18-2003, 08:22 PM
  4. Easy question, (should be) easy answer... ;-)
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-12-2002, 10:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21