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. Help With Dialog Based App

Help With Dialog Based App

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionc++
6 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.
  • S Offline
    S Offline
    simoncoul
    wrote on last edited by
    #1

    I have made a dialog based MFC app but found a big problem. If someone is entering values into the edit boxes and then hits enter it closes the program. If you hit enter at all while the program is running and in focus it will end the program. How can I fix this? Thanks

    M D 2 Replies Last reply
    0
    • S simoncoul

      I have made a dialog based MFC app but found a big problem. If someone is entering values into the edit boxes and then hits enter it closes the program. If you hit enter at all while the program is running and in focus it will end the program. How can I fix this? Thanks

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      You can override OnOK() (and possibly OnCancel()) and in your overridden method, do nothing. Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      S 1 Reply Last reply
      0
      • M Mark Salsbery

        You can override OnOK() (and possibly OnCancel()) and in your overridden method, do nothing. Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        S Offline
        S Offline
        simoncoul
        wrote on last edited by
        #3

        Hi I cannot find those functions anywhere. I have this

        CDLIADlg dlg;

        m\_pMainWnd = &dlg;
        //Brings up main dialog box
        INT\_PTR nResponse = dlg.DoModal();
        //Ends program
        return FALSE;				
        

        Brings up the main dialog, but I can't find the OnOk or OnCancel in the main dialog

        M 1 Reply Last reply
        0
        • S simoncoul

          Hi I cannot find those functions anywhere. I have this

          CDLIADlg dlg;

          m\_pMainWnd = &dlg;
          //Brings up main dialog box
          INT\_PTR nResponse = dlg.DoModal();
          //Ends program
          return FALSE;				
          

          Brings up the main dialog, but I can't find the OnOk or OnCancel in the main dialog

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          They are virtual functions declared in the CDialog class.  You can add them through the class properties window or add them by hand

          virtual void OnOK();
          virtual void OnCancel();

          ...
          void CDLIADlg::OnOK()
          {
          }

          void CDLIADlg::OnCancel()
          {
          }

          Mark

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          S 1 Reply Last reply
          0
          • M Mark Salsbery

            They are virtual functions declared in the CDialog class.  You can add them through the class properties window or add them by hand

            virtual void OnOK();
            virtual void OnCancel();

            ...
            void CDLIADlg::OnOK()
            {
            }

            void CDLIADlg::OnCancel()
            {
            }

            Mark

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            S Offline
            S Offline
            simoncoul
            wrote on last edited by
            #5

            Thanks so much problem is solved added them by hand much quicker! Thanks again!

            1 Reply Last reply
            0
            • S simoncoul

              I have made a dialog based MFC app but found a big problem. If someone is entering values into the edit boxes and then hits enter it closes the program. If you hit enter at all while the program is running and in focus it will end the program. How can I fix this? Thanks

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

              simoncoul wrote:

              How can I fix this?

              By reading here.


              "A good athlete is the result of a good and worthy opponent." - David Crow

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              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