Capturing Enter Key in Edit Boxs!!

This is a discussion on Capturing Enter Key in Edit Boxs!! within the Windows Programming forums, part of the Platform Specific Boards category; hi, i was wondering if it was possible to capture the return key in a multiline edit box and if ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    35

    Angry Capturing Enter Key in Edit Boxs!!

    hi,
    i was wondering if it was possible to capture the return key in a multiline edit box and if so how .im using win XP and dev c++ 4.And if you could help me apply word wrap to it?

    thx in advance
    Theres a sucker born every minute, but a swallower is harder to find

  2. #2
    hipp
    Guest
    Have you searched the board? I'm sure this question has been posted before.

    -BURK

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    35
    yes i have but they dont help me!
    Theres a sucker born every minute, but a swallower is harder to find

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>yes i have but they dont help me!<<

    Then you didn't try WM_GETDLGCODE as a search string. The information regarding trapping the 'return' key is to be found in different guises in those threads - there's probably others.

  5. #5
    Registered User
    Join Date
    Dec 2002
    Posts
    20
    Use windows SUBCLASSING and intercept the enter or tab key


    tempeditproc =(WNDPROC)SetWindowLong(hwndedit, GWL_WNDPROC, (LONG)editproc);

    then process enter msg in your edit procedure which is assigned
    temporarily to windows edit proc &release the job back to the original proc.

  6. #6
    Registered User
    Join Date
    Jul 2002
    Posts
    35
    thx this might help but how would i go about processing the enter message sorry im not very good at thsi ive never done it . perhaps you have a snippet of code or some example that i could learn
    Theres a sucker born every minute, but a swallower is harder to find

  7. #7
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>perhaps you have a snippet of code or some example that i could learn<<

    From the search link I provided earlier: window subclassing and use of WM_GETDLGCODE - look for Fordy's 'msdn' example. If you intend for special processing with use of the return key then handle the WM_KEYDOWN/WM_KEYUP event in the subclass procedure for the edit control. Handling these messages in a subclass procedure is no different from handling these messages in any other wndproc with the exception that you use CallWindowProc for default msg handling.

    Regarding wordwrap, you can specify your own wordwrap callback, EditWordProc, and set and get it with EM_SETWORDBREAKPROC and EM_GETWORDBREAKPROC. EM_FMTLINES may be of some interest to you also.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enter Key
    By Lord CyKll in forum Linux Programming
    Replies: 3
    Last Post: 03-26-2003, 06:51 AM
  2. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  3. Get Notified of ENTER in single line EDIT control
    By Morpheus in forum Windows Programming
    Replies: 1
    Last Post: 06-29-2002, 07:07 PM
  4. Capturing The Enter Key
    By Sebastiani in forum Windows Programming
    Replies: 18
    Last Post: 11-01-2001, 02:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21