Keeping focus on an edit control ...

This is a discussion on Keeping focus on an edit control ... within the Windows Programming forums, part of the Platform Specific Boards category; I have a window (not a dialog) that contains 3 edit controls, during the WM_CREATE I call a SetFocus on ...

  1. #1
    Unregistered
    Guest

    Keeping focus on an edit control ...

    I have a window (not a dialog) that contains 3 edit controls, during the WM_CREATE I call a SetFocus on the first edit of the group.
    The problem is, everytime I minimize the main window, or it get's hidden behind another window, the focus disappears from the edit control.
    I've tried just about everything I can think of in the window proc to try and combat this and have finally given up trying to solve it on my own and have come here seeking help.

    It's just a simple application, no MFC or classes.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    At a guess handle WM_ACTIVATE and call SetFocus from there.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Unregistered
    Guest
    Half solved the problem!

    WM_ACTIVATE handled if the window was covered by another one, but still won't handle if its minimized, I had assumed this was covered in WM_SIZE, but that doesn't seem to be working, I'll have to experiment some more, thanks for the help tho.

  4. #4
    Unregistered
    Guest
    Solved it, just created an HWND variable to store which window had the focus using GetFocus, and called SetFocus on the window during WM_ACTIVATE.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Controlling edit control input
    By Gerread in forum Windows Programming
    Replies: 6
    Last Post: 05-03-2007, 08:56 PM
  2. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 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. Controlling an edit control
    By master5001 in forum Windows Programming
    Replies: 2
    Last Post: 10-16-2001, 03:08 PM
  5. Rich edit control example Win API
    By Echidna in forum Windows Programming
    Replies: 1
    Last Post: 09-17-2001, 02:12 AM

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