PRB: Validate Event Does Not Fire When Changing Focus with Mouse to ATL Control (230326)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q230326 SYMPTOMS
When you use an Active Template Library (ATL) control created with Visual C++ in Visual Basic and set the CausesValidation property of all controls on the form to TRUE, moving focus with the TAB key triggers Validate events to fire correctly. However, when you move the focus to the ATL control with the mouse, the Validate event does not fire for the control that previously had the focus.
CAUSE
The Validate event is fired by the container instead of the control. To make this event fire correctly, the Visual Basic container must have a chance to check the focus change and fire the event for the appropriate control. If the newly activated control gets UIActivated before Visual Basic checks the change, the program will determine that the control that needs to fire the Validate event is the newly activated control, and it won't fire the event because that control is getting the focus instead of losing it. This problem is caused by the inappropriate interaction between the Visual Basic container and the ATL control.
RESOLUTION
Change the message handling so that the ATL control gets activated at the appropriate time.
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | kbActivexEvents kbprb KB230326 |
---|
|