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. Overiding OnOK

Overiding OnOK

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 4 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.
  • W Offline
    W Offline
    William Bartholomew
    wrote on last edited by
    #1

    Just a quick question? Why is the value of the member variable linked to an edit box always empty until I call CDialog:OnOK(). I'm guessing it has something to do with DoDataExchange but I haven't quite worked out what. What is the proper way to do this because I was always under the impression that you should call the base class last...

    L I E 3 Replies Last reply
    0
    • W William Bartholomew

      Just a quick question? Why is the value of the member variable linked to an edit box always empty until I call CDialog:OnOK(). I'm guessing it has something to do with DoDataExchange but I haven't quite worked out what. What is the proper way to do this because I was always under the impression that you should call the base class last...

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Whenever u want the data on the dialog box to come into its vairables call UpdateData(TRUE) and whenever u want the data in ur variable to go into the dialogbox call UpdataData(FALSE) I hope this is what u r looking for

      1 Reply Last reply
      0
      • W William Bartholomew

        Just a quick question? Why is the value of the member variable linked to an edit box always empty until I call CDialog:OnOK(). I'm guessing it has something to do with DoDataExchange but I haven't quite worked out what. What is the proper way to do this because I was always under the impression that you should call the base class last...

        I Offline
        I Offline
        Igor Sukhov
        wrote on last edited by
        #3

        Just a quick answer: call UpdateData() and your member variable will be up to date. Best regards, ----------- Igor Soukhov (Brainbench/Tekmetrics ID:50759) igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru

        1 Reply Last reply
        0
        • W William Bartholomew

          Just a quick question? Why is the value of the member variable linked to an edit box always empty until I call CDialog:OnOK(). I'm guessing it has something to do with DoDataExchange but I haven't quite worked out what. What is the proper way to do this because I was always under the impression that you should call the base class last...

          E Offline
          E Offline
          Erik Funkenbusch
          wrote on last edited by
          #4

          There is no rule about calling base class functionality. If you need it to do its work before your work, you call it first. If you need it to do it after, you call it after. If you don't care either way, then do it one or the other, but always be consistent. OnOK() calls UpdateData() during its processing, which you can do at any time you need to (though some say that having to call UpdateData() is a sign of a poorly designed program. I don't always agree, Dialog based apps often need to call it).

          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