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. How to verify the data when the focus leaves [modified]

How to verify the data when the focus leaves [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
designhelptutorialquestion
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.
  • W Offline
    W Offline
    willbin
    wrote on last edited by
    #1

    I am making a custom control that can recieve some datas and verify the datas recieved. The custom control(suppose it is named CDataVerify) is inherited from Cwnd and it contains three CEdit controls.The design is when the focus leaves the CDataVerify, it(CDataVerify) should verify the values of thethree CEdit control. Now the problem comes, when the focus leaves the CDataVerify control,how can the CDataVerify control know the focus lose and should verify the datas? (At first I think the onKillFocus() event maybe resolve the problem. But it can not, for the CDataVerify control never got the focus. When typing something to the contained CEdit control, the focus just belongs to the CEdit control, not the CDataVerify.) Is there any way to let the CDataVerify control verify datas when the focus leaves? ////////////////////////////// -- modified at 21:27 Thursday 25th May, 2006

    D 1 Reply Last reply
    0
    • W willbin

      I am making a custom control that can recieve some datas and verify the datas recieved. The custom control(suppose it is named CDataVerify) is inherited from Cwnd and it contains three CEdit controls.The design is when the focus leaves the CDataVerify, it(CDataVerify) should verify the values of thethree CEdit control. Now the problem comes, when the focus leaves the CDataVerify control,how can the CDataVerify control know the focus lose and should verify the datas? (At first I think the onKillFocus() event maybe resolve the problem. But it can not, for the CDataVerify control never got the focus. When typing something to the contained CEdit control, the focus just belongs to the CEdit control, not the CDataVerify.) Is there any way to let the CDataVerify control verify datas when the focus leaves? ////////////////////////////// -- modified at 21:27 Thursday 25th May, 2006

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

      willbin wrote:

      (At first I think the onKillFocus() event maybe resolve the problem. But it can not, for the CDataVerify control never got the focus.

      But did the edit controls themselves receive the WM_KILLFOCUS message?


      "The largest fire starts but with the smallest spark." - David Crow

      W 1 Reply Last reply
      0
      • D David Crow

        willbin wrote:

        (At first I think the onKillFocus() event maybe resolve the problem. But it can not, for the CDataVerify control never got the focus.

        But did the edit controls themselves receive the WM_KILLFOCUS message?


        "The largest fire starts but with the smallest spark." - David Crow

        W Offline
        W Offline
        willbin
        wrote on last edited by
        #3

        Thank you. of course, yes. The edit controls recieve the WM_KILLFOCUS message. But the edit control recieved the WM_KILLFOCUS message only can deal with the data itself held. It do not know the value of its siblings. The Parent knows, but the parent has't the focus(Can not recieve the WM_KILLFOCUS message when the focus leaves.) ////////////////////////////// A stranger , also a challenger

        R D 2 Replies Last reply
        0
        • W willbin

          Thank you. of course, yes. The edit controls recieve the WM_KILLFOCUS message. But the edit control recieved the WM_KILLFOCUS message only can deal with the data itself held. It do not know the value of its siblings. The Parent knows, but the parent has't the focus(Can not recieve the WM_KILLFOCUS message when the focus leaves.) ////////////////////////////// A stranger , also a challenger

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          So can you handle WM_KILLFOCUS for the edit controls, and get them to send a message to their parent which triggers the data verification?

          Ryan

          "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

          W 1 Reply Last reply
          0
          • R Ryan Binns

            So can you handle WM_KILLFOCUS for the edit controls, and get them to send a message to their parent which triggers the data verification?

            Ryan

            "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

            W Offline
            W Offline
            willbin
            wrote on last edited by
            #5

            Thank you.Notify the parent(CDataVerify) to do data verification in spite of wether or not the focus will be still setted to his parent. Maybe not good enough, but it really resolves problem. Thank Ryan. ////////////////////////////// A stranger, also a challenger

            1 Reply Last reply
            0
            • W willbin

              Thank you. of course, yes. The edit controls recieve the WM_KILLFOCUS message. But the edit control recieved the WM_KILLFOCUS message only can deal with the data itself held. It do not know the value of its siblings. The Parent knows, but the parent has't the focus(Can not recieve the WM_KILLFOCUS message when the focus leaves.) ////////////////////////////// A stranger , also a challenger

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

              willbin wrote:

              But the edit control...do not know the value of its siblings.

              Nor should it. Each control should take care of itself.


              "The largest fire starts but with the smallest spark." - David Crow

              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