PRB: Focus on the Tab Control Changes to an Inactive Tab

ID: Q178469


The information in this article applies to:


SYMPTOMS

With the Microsoft Tabbed Dialog (tabctl32.ocx), focus may shift to a control on an inactive tab.


CAUSE

This problem may occur with the tabbed dialog when one of the tabs has a container control, such as a frame or picture control.


RESOLUTION

To work around this problem, disable the controls on inactive tabs so that they will not be in the tab order. You can disable the controls in the Click event of the tab control. For example:


   Private Sub SSTab1_Click(PreviousTab As Integer)
      Dim c As Control
      For Each c In Controls
         If (c.Container Is SSTab1) Then
            c.Enabled = (c.Left >= 0)
         End If
      Next
   End Sub 

NOTE: When a control contained in an SSTab control is on an inactive tab, the Left property of the control is negative.


STATUS

Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


MORE INFORMATION

Steps to Reproduce Behavior

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


  2. Add a reference to the Microsoft Tabbed Dialog Control 5.0 by completing the following steps:

    1. From the Project menu, click Components.


    2. From the Controls list, check Microsoft Tabbed Dialog Control 5.0.


    3. Click OK to close the Components dialog box.




  3. Add a Tab control to Form1 and set the Tabs property of the Tab control to 2.


  4. On the first tab of the Tab control, add a text box. On the second Tab, add a frame control. In the frame control, add a text box.


  5. Copy the following code to the Code window of the Form1 form:
    
          Option Explicit
    
          Private Sub Text1_GotFocus()
             Debug.Print "Text1 GotFocus"
          End Sub
    
          Private Sub Text2_GotFocus()
             Debug.Print "Text2 GotFocus"
          End Sub
     


  6. Select "Tab 0" to make it the active tab.


  7. On the Run menu, click Start or press the F5 key to start the program. Set the focus to the text box of the first tab. Press the TAB key to change the focus. Examine the messages in the Immediate pane. Note that the focus moves to the text box in the second tab, which is not displayed and therefore inactive.


Additional query words: tabctl32.ocx tab dialog tabstrip tab strip sstab Sheridan kbVBp500
kbVBp600 kbVBp kbdsd kbDSupport kbControl


Keywords          : 
Version           : 
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: June 3, 1999