The information in this article applies to:
SYMPTOMSWhen an ATL-based ActiveX control has the focus on a Visual Basic form, it does not give the focus to the default button on the form (the button with a Default property of True) when you press ENTER. Steps to Reproduce Behavior
CAUSEThe reason for this behavior is that the default implementation in ATL of the IOleControlImpl::GetControlInfo() and IOleInPlaceActiveObjectImpl::TranslateAccelerator() methods just returns E_NOTIMPL. The container calls GetControlInfo to get the control's keyboard mnemonics and keyboard behavior, and it calls TranslateAccelerator() to process the keys. RESOLUTIONBecause the implementation in ATL of these IOleControlImpl-based methods simply returns E_NOTIMPL, the control writer must override these methods in the control class. STATUSMicrosoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATIONTo override this behavior implement IOleControlImpl::GetControlInfo() and IOleInPlaceActiveObjectImpl::TranslateAccelerator() in your control class as shown below: Sample Code
In the above sample, the TranslateAccelerator code processes only the TAB
and the ENTER keys.
REFERENCES
Visual C++ Help; search on "IOleControl::GetControlInfo" and
"IOleInPlaceActiveObject::TranslateAccelerator" Q179696 PRB: Focus and Tab Issues with ATL Subclassed Edit Control Additional query words: ATL Tabbing SubEdit GetControlInfo TranslateAccelerator IOleControl IOleControlImpl kbATL200 kbATL210 kbCtrl kbVC500 kbDSupport kbdsd kbatl300 kbvc600
Keywords : kbcode kbActiveX kbATL200 kbATL210 kbCOMt kbCtrlCreate kbKeyAccel kbVBp kbVC500 kbVC600 kbATL300 kbGrpMFCATL |
Last Reviewed: November 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |