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. EN_CHANGE?

EN_CHANGE?

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 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.
  • R Offline
    R Offline
    Rickard Andersson20
    wrote on last edited by
    #1

    I have to edit controls on a dialog. They are going to handle hours (the first edit control) and minutes (next edit control). My question is that I want to catch EVERYTHING that is done in that edit box! eg: If I write 24 and max value is 24 a message box will appear and tell the user that 23 is maximum value for that edit box, and I want it to appear while the user is trying to type isn some text in the edit box. Exactly with other too! HEELP!! ------------------------------ CodeCracker - That's me! :) ------------------------------

    J R 2 Replies Last reply
    0
    • R Rickard Andersson20

      I have to edit controls on a dialog. They are going to handle hours (the first edit control) and minutes (next edit control). My question is that I want to catch EVERYTHING that is done in that edit box! eg: If I write 24 and max value is 24 a message box will appear and tell the user that 23 is maximum value for that edit box, and I want it to appear while the user is trying to type isn some text in the edit box. Exactly with other too! HEELP!! ------------------------------ CodeCracker - That's me! :) ------------------------------

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      Well, EN_CHANGE is definitely the way to go. Several months ago I posted a message about a request similar to yours: check it out. It contains some code for an CEdit-derived control that performs in-place checking of the user input. Easy task to adapt it to your needs. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      1 Reply Last reply
      0
      • R Rickard Andersson20

        I have to edit controls on a dialog. They are going to handle hours (the first edit control) and minutes (next edit control). My question is that I want to catch EVERYTHING that is done in that edit box! eg: If I write 24 and max value is 24 a message box will appear and tell the user that 23 is maximum value for that edit box, and I want it to appear while the user is trying to type isn some text in the edit box. Exactly with other too! HEELP!! ------------------------------ CodeCracker - That's me! :) ------------------------------

        R Offline
        R Offline
        Rassman
        wrote on last edited by
        #3

        OnChange for the control allows you to check per key. It means though that you have to grab the text of the box, check it, then indicate the error to the user. For a box that with a maximum of two characters its fast enough, though it can be equally argued that for a box with two characters checking OnExit or when the return key is pressed is just the same. If your text could be long the OnChange check may be most desirable since the user may need to know before going too far ahead. In this case the first possible method is wastefull, that is, collecting all text and checking it all every time H He Hel Hell Hello Hello W etc For a 256 character line, there is a lot of waste. So, it is better to remember where you have already checked and where the cursor currently is. If you look at CEdit you will find possitional data available to you which you can use for this within the ::OnChange() We do it for the joy of seeing the users struggle.

        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