Microsoft KB Archive/154885

= PRB: Tabbing Problem When Sheridan SSTab Control Hosts OCXs =

Article ID: 154885

Article Last Modified on 3/14/2005

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q154885



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.



RESOLUTION
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. Three tabs are displayed by default. If the SSTab control does not appear in the toolbox, perform the following:
 * 3) * VB4: 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.
 * 4) * VB5 and VB6: From the Project menu, choose Components and check the "Microsoft Tabbed Dialog Control" component. If the component is not listed, click the browse button, and locate TABCTL32.OCX.
 * 5) Add a MaskEdBox control to Tab1 of SSTab1. If the MaskEdBox control does not appear in the toolbox, perform the following:
 * 6) * VB4: 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.
 * 7) * VB5 and VB6: From the Project menu, choose Components and check the "Microsoft Masked Edit Control" component. If the component is not listed, click the browse button and locate MSMASK32.OCX.
 * 8) Choose Start from the Run menu, or press the F5 key to start.
 * 9) Select Tab 2.
 * 10) 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:  Choose End from the Run menu, or click the Stop button on the toolbar to stop the program.  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  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.

