Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CDialog

CDialog

Scheduled Pinned Locked Moved C / C++ / MFC
help
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vc _fragrance
    wrote on last edited by
    #1

    Hi, I have created a modal dialogbox and attached a button and named it as Save. Whenever I clicked on it I want to display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box. void CDialogClass1:OnSave() { CDialog2 dlg2; dlg2.DoModal();//I attached a combo box to it. } Please can u help me. Thanks in advance.

    A _ H 3 Replies Last reply
    0
    • V vc _fragrance

      Hi, I have created a modal dialogbox and attached a button and named it as Save. Whenever I clicked on it I want to display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box. void CDialogClass1:OnSave() { CDialog2 dlg2; dlg2.DoModal();//I attached a combo box to it. } Please can u help me. Thanks in advance.

      A Offline
      A Offline
      Anilkumar K V
      wrote on last edited by
      #2

      U can pass parameter from First Dialog to second dialg 1 ) through constructor 2) Via member variable ( CDialog2 dlg2; dlg2.m_Var = m_Var_one dlg2.DoModal();//I attached a combo box to it. 3) Keep a global variable and share value in two dialog

      V 1 Reply Last reply
      0
      • A Anilkumar K V

        U can pass parameter from First Dialog to second dialg 1 ) through constructor 2) Via member variable ( CDialog2 dlg2; dlg2.m_Var = m_Var_one dlg2.DoModal();//I attached a combo box to it. 3) Keep a global variable and share value in two dialog

        V Offline
        V Offline
        vc _fragrance
        wrote on last edited by
        #3

        I am very sorry.I can't understand what u said. I need not want to send data from first dialogbox to the second dialogbox which contains the combobox. I want from the data from second dialog's combobox. Thanks for u r effort.

        _ 1 Reply Last reply
        0
        • V vc _fragrance

          Hi, I have created a modal dialogbox and attached a button and named it as Save. Whenever I clicked on it I want to display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box. void CDialogClass1:OnSave() { CDialog2 dlg2; dlg2.DoModal();//I attached a combo box to it. } Please can u help me. Thanks in advance.

          _ Offline
          _ Offline
          _AnsHUMAN_
          wrote on last edited by
          #4

          vc++_fragrance wrote:

          display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box.

          There are two ways to this in my knowledge: 1) If it's a base/derived relationship you can use GetParent() to get a pointer of the parent class in the derived class and then use it to access the member functions of the parent class and also the member variables depending on their access modifiers. 2) You can create a pointer of the first class(From where you are calling DoModal()) into the second class where you need the contents of the first dialog. For this: a) Include the header file of the first dialog in the second. b) In the public section declare a pointer of the first class. Like: CMyFirstClass *pFirstClass; c) Just above the line dlg2.DoModal() you can write dlg2.pFirstClass=this; d) Now you can access the variables/members/member functions of the first dialog in the second dialog using pFirstClass. Like: pFirstClass->m_strEdit.GetWindowText(...); etc....

          Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

          V 1 Reply Last reply
          0
          • _ _AnsHUMAN_

            vc++_fragrance wrote:

            display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box.

            There are two ways to this in my knowledge: 1) If it's a base/derived relationship you can use GetParent() to get a pointer of the parent class in the derived class and then use it to access the member functions of the parent class and also the member variables depending on their access modifiers. 2) You can create a pointer of the first class(From where you are calling DoModal()) into the second class where you need the contents of the first dialog. For this: a) Include the header file of the first dialog in the second. b) In the public section declare a pointer of the first class. Like: CMyFirstClass *pFirstClass; c) Just above the line dlg2.DoModal() you can write dlg2.pFirstClass=this; d) Now you can access the variables/members/member functions of the first dialog in the second dialog using pFirstClass. Like: pFirstClass->m_strEdit.GetWindowText(...); etc....

            Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

            V Offline
            V Offline
            vc _fragrance
            wrote on last edited by
            #5

            Thank you very much.

            1 Reply Last reply
            0
            • V vc _fragrance

              I am very sorry.I can't understand what u said. I need not want to send data from first dialogbox to the second dialogbox which contains the combobox. I want from the data from second dialog's combobox. Thanks for u r effort.

              _ Offline
              _ Offline
              _AnsHUMAN_
              wrote on last edited by
              #6

              IF you want the data from the second dialog box in the first one: you can do this: if(dlg2.DoModal()==IDOK) { dlg2.m_myCombo.// Some function to retrieve data from combo box } :omg: -- modified at 9:03 Tuesday 26th September, 2006

              Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

              D 1 Reply Last reply
              0
              • _ _AnsHUMAN_

                IF you want the data from the second dialog box in the first one: you can do this: if(dlg2.DoModal()==IDOK) { dlg2.m_myCombo.// Some function to retrieve data from combo box } :omg: -- modified at 9:03 Tuesday 26th September, 2006

                Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                _AnShUmAn_ wrote:

                dlg2.m_myCombo.// Some function to retrieve data from combo box

                Not possible, as the combobox no longer exists.


                "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                "Judge not by the eye but by the heart." - Native American Proverb

                1 Reply Last reply
                0
                • V vc _fragrance

                  Hi, I have created a modal dialogbox and attached a button and named it as Save. Whenever I clicked on it I want to display another dialogbox with a combo box attached to it.Whenever I clicked on OK button I need to get the data in the first Dialog box. void CDialogClass1:OnSave() { CDialog2 dlg2; dlg2.DoModal();//I attached a combo box to it. } Please can u help me. Thanks in advance.

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  if your main class is CMainDlg you can use CMainDlg* m_Main=(CMainDlg*)GetParent(); m_Main->YouCombo();


                  WhiteSky


                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups