Microsoft KB Archive/193021

= BUG: SSTab Focus Given to a Control on a Non-Visible Tab =

Article ID: 193021

Article Last Modified on 3/3/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

-



This article was previously published under Q193021



SYMPTOMS
Pressing an ARROW key when a control contained on a SSTab has the focus may cause focus to be transferred to a control on a Tab that is not visible. The behavior also occurs if the control on a Tab that is not visible has an access key (ex. Command2.Caption = "&Command2"). The control's Click event can be accessed by pressing the ALT+C key combination, even though the control is on a tab that is not visible.



RESOLUTION
To work around this bug behavior, set the focus to the Tab with the control in the Lost Focus event of the last control in the Tab. If you created the sample project, add the following code to the Form1 code window: Private Sub Command1_LostFocus SSTab1.Tab = 1 SSTab1.SetFocus End Sub



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



Steps to Reproduce Behavior
 Start a new Standard EXE project in Visual Basic. Form1 is created by default. Add a reference to the Microsoft Tabbed Dialog Control 5.0/6.0 by clicking Components from the Project Menu and checking "Microsoft Tabbed Dialog Control 5.0/6.0." Add a Tabbed Dialog Control (SSTab1) to Form1. There will be three tabs: Tab0, Tab1, and Tab2. Add a CommandButton to each tab on the SSTab1.  On the second tab, Tab 1, add the following code to the Click event of the CommandButton on this tab: SSTab1.Caption = "changed"

 Also on the second tab, set the Caption property of the CommandButton to "&Caption."</li> Run the project.</li> Click on the first tab, Tab 0, of the SSTab1 and hit the TAB key to move the focus to the CommandButton on Tab 0.</li> Now press the RIGHT ARROW key (->). Notice that no visible control has the focus.</li> Press the ENTER key. Notice the Tab 0 caption changes to "changed" showing that the middle tab's button was pressed.</li> Stop the project and run it again.</li> Click on the first tab, Tab 0, of the SSTab1 and hit the TAB key to move the focus to the CommandButton on Tab 0.</li> Press the ALT+C key combination. Note that the Tab 0 caption changes to "changed," showing that the middle tab's button was pressed.

The Click event of the CommandButton fires in both cases, the ARROW key and the ACCESS key, even when the tab is not visible.</li></ol>

Keywords: kbbug kbnofix kbtabctrl kbctrl KB193021

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.