CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: CEditbox

  1. #1
    Join Date
    May 2002
    Posts
    38

    CEditbox

    Hi, How do I determine when the user has finished entering text in an edit box. In other words, how do I know he has pressed the enter key and has completed typing in the text.

  2. #2
    Join Date
    Oct 2000
    Location
    India
    Posts
    489
    Hi,

    You cannot trap enter from an edit box in the parent, you need to
    derive a new class from CEdit and process the WM_CHAR mesgs

  3. #3
    Join Date
    May 2002
    Location
    Poland
    Posts
    48
    You can also handle the WM_KILLFOCUS message.
    regards,
    MiMec

  4. #4
    Join Date
    Nov 2001
    Location
    Beyond Juslibol
    Posts
    1,688
    If the edit control is in a dialog you can use classwizard to process the EN_CHANGE or the EN_UPDATE message of the edit control.

    Then you can access the data of the Edit control and check if the last character is '\n'

  5. #5
    Join Date
    May 2002
    Location
    Poland
    Posts
    48
    If this is a single line edit box, it cannot have a '\n' at the end.
    regards,
    MiMec

  6. #6
    Join Date
    May 2002
    Posts
    38
    Thank you, but i cannot access the onKillFoucs event just by pressing the Enter key, i tryed the onKeyDown for the dialog but i had no result.
    What do you think might be the solution?

    thank you for your time

  7. #7
    Join Date
    May 2002
    Location
    Poland
    Posts
    48
    When you press ENTER in a dialog, it activates the default button, so if you have an OK button the dialog will be closed. KillFocus is sent when the user deactivates the control (by pressing TAB or clicking somewhere in the dialog) - this way the window is not closed.
    regards,
    MiMec

  8. #8
    Join Date
    May 2002
    Posts
    38
    Thanks but i still wonder how to work with the onKeyDown event!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured