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. Validating control content when loosing focus

Validating control content when loosing focus

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

    Actually I have been programming for quit som years, but everytime I have to validate a control when I leave it I do some trial and error exploring. I like to know if somebody can tell me, whats the right strategi for doing this. Jørgen Granborg Jørgen Granbborg

    D R 2 Replies Last reply
    0
    • J JGranborg

      Actually I have been programming for quit som years, but everytime I have to validate a control when I leave it I do some trial and error exploring. I like to know if somebody can tell me, whats the right strategi for doing this. Jørgen Granborg Jørgen Granbborg

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

      How about the WM_KILLFOCUS message?


      "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

      J 1 Reply Last reply
      0
      • D David Crow

        How about the WM_KILLFOCUS message?


        "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

        J Offline
        J Offline
        JGranborg
        wrote on last edited by
        #3

        Right so long so good, but how do I know where the focus vil go. If the user close the dialog or exit or switch to some other program, then I dont want to validate.

        D 1 Reply Last reply
        0
        • J JGranborg

          Right so long so good, but how do I know where the focus vil go. If the user close the dialog or exit or switch to some other program, then I dont want to validate.

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

          If the user dismisses the dialog, or switches to some other window, you don't need to validate any of the controls. The OK button should not be enabled until each control contains valid data.


          "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

          1 Reply Last reply
          0
          • J JGranborg

            Actually I have been programming for quit som years, but everytime I have to validate a control when I leave it I do some trial and error exploring. I like to know if somebody can tell me, whats the right strategi for doing this. Jørgen Granborg Jørgen Granbborg

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

            JGranborg wrote: Validating control content when loosing focus Be careful :) If two fields depend on each other, you can get into an infinite loop where the user can't leave the field they're editing. I've experienced this before and it's very frustrating :mad:

            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"

            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