<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Betreff: Context Menu dropdown? in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12664851#M11946</link>
    <description>&lt;P&gt;For former versions of Inventor this was not possible to add a dropdown in a context menu.&lt;/P&gt;&lt;P&gt;I think it is still not possible in newer versions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Mar 2024 21:31:02 GMT</pubDate>
    <dc:creator>etaCAD</dc:creator>
    <dc:date>2024-03-25T21:31:02Z</dc:date>
    <item>
      <title>Context Menu dropdown?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12664667#M11945</link>
      <description>&lt;P&gt;I'm trying to add a dropdown menu to my right-click menu but I'm at a loss.&lt;/P&gt;&lt;P&gt;I'm looking to take the "Laser, Mill, Sol's" commands and put them in a flyout menu exactly like the BOM Structure commands.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="spencer_0-1711397784485.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1341547i20593E6508E1640D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="spencer_0-1711397784485.png" alt="spencer_0-1711397784485.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I thought it might have just been using the "AddButtonPopup" function but that throws an error when I tried to add an object collection of those 3 button definitions. Not sure that style button can't be added to the context menu of if I messed up the function somehow.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 20:19:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12664667#M11945</guid>
      <dc:creator>spencer</dc:creator>
      <dc:date>2024-03-25T20:19:25Z</dc:date>
    </item>
    <item>
      <title>Betreff: Context Menu dropdown?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12664851#M11946</link>
      <description>&lt;P&gt;For former versions of Inventor this was not possible to add a dropdown in a context menu.&lt;/P&gt;&lt;P&gt;I think it is still not possible in newer versions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 21:31:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12664851#M11946</guid>
      <dc:creator>etaCAD</dc:creator>
      <dc:date>2024-03-25T21:31:02Z</dc:date>
    </item>
    <item>
      <title>回复： Context Menu dropdown?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12665184#M11947</link>
      <description>&lt;P&gt;Take a look at this &lt;A href="https://forums.autodesk.com/t5/inventor-programming-ilogic/right-click-pop-out-button-inventor-add-in/td-p/11863199" target="_blank" rel="noopener"&gt;post&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 01:15:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12665184#M11947</guid>
      <dc:creator>yuzeaa</dc:creator>
      <dc:date>2024-03-26T01:15:08Z</dc:date>
    </item>
    <item>
      <title>回复： Context Menu dropdown?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12669335#M11948</link>
      <description>&lt;P&gt;Still getting an error when I do it the way described in that post, happens when right-click and it tries to add the controls to the command bar. I even downloaded the .rar to look through that code and mine is functionally identical for all I can tell (My buttons are defined elsewhere and put into a 'contextButtons' list)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;AddHandler m_inventorApplication.CommandManager.UserInputEvents.OnContextMenu,
            Sub(SelectionDevice As Inventor.SelectionDeviceEnum, AdditionalInfo As Inventor.NameValueMap, CommandBar As Inventor.CommandBar)
                If m_inventorApplication.ActiveDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
                    Dim SelectedEntities As SelectSet = m_inventorApplication.ActiveDocument.SelectSet
                    If SelectedEntities.Count &amp;gt; 0 Then
                        If TypeOf SelectedEntities(1) Is ComponentOccurrence Then
                            Dim CategoryButtons As CommandBar = m_inventorApplication.UserInterfaceManager.CommandBars.Add("Category", "CategoryCmd", CommandBarTypeEnum.kButtonPopupCommandBar)
                            CategoryButtons.Controls.AddButton(contextButtons("Laser"))
                            CategoryButtons.Controls.AddButton(contextButtons("Mill"))
                            CategoryButtons.Controls.AddButton(contextButtons("Sol's"))
                            CommandBar.Controls.AddPopup(CategoryButtons)

                        End If
                    End If
                End If
            End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 13:58:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12669335#M11948</guid>
      <dc:creator>spencer</dc:creator>
      <dc:date>2024-03-27T13:58:29Z</dc:date>
    </item>
    <item>
      <title>回复： Context Menu dropdown?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12669761#M11949</link>
      <description>&lt;P&gt;you can't define commandbar with same internalname&amp;nbsp; everytime&amp;nbsp; rightclick.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="6666.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1342711i8EA8947366508AE0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="6666.png" alt="6666.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="77777.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1342712i3159AC27B6288585/image-size/medium?v=v2&amp;amp;px=400" role="button" title="77777.png" alt="77777.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Class ThisRule
	Dim contextButtons As New Dictionary(Of String,ButtonDefinition)
    Private CategoryButtons As CommandBar
	Sub main
        Dim oControls = ThisApplication.CommandManager.ControlDefinitions
		contextButtons.Add("Laser", oControls.AddButtonDefinition("Laser", "LaserCmd", CommandTypesEnum.kShapeEditCmdType))
		contextButtons.Add("Mill", oControls.AddButtonDefinition("Mill", "MillCmd", CommandTypesEnum.kShapeEditCmdType))
		contextButtons.Add("Sol's", oControls.AddButtonDefinition("Sol's", "Sol'sCmd", CommandTypesEnum.kShapeEditCmdType))
		CategoryButtons =ThisApplication.UserInterfaceManager.CommandBars.Add("Category", "CategoryCmd", CommandBarTypeEnum.kPopUpCommandBar)
		CategoryButtons.Controls.AddButton(contextButtons("Laser"))
		CategoryButtons.Controls.AddButton(contextButtons("Mill"))
		CategoryButtons.Controls.AddButton(contextButtons("Sol's"))
		
        AddHandler ThisApplication.CommandManager.UserInputEvents.OnContextMenu, AddressOf OnContextMenu
	End Sub
	
	Private Sub OnContextMenu(SelectionDevice As SelectionDeviceEnum, AdditionalInfo As NameValueMap, CommandBar As CommandBar)
        If ThisApplication.ActiveDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
            Dim SelectedEntities As SelectSet = ThisApplication.ActiveDocument.SelectSet
            If SelectedEntities.Count &amp;gt; 0 Then
                If TypeOf SelectedEntities(1) Is ComponentOccurrence Then
                    CommandBar.Controls.AddPopup(CategoryButtons)
                End If
            End If
        End If
    End Sub
End Class&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 27 Mar 2024 16:08:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12669761#M11949</guid>
      <dc:creator>yuzeaa</dc:creator>
      <dc:date>2024-03-27T16:08:15Z</dc:date>
    </item>
    <item>
      <title>回复： Context Menu dropdown?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12670396#M11950</link>
      <description>&lt;P&gt;Ah, didn't realize that was the case and it's working perfectly now, thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 19:36:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/context-menu-dropdown/m-p/12670396#M11950</guid>
      <dc:creator>spencer</dc:creator>
      <dc:date>2024-03-27T19:36:46Z</dc:date>
    </item>
  </channel>
</rss>

