PRB: Tabbing Problem When Sheridan SSTab Control Hosts OCXs

Last reviewed: July 14, 1997
Article ID: Q154885
The information in this article applies to:
  • Standard, Professional, and Enterprise Editions of Microsoft Visual Basic, 16-bit and 32-bit, for Windows, version 4.0

SYMPTOMS

If the SSTab control is used to host OCXs, then the OCX controls remain in the tab order regardless of whether their host tab is the current tab. When the user tabs to these controls, it appears that no control has the focus. This behavior does not occur with intrinsic controls.

WORKAROUND

Disable the TabStop property of all controls hosted by the SSTab control that do not appear on the current tab. See the More Information Section below for steps to work around the problem.

MORE INFORMATION

The SSTab control maps hosted controls off the left edge of the form, when they are not on the current tab, and maps them back onto the form when necessary. You can use this behavior to help determine whether a control is able to obtain the focus. If the control's Left property is negative, then the control should not be able to get the focus.

Steps to Reproduce and Work Around Problem

  1. Start a project in Visual Basic. Form1 is created by default.

  2. Add a SSTab control to Form1. If the SSTab control does not appear in the toolbox, perform the following:

        - From the Tools menu, choose Custom Controls and check the "Sheridan
          Tabbed Dialog Control" component. If the component is not listed,
          click the browse button and locate TABCTL16.OCX or TABCTL32.OCX.
    

  3. Add a MaskEdBox control to Tab1 of SSTab1. If the MaskEdBox control does not appear in the toolbox, perform the following:

        - From the Tools menu, choose Custom Controls and check the "Microsoft
          Masked Edit control" component. If the component is not listed, click
          the browse button and locate MSMASK16.OCX or MSMASK32.OCX.
    

  4. Choose Start from the Run menu, or press the F5 key to start.

  5. Press the TAB key to tab onto the hidden MaskedEdBox control and note that the focus rectangle disappears. Now, enter some characters and click on Tab1. You will see that the MaskEdBox control contains the characters you typed.

To work around the problem, follow these steps:

  1. Choose End from the Run menu, or click the Stop button on the toolbar to stop the program.

  2. Add the following code to the General Declarations section of Form1:

       Private Sub Form_Load()
         SSTab1_Click 0
       End Sub
    
       Private Sub SSTab1_Click(PreviousTab As Integer)
         Dim c As Control
         For Each c In Controls
           If TypeOf c.Container Is SSTab Then
             'Not all controls have the TabStop property
             On Error Resume Next
             c.TabStop = c.Left > 0
             On Error GoTo 0
           End If
         Next
       End Sub
    
    

  3. Choose Start from the Run menu, or press the F5 key to start.

All the controls that are not displayed in the SSTab controls current tab will now have their TabStop property set to FALSE, making them unable to receive the focus using the Tab key.

Note that the above workaround assumes that the controls are children of the SSTab control and not the children of container controls contained by the SSTab (such as PictureBoxes).

STATUS

This behavior is by design.

REFERENCES

For more information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q150417
   TITLE     : PRB: Read-Only SSTab Does Not Display Child Controls
               Properly
 

	
	


Keywords : PrgCtrls vb4all vb4win
Version : 4.00
Platform : NT WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

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