+ Reply to Thread
Results 1 to 3 of 3

Adding ToolTips to buttons

  1. #1
    Carlos Lozano
    Guest

    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

  2. #2
    Rob Bovey
    Guest

    Re: Adding ToolTips to buttons

    "Carlos Lozano" <[email protected]> wrote in message
    news:[email protected]...
    > 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



  3. #3
    Carlos Lozano
    Guest

    Re: 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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
    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1