Progressive Tooltip with Button

By Xiaodong Liang

Progressive Tooltip provides the expanded help tip with more various information.

image

 

Inventor 2011 has exposed the relevant API. The ControlDefinition.ProgressiveToolTip allows you to customize your button. Although we normally create button in an add-in, the following VBA code is a demo how the workflow could be. I have answered a forum question last year with such code. It adds a button in Part>>3D Model >> Work Features with the progressive tooltip.

Public Sub ProgressiveToolTips()   
   Dim g_FilePath As String
   g_FilePath = "C:\temp\"
 
    ‘ Create the button definition.
    Dim smallIcon As IPictureDisp
    Set smallIcon = LoadPicture(g_FilePath & "SmallProgTooltip.bmp")
   
    Dim largeIcon As IPictureDisp
    Set largeIcon = LoadPicture(g_FilePath & "LargeProgTooltip.bmp")
   
    Dim buttonDef As ButtonDefinition
    Set buttonDef = ThisApplication.CommandManager.ControlDefinitions.AddButtonDefinition("Sample1", "SampleCommand", kQueryOnlyCmdType, "", "Sample command to show progressive tool tips.", "Sample", smallIcon, largeIcon)
   
    ‘ Add a control to the Work Feature panel of the Model tab of the Part ribbon.
    Call ThisApplication.UserInterfaceManager.Ribbons.Item("Part").RibbonTabs.Item("id_TabModel").RibbonPanels.Item("id_PanelA_ModelWorkFeatures").CommandControls.AddButton(buttonDef, True)
   
    ‘ Define the progressive tooltip.  This would typically be done in the
    ‘ same section of code where the button definition is created but there’s
    ‘ a problem with the beta version where the progressive tooltip can only
    ‘ be defined on a control has been created.
    With buttonDef.ProgressiveToolTip
        .Description = "The short description."
        .ExpandedDescription = "This is the long expaned version of the description that could have a more complete description to accompany the picture."
        Dim progImage As IPictureDisp
        Set progImage = LoadPicture(g_FilePath & "koala.jpg")
         .Image = progImage
        .IsProgressive = True
        .Title = "Sample1"
      
    End With
End Sub

 

image


Comments

2 responses to “Progressive Tooltip with Button”

  1. I try to use a video instead of an image for my Progressive tooltip, but i can’t get it to work in Inventor 2012 & 2014. The Api says: The standard recommended size is 304 x 188 pixels. This property can either be set to the full file name indicating the video clip or a string indicating a URI (uniform resource identifier). Video clips are currently restricted to the wmv format.
    I tried: .Video = “C:\Temp\Video.wmv” and an embedded video. But nothing seems to work. Is there more info about the video files?

  2. Hi Xiaodong Liang,
    I’m looking for a way to add an tooltip to an user definded macro in the drawing / annotation ribbon.
    As far as I found out there is no easy way to do this by now.
    Now, when reading your article I wonder if I can modify your code the way that my macro button gets an tooltip too?
    As I am just a short time working with Inventor’s VBA I#m not that familiar with programming …
    So Am I right that your code has to be run each time Inventor starts, so that the button and its progressive tooltip is inserted at the right position? Or do I have to run the sub only once an the ribbons are saved when closing Inventor? If so, where are the ribbons saved, so that I can “pack & go” the ribbons to another computer.
    Would be great to get some assistance.
    Best regards
    Joe

Leave a Reply to JoeCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading