PRB: Focus Problem Using MFC Control on MDI Child Form
Article ID: 197503
Article Last Modified on 5/12/2003
APPLIES TO
- Microsoft Visual Basic 5.0 Learning Edition
- Microsoft Visual Basic 6.0 Learning Edition
- Microsoft Visual Basic 5.0 Professional Edition
- Microsoft Visual Basic 6.0 Professional Edition
- Microsoft Visual Basic 5.0 Enterprise Edition
- Microsoft Visual Basic 6.0 Enterprise Edition
This article was previously published under Q197503
SYMPTOMS
You put controls created in Visual C++ using the Microsoft Foundation
Classes (MFC) on a multiple-document interface (MDI) child form.
Additionally, you have some non-MFC controls on the MDI form (parent). You
find that after you click the MFC control on the child form, click one of
the non-MFC controls on the MDI form and then press the tab key, the focus
moves to another control on the child form instead of the MDI form.
This behavior also occurs in similar situations where the project consists
of child and parent forms with MFC controls used on at least one of the
forms.
CAUSE
When you click the MFC control, the control is UIActivated in the
container. However, when you click another non-MFC control on another form,
the container does not UIDeactivate the MFC control automatically.
RESOLUTION
To resolve the problem, UIDeactivate the control when it loses the focus.
STATUS
This behavior is by design.
REFERENCES
For other problems related to using the MFC controls in MDI forms, please
see the following articles in the Microsoft Knowledge Base:
192347
PRB: Focus/Activation Problems with MFC Control on VB Forms
197504
PRB: KeyPress Problem When Using MFC Control on MDI Child
Form
Keywords: kbctrlcreate kbprb KB197503