ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding ToolTips to buttons (https://www.excelbanter.com/excel-programming/329499-adding-tooltips-buttons.html)

Carlos Lozano

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

Rob Bovey

Adding ToolTips to buttons
 
"Carlos Lozano" wrote in message
...
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.


Hi Carlos,

Unfortunately, this is just the way command bar controls are designed.
Controls of type msoControlPopup don't display tooltips even if they have
tooltips assigned to them.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm



Carlos Lozano

Adding ToolTips to buttons
 
Hello Rob,
I thought that was the answer and was hoping to be wrong.

Thank you,

Carlos Lozano
www.caxonline.net

"Rob Bovey" wrote:

"Carlos Lozano" wrote in message
...
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.


Hi Carlos,

Unfortunately, this is just the way command bar controls are designed.
Controls of type msoControlPopup don't display tooltips even if they have
tooltips assigned to them.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm





All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com