PRB: Cannot Change Tabs In Dynamically Created SysTabControl OCX

ID: Q246044


The information in this article applies to:
  • Microsoft Visual Studio versions 6.0, 97


SYMPTOMS

Unable to change tabs in a Microsoft Tabbed Dialog Control if the control is added dynamically.


CAUSE

The control does not know that it is loaded.


RESOLUTION

Add the following code after the creation of the control:


// Assume pMSTabCtl is a pointer to an instance of a CSSTabCtl object
LPUNKNOWN pUnk = pMSTabCtl->GetControlUnknown();
LPOLECONTROL pCtl;
pUnk->QueryInterface(&pCtl);
pCtl->FreezeEvents(TRUE);
pCtl->FreezeEvents(FALSE);
pCtl->Release(); 


MORE INFORMATION

Steps to Reproduce Behavior

  • Add the Microsoft Tabbed Dialog Control to an MFC application using the Component Gallery. This adds the CSSTabCtl, COleFont, and CPicture classes to the application.


  • Declare a variable that is a pointer to a CSSTabCtl, for example, pMSTabCtl.


  • Dynamically add the control to a window. See the following code for an example of this:


  • 
    pMSTabCtl = new CSSTabCtl;
    ASSERT( pMSTabCtl );
    VERIFY( pMSTabCtl->Create( NULL, <BR/>
                               WS_VISIBLE | WS_CHILD | WS_MAXIMIZEBOX,
                               CRect( 10, 10, 300, 200 ),
                               this, ID_XXXXX, NULL, FALSE, NULL ) ); 
  • Run the application and try selecting different tabs.


  • Additional query words: SSTAB tab OCX ActiveX

    Keywords : kbCOMt kbContainer kbCtrl kbVS97 kbVS600 kbCompGallery kbDSupport kbGrpMFCATL
    Version : WINDOWS:6.0,97
    Platform : WINDOWS
    Issue type : kbprb


    Last Reviewed: December 3, 1999
    © 2000 Microsoft Corporation. All rights reserved. Terms of Use.