SetFocus API in MFC
-
I have the following piece of code which returns the handle to the window which should receive the focus, CWnd* pWndNewFocus = GetNextTabStopWnd(pWndCurrentFocus->;GetSafeHwnd(), iDirection); For setting the focus to the new window, i've written the following code, pWndNewFocus->SetFocus(); Incidentally the window that is set to receive the focus is a CButton. I have an OK button which is default button and a Cancel button. OK button is dithered. So the pWndNewFocus will be my Cancel button. When SetFocus is getting called on that, i'm not able to see the focus [dotten line around the caption] on the button. Could you let me know the reason for this error? The same code when I execute it from VC++ 6.0, the focus is correctly getting set to the button. But when i execute the code in VC++ 10, i'm getting this issue.
-
I have the following piece of code which returns the handle to the window which should receive the focus, CWnd* pWndNewFocus = GetNextTabStopWnd(pWndCurrentFocus->;GetSafeHwnd(), iDirection); For setting the focus to the new window, i've written the following code, pWndNewFocus->SetFocus(); Incidentally the window that is set to receive the focus is a CButton. I have an OK button which is default button and a Cancel button. OK button is dithered. So the pWndNewFocus will be my Cancel button. When SetFocus is getting called on that, i'm not able to see the focus [dotten line around the caption] on the button. Could you let me know the reason for this error? The same code when I execute it from VC++ 6.0, the focus is correctly getting set to the button. But when i execute the code in VC++ 10, i'm getting this issue.