BUG: Toolbar Displays Multiple Selected Toggle Buttons
ID: Q189666
|
The information in this article applies to:
-
Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 6.0
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:
- Design time.
- Form's Initialize event.
- 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."
- Paste the following code into Form1's code window:
Private Sub Form_Click()
Toolbar1.Buttons(2).Value = tbrPressed
End Sub
- Run the sample project.
- Click on the form, and note that both Toolbar buttons appear to be
pressed.
WORKAROUND
- Add a Timer control to Form1 in the previous project.
- Set the Timer's Interval property to "1."
- Add the following code to Form1:
Private Sub Timer1_Timer()
Toolbar1.Buttons(1).Value = tbrPressed
Timer1.Enabled = False
End Sub
- View the custom property sheet for the Toolbar control. Set the Value
property of all Toolbar buttons to "0 - tbrUnPressed."
- Run your sample and click on Form1. Note that the Toolbar's correct
appearance is achieved.
Additional query words:
kbDSupport kbDSD kbVBp kbCtrl kbVBp600bug
Keywords : kbGrpVB
Version :
Platform : WINDOWS
Issue type : kbbug