PRB: Can't Set Focus to an Edit Control When its Parent Is an Inactive Captioned Child Window (230587)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET (2003)
- Microsoft Visual C++ .NET (2002)
This article was previously published under Q230587 SYMPTOMS When an edit control is in an inactive captioned child
window, you cannot set focus to it with the mouse. For example, if you have a
modeless dialog box with the WS_CAPTION and WS_CHILD styles, and it has an edit
control, you cannot set focus to the edit control with the mouse.
NOTE: All captioned child windows display an inactive caption bar.
CAUSE The default WM_LBUTTONDOWN handler for edit controls will
not set focus to the edit control if its parent is an inactive captioned child
window. This code is implemented as part of the Windows API function,
DefWindowProc(). RESOLUTION There are not many good ways to work around this limitation
because it is Windows itself that is intentionally causing this
behavior.
The best way to prevent the problem is to prevent the
parent of the edit control from being an inactive captioned child. For the
above example, specify the WS_POPUP style for the dialog box instead of
WS_CHILD. STATUS This behavior is by design.
Modification Type: | Major | Last Reviewed: | 9/22/2003 |
---|
Keywords: | kbCtrl kbDlg kbEditCtrl kbprb KB230587 |
---|
|