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. Querry regarding DoModal

Querry regarding DoModal

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
11 Posts 7 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
    Vikram
    wrote on last edited by
    #1

    hi I am my app i am showing a form to a user using using the doModal method. int nRet = myFrm.DoModal(); And OnOk event of this form i am validating all the fields. But the problem is , if the user presses the escape key on this dialog, the form gets closed and in nRet i get value as IDOK , without validating any feilds of the form. Why is it happening so.. and how to avoid it. Vikram Verma

    C D 2 Replies Last reply
    0
    • V Vikram

      hi I am my app i am showing a form to a user using using the doModal method. int nRet = myFrm.DoModal(); And OnOk event of this form i am validating all the fields. But the problem is , if the user presses the escape key on this dialog, the form gets closed and in nRet i get value as IDOK , without validating any feilds of the form. Why is it happening so.. and how to avoid it. Vikram Verma

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      See the FAQ[^]

      vikram Verma wrote:

      if the user presses the escape key on this dialog, the form gets closed and in nRet i get value as IDOK

      How did you check that the return value was IDOK ? It should be IDCANCEL as far as I know.


      Cédric Moonen Software developer
      Charting control [v1.1]

      V 1 Reply Last reply
      0
      • C Cedric Moonen

        See the FAQ[^]

        vikram Verma wrote:

        if the user presses the escape key on this dialog, the form gets closed and in nRet i get value as IDOK

        How did you check that the return value was IDOK ? It should be IDCANCEL as far as I know.


        Cédric Moonen Software developer
        Charting control [v1.1]

        V Offline
        V Offline
        Vikram
        wrote on last edited by
        #3

        yes it was IDCANCEL. I rechecked . And thanks .. I should have gone for FAQ 1st... i am C# programmer stuck due to some work in MFC.

        1 Reply Last reply
        0
        • V Vikram

          hi I am my app i am showing a form to a user using using the doModal method. int nRet = myFrm.DoModal(); And OnOk event of this form i am validating all the fields. But the problem is , if the user presses the escape key on this dialog, the form gets closed and in nRet i get value as IDOK , without validating any feilds of the form. Why is it happening so.. and how to avoid it. Vikram Verma

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

          vikram Verma wrote:

          And OnOk event of this form i am validating all the fields.

          Why have an enabled OK button if fields/controls have invalid contents? That's a bit misleading, in my opinion.


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

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

          N 1 Reply Last reply
          0
          • D David Crow

            vikram Verma wrote:

            And OnOk event of this form i am validating all the fields.

            Why have an enabled OK button if fields/controls have invalid contents? That's a bit misleading, in my opinion.


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

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

            N Offline
            N Offline
            Newbie00
            wrote on last edited by
            #5

            [Message Deleted]

            D T T 3 Replies Last reply
            0
            • N Newbie00

              [Message Deleted]

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

              Newbie00 wrote:

              How do you know that he has enabled ok button if the fields are filled in improperly??

              Because he is validating the controls in response to the OK button being clicked. That means the OK button is enabled.


              "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
              • N Newbie00

                [Message Deleted]

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #7

                David didn't say so... he said that the UI was badly designed if the user were allowed to validate (press ok button) invalid datas... there should be an On-Fly data validity checking to enable/disable Ok button


                [VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]

                1 Reply Last reply
                0
                • N Newbie00

                  [Message Deleted]

                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #8

                  Newbie00 wrote:

                  [Message Deleted]

                  message deletion is crime here!

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                  cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

                  H N 2 Replies Last reply
                  0
                  • T ThatsAlok

                    Newbie00 wrote:

                    [Message Deleted]

                    message deletion is crime here!

                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                    cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

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

                    ThatsAlok wrote:

                    message deletion is crime here!

                    :-D


                    WhiteSky


                    1 Reply Last reply
                    0
                    • T ThatsAlok

                      Newbie00 wrote:

                      [Message Deleted]

                      message deletion is crime here!

                      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                      cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

                      N Offline
                      N Offline
                      Newbie00
                      wrote on last edited by
                      #10

                      I've deleted the message because it wasn't worth seeing. I didn't understand David's reply properly ("validating" --> now I know what it really means :]), and I wrote rubbishy post.

                      ThatsAlok wrote:

                      message deletion is crime here!

                      Shall I burn on the balefire....

                      T 1 Reply Last reply
                      0
                      • N Newbie00

                        I've deleted the message because it wasn't worth seeing. I didn't understand David's reply properly ("validating" --> now I know what it really means :]), and I wrote rubbishy post.

                        ThatsAlok wrote:

                        message deletion is crime here!

                        Shall I burn on the balefire....

                        T Offline
                        T Offline
                        ThatsAlok
                        wrote on last edited by
                        #11

                        Newbie00 wrote:

                        hall I burn on the balefire....

                        he he he

                        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                        cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

                        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