How to prevent window to get focus
-
Hey, please help me. I've got a SDI-App with a non modal dialog. The dialogs only task is to choose parameter (e.g. in a listbox) for my application. After selecting an item in the listbox (on dialog) the focus should move to my a control (choosen by listbox) in my cformview(e.g. CEdit - Control). I handle the OnLvnItemChangedList message in my dialog. In this function I post a message (WM_SETFOCUS) to my (formview) window. But the focus returns immediately back to my dialog. When I set the focus to my mainwnd (by mouseclick) the focus is in the right control. But how can I set the focus to my mainfrm automatically? Thanx for your help
-
Hey, please help me. I've got a SDI-App with a non modal dialog. The dialogs only task is to choose parameter (e.g. in a listbox) for my application. After selecting an item in the listbox (on dialog) the focus should move to my a control (choosen by listbox) in my cformview(e.g. CEdit - Control). I handle the OnLvnItemChangedList message in my dialog. In this function I post a message (WM_SETFOCUS) to my (formview) window. But the focus returns immediately back to my dialog. When I set the focus to my mainwnd (by mouseclick) the focus is in the right control. But how can I set the focus to my mainfrm automatically? Thanx for your help
if u set focus to parent formview, the parent will set focus to its child which has focus before the parent gets focus automatically - so ur dialog gets focus back. in ur function - OnLvnItemChangedList - u should tell formview where to send focus. i.e. post a message to formview with wParam==control's ID, so in formview, u send focus to the control.
-
if u set focus to parent formview, the parent will set focus to its child which has focus before the parent gets focus automatically - so ur dialog gets focus back. in ur function - OnLvnItemChangedList - u should tell formview where to send focus. i.e. post a message to formview with wParam==control's ID, so in formview, u send focus to the control.
I tried your suggestion, but with partial success. When my dialog has the focus before I select an item on the listbox it works fine, but if the focus is on my formview or mainfrm and I select on item, the focus wents to my formview for a second and then switched back to my dialog...