Microsoft KB Archive/242322

= PRB: ToolTipText Property On MMCToolbar Button Does Not Update =

Article ID: 242322

Article Last Modified on 3/20/2004

-

APPLIES TO


 * Microsoft Management Console 1.1
 * Microsoft Management Console 1.2
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q242322



SYMPTOMS
A SnapIn project developed with the MMC Snap-in Designer for Visual Basic may require that a MMCToolbar button's ToolTipText property be changed at runtime. While the ToolTipText property for an MMCToolbar button cannot be changed dynamically, it can be changed the next time the MMCToolbar control is attached to a view.



CAUSE
By design the ToolTipText property for an MMCToolbar button control cannot be changed while it's MMCToolbar is being displayed in the current view.



RESOLUTION
Remove the MMCToolbar button from the MMCToolbar button collection. Modify the ToolTipText property and re-add the MMCButton to the MMCToolbar control. The next time the MMCToolbar control is attached to a view, the updated ToolTipText will be displayed. The following code demonstrates how to achieve this functionality: ' only modify a certain toolbar button Select Case Button.Key Case "Test": ' change the tooltiptext for this button Button.ToolTipText = "This is a different tip" ' remove the button from the toolbar control Call Toolbar1.Buttons.Remove(Button.Index) ' re-add the button to the toolbar control Call Toolbar1.Buttons.Add(Button.Index, Button.Key, Button.Caption, Button.Style, Button.Image, Button.ToolTipText) End Select



STATUS
This behavior is by design.



MORE INFORMATION
The following steps demonstrate how to change the ToolTipText property of an MMCToolbar button control.

Steps to reproduce sample
 Start Visual Basic and select a New SnapIn project. Open the SnapIn1 Designer from the Project Explorer, and add a new ImageList and Toolbar object under the Tools Node. By default these objects will be named ImageList1 and Toolbar1. View the properties of ImageList1, and insert a 16x16 bitmap into the Imagelist. Set the Key field of the bitmap to "Test." View the properties of Toolbar1 and set the ImageList field to ImageList1. On the Buttons tab, insert a new button onto the toolbar. Set the Key and Image fields to "Test," and the ToolTipText field to "First ToolTip."  Open the code window to the SnapIn1 Designer and paste in the following code: Private Sub Toolbar1_ButtonClick(ByVal Selection As SnapInLib.MMCClipboard, ByVal Button As SnapInLib.MMCButton)

' only modify a certain toolbar button Select Case Button.Key Case "Test": ' change the tooltiptext for this button Button.ToolTipText = "This is a different tip" ' remove the button from the toolbar control Call Toolbar1.Buttons.Remove(Button.Index) ' re-add the button to the toolbar control Call Toolbar1.Buttons.Add(Button.Index, Button.Key, Button.Caption, Button.Style, Button.Image, Button.ToolTipText) End Select End Sub

Private Sub Views_SetControlbar(ByVal View As SnapInLib.View, ByVal Controlbar As SnapInLib.MMCControlbar)

' attach the test MMCToolbar control to the Controlbar Controlbar.Attach Toolbar1 End Sub </li> Compile the SnapIn and load it into MMC.</li> When the SnapIn loads, the sample button appears in the MMC menu item area. Move the mouse over the button, and the current ToolTipText will be displayed.</li> Click the button. Move the mouse over the button, and notice the original ToolTipText is still displayed.</li> On the ScopeNode pane, select the ConsoleRoot node, and then the SnapIn1 Node. When the SnapIn1 Node is selected the MMCToolbar is re-attach to the MMC Controlbar with the updated button./</li> Move the mouse over the button. The new ToolTipText displays.</li></ol>

Additional query words: snapin designer mmc

Keywords: kbnofix kbprb kbsnapin kbdswmanage2003swept KB242322

-

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

© Microsoft Corporation. All rights reserved.