Microsoft KB Archive/169434

From BetaArchive Wiki


BETA-PRB: Tabbing Broken for ATL Controls in IE 4.0

Last reviewed: June 25, 1997
Article ID: Q169434

     BETA INFORMATION  BETA INFORMATION  BETA INFORMATION  BETA

     This article discusses a Beta release of a Microsoft
     product. The information in this article is provided as-is
     and is subject to change without notice.

     No formal product support is available from Microsoft for
     this Beta product. For information about obtaining support
     for a Beta release, please see the documentation included
     with the Beta product files, or check the Web location
     from which you downloaded the release.

     BETA INFORMATION  BETA INFORMATION  BETA INFORMATION  BETA

The information in this article applies to:

  • Microsoft Active Template Library, version 2.1
  • Microsoft Internet Explorer (Programming), version 4.0

SYMPTOMS

Multiple Active Template Library (ATL) controls embedded in an HTML page may not exhibit proper tabbing behavior in Internet Explorer (IE) 4.0. This behavior can be observed by subclassing a Windows Edit Control with an ATL control and placing multiple copies in a Web page. Tabbing will toggle the focus between the first control and the address line in IE.

CAUSE

In-place active objects must always be given the first chance at translating accelerator keystrokes. To satisfy this requirement, the Internet Explorer calls an ActiveX control's IOleInPlaceActiveObject::TranslateAccelerator method. The default ATL implementation of TranslateAccelerator does not pass the keystroke to the container.

RESOLUTION

In order for the Internet Explorer 4.0 to handle tabbing "correctly" for ATL controls, the control must pass the appropriate accelerator back to the container. Adding the following to an ATL Control will "fix" this behavior:

   STDMETHOD(TranslateAccelerator)(MSG *pMsg)
   {
       CComQIPtr<IOleControlSite,&IID_IOleControlSite>
           spCtrlSite(m_spClientSite);

       if(spCtrlSite)
       {
           return spCtrlSite->TranslateAccelerator(pMsg,0);
       }

       return S_FALSE;
   }

STATUS

This behavior is by design. It is up to the programmer to decide what the appropriate behavior for the control should be in this situation.

REFERENCES

Visual C++ Books Online: IOleInPlaceActiveObject::TranslateAccelerator


Keywords : AtlMisc kbui

Technology : kbAtl kbInetDev
Version : 2.1 4.0
Platform : WINDOWS
Issue type : kbprb


Last reviewed: June 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.