Microsoft KB Archive/189666

= BUG: Toolbar Displays Multiple Selected Toggle Buttons =

Article ID: 189666

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q189666



SYMPTOMS
Two buttons on a Toolbar within the same Toggle Button Group appear to be selected simultaneously.



RESOLUTION
To work around this problem, set the Value property of the toggle button to tbrPressed only after the Form has been initially displayed.



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



MORE INFORMATION
This problem occurs whenever the Value property of one of the toggle buttons is set to "1 - tbrPressed" before the control is first displayed on the screen at run-time. For example, setting this property at any of the following times will result in this problem:


 * 1) Design time.
 * 2) Form's Initialize event.
 * 3) Form's Load event.

Despite the appearance of these buttons, only the last button selected actually has its Value property set to "1 - tbrPressed." All other toggle buttons within this toggle group have their Value property correctly set to "0 - tbrUnPressed."

Steps to Reproduce Behavior
 Create a new Standard EXE project. Form1 is created by default. Select Components from the Project menu and add a reference to the "Microsoft Windows Common Controls 6.0." Add a Toolbar control to Form1. View the custom property sheet for the Toolbar control, select the Buttons tab, and insert two buttons. Set the Style property of both buttons to "2 - tbrButtonGroup." Set button 1's Value property to "1 - tbrPressed" and leave button 2's Value as "0 - tbrUnPressed."</li>  Paste the following code into Form1's code window: Private Sub Form_Click Toolbar1.Buttons(2).Value = tbrPressed End Sub </li> Run the sample project.</li> Click on the form, and note that both Toolbar buttons appear to be pressed.</li></ol>

WORKAROUND
<ol> Add a Timer control to Form1 in the previous project.</li> Set the Timer's Interval property to "1."</li>  Add the following code to Form1: Private Sub Timer1_Timer Toolbar1.Buttons(1).Value = tbrPressed Timer1.Enabled = False End Sub </li> View the custom property sheet for the Toolbar control. Set the Value property of all Toolbar buttons to "0 - tbrUnPressed."</li> Run your sample and click on Form1. Note that the Toolbar's correct appearance is achieved.</li></ol>

Additional query words: kbDSupport kbDSD kbVBp kbCtrl kbVBp600bug

Keywords: kbbug KB189666

-

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

© Microsoft Corporation. All rights reserved.