CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    51

    How to set the focus to a previous control?

    How can I determine what control on a view had focus before it is switched to a button that is clicked? I have buttons that are used to navigate through pictures. When they are clicked and have finished whatever they need to do, I want to set the focus to the control that previously had the focus before the button was clicked. Is this possible? Calling CWnd::Getfocus from the OnButton function return the control of the button. Maybe I could use the KillFocus message to set a CWnd * member of the view to the control that is loosing focus and then set the focus back to that CWnd * as the last step of the OnButton function. Any better ideas?

    Thanks,

    Steve

    Steven M. McNeese
    [email protected]

  2. #2
    Join Date
    May 1999
    Location
    Toronto, Ontario, Canada
    Posts
    155

    Re: How to set the focus to a previous control?

    I think you can handle OnSetFocus (WM_SETFOCUS message) as it gives the CWnd object that loses input focus. This implies that you override (subclass) your buttons in order to handle this message. Hope this helps.


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