View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Carlos Lozano Carlos Lozano is offline
external usenet poster
 
Posts: 18
Default Adding ToolTips to buttons

Hi,

I created an application that adds a new toolbar containing popup menus and
buttons. The popup menus contain commandbuttons (msoControlButton).

I did the following to enable viewing tooltips:
1) assigned text to the tooltiptext of all controls
2) set oCommandBars.DisplayTooltips = True before the buttons are added to
the container controls.

The tooltips are shown for all controls contained in the toolbar (popups and
buttons) but not for the buttons contained in the popups.

I will appreciate any suggestion.

Part of the code is below.

Thank you,

Carlos Lozano

Sub Createmenu
' Objects definitions here
Dim oToolBar As CommandBar
Dim oCommandBars As CommandBars
Dim oButton As CommandBarButton
Dim oPopUp As CommandBarPopup

Set oCommandBars = Application.CommandBars

oCommandBars("SWACO_DesignTool").Delete
oCommandBars.DisplayTooltips = True

On Error GoTo 0
Set oToolBar = oCommandBars.Add("SWACO_DesignTool", msoBarTypeMenuBar)

With Application.ActiveWindow
oToolBar.Left = .Left + .Width - oToolBar.Width
End With

Set oButton = oToolBar.Controls.Add(Office.msoControlButton)
With oButton
.Style = msoButtonCaption
.Caption = "MI SWACO ToolBar"
.OnAction = "About"
End With
' Create Popup and buttons for dialogs
Set oPopUp = oToolBar.Controls.Add(Office.msoControlPopup)
oPopUp.BeginGroup = True
oPopUp.Caption = " Utilities"
oPopUp.Width = Len(oPopUp.Caption)
oPopUp.TooltipText = "Utilities menu."

Set oButton = oPopUp.Controls.Add(Office.msoControlButton)
With oButton
.BeginGroup = True
.Style = msoButtonCaption
.Caption = "Create New Project"
.OnAction = "NewProject"
.TooltipText = "This is the tooltip description text"
End With

Set oButton = oPopUp.Controls.Add(Office.msoControlButton)
With oButton
.Style = msoButtonCaption
.Caption = "'Save As' Project File"
.OnAction = "ExportDesign"
.TooltipText = "This is another tooltip description text"
End With
oToolBar.Visible = True
end sub