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. new dialog on button click

new dialog on button click

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
5 Posts 3 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.
  • A Offline
    A Offline
    aafcls
    wrote on last edited by
    #1

    Hello, If someone can simply break down the steps, as I think I'm missing something... My application is a dialog box, with a few buttons. On the button click, I want to launch a new dialog box which I have created in Resources. I have also added classes for it, so it has a cpp and h file. Now, how do I simply link the button to the dialog box, such that it will simply launch? Thank you. ;)

    C H 2 Replies Last reply
    0
    • A aafcls

      Hello, If someone can simply break down the steps, as I think I'm missing something... My application is a dialog box, with a few buttons. On the button click, I want to launch a new dialog box which I have created in Resources. I have also added classes for it, so it has a cpp and h file. Now, how do I simply link the button to the dialog box, such that it will simply launch? Thank you. ;)

      C Offline
      C Offline
      cje
      wrote on last edited by
      #2

      if you are using the MFC class wizard you can double click on the button in the resource editor and it will add a handler for you (you are looking to get an ON_BN_CLICKED handler) Inside the handler declare and instance of the new dialog and away you go

      A 1 Reply Last reply
      0
      • C cje

        if you are using the MFC class wizard you can double click on the button in the resource editor and it will add a handler for you (you are looking to get an ON_BN_CLICKED handler) Inside the handler declare and instance of the new dialog and away you go

        A Offline
        A Offline
        aafcls
        wrote on last edited by
        #3

        just to clarify, is this assuming I have created a class for the new dialog as well? and then you are saying to double click on the button in the old dialog and declare an instance of the new dialog? I think I am creating too many classes, so please just clarify for me where and for what I am creating the classes, thanks!

        C 1 Reply Last reply
        0
        • A aafcls

          just to clarify, is this assuming I have created a class for the new dialog as well? and then you are saying to double click on the button in the old dialog and declare an instance of the new dialog? I think I am creating too many classes, so please just clarify for me where and for what I am creating the classes, thanks!

          C Offline
          C Offline
          cje
          wrote on last edited by
          #4

          BEGIN_MESSAGE_MAP(CMyMainDlg, CDialog) ON_BN_CLICKED(IDC_BROWSE_PATH, OnBnClickedBrowsePath) END_MESSAGE_MAP() void CMyMainDlg::OnBnClickedBrowsePath() { CAnotherDialog dlg; dlg.DoModal(); } CMyMainDlg is the dialog for my main application...CAnotherDialog is the new dialog that I want to bring up on the button click. hope this helps cje

          1 Reply Last reply
          0
          • A aafcls

            Hello, If someone can simply break down the steps, as I think I'm missing something... My application is a dialog box, with a few buttons. On the button click, I want to launch a new dialog box which I have created in Resources. I have also added classes for it, so it has a cpp and h file. Now, how do I simply link the button to the dialog box, such that it will simply launch? Thank you. ;)

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

            Hope I understood your question if you want to run another dialog use m_yourdialog.DoModal() or m_yourdialog.Create_**


            **_

            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