AnsweredAssumed Answered

Vb.Addin Missing icons in menu! Why???

Question asked by roberto gennari on Nov 11, 2014
Latest reply on Jun 14, 2015 by Gregor Vitz


I have a problem with icons in my Addin, they are missing in menu, like in the attached image.


This is my addin code (it is standard):






#Region"UI Methods"


Sub AddCommandMgr()


        Dim mdGroup As ICommandGroup


      If iBm Is Nothing Then

            iBmp = New BitmapHandler()

      End If

Dim thisAssembly As Assembly


        Dim cmdIndex0 As Integer,cmdIndex1 As Integer

        Dim Title As String= "wizard"

        Dim ToolTip As String= "wizard"


Dim docTypes() As Integer = {swDocumentTypes_e.swDocASSEMBLY, _

                                       swDocumentTypes_e.swDocDRAWING, _



        thisAssembly = System.Reflection.Assembly.GetAssembly(Me.GetType())


        Dim cmdGroupErr As Integer= 0

        Dim ignorePrevious As Boolean= False


Dim registryIDs As Object= Nothing

        Dim getDataResult As Boolean = iCmdMgr.GetGroupDataFromRegistry(mainCmdGroupID, registryIDs)

Dim knownIDs As Integer() = New Integer(1){mainItemID1, mainItemID2}


        If getDataResult Then

            If Not CompareIDs(registryIDs, knownIDs) Then 'if the IDs don't
match, reset the commandGroup

                ignorePrevious = True

            End If

        End If


        cmdGroup =iCmdMgr.CreateCommandGroup2(mainCmdGroupID, Title, ToolTip, "", -1, ignorePrevious, cmdGroupErr)

        If cmdGroup Is Nothing Or thisAssembly Is Nothing Then

                 Throw New NullReferenceException()

        End If




cmdGroup.LargeIconList = iBmp.CreateFileFromResourceBitmap("SwTools Sketch wizard.Toolbar_large.bmp", thisAssembly)



cmdGroup.SmallIconList = iBmp.CreateFileFromResourceBitmap("SwTools Sketch wizard.Toolbar_small.bmp", thisAssembly)



cmdGroup.LargeMainIcon = iBmp.CreateFileFromResourceBitmap("SwTools Sketch wizard.MainIconLarge.bmp", thisAssembly)



cmdGroup.SmallMainIcon = iBmp.CreateFileFromResourceBitmap("SwTools Sketch wizard.MainIconSmall.bmp", thisAssembly)



Dim menuToolbarOption As Integer = swCommandItemType_e.swMenuItem Or swCommandItemType_e.swToolbarItem



cmdIndex0 = cmdGroup.AddCommandItem2("CreateCube", -1, "Create a cube", "Create cube", 0, "CreateCube", "", mainItemID1, menuToolbarOption)



cmdIndex1 = cmdGroup.AddCommandItem2("Show PMP", -1, "Display sample property manager", "Show PMP", 2, "ShowPMP", "PMPEnable", mainItemID2, menuToolbarOption)


      cmdGroup.HasToolbar = True

      cmdGroup.HasMenu = True



        Dim flyGroup As FlyoutGroup

        flyGroup =iCmdMgr.CreateFlyoutGroup(flyoutGroupID, "Dynamic Flyout", "Flyout Tooltip","Flyout Hint", cmdGroup.SmallMainIcon,
cmdGroup.LargeMainIcon, cmdGroup.SmallIconList, cmdGroup.LargeIconList, "FlyoutCallback", "FlyoutEnable")


        flyGroup.AddCommandItem("FlyoutCommand 1", "test", 0, "FlyoutCommandItem1","FlyoutEnableCommandItem1")

        flyGroup.FlyoutType = swCommandFlyoutStyle_e.swCommandFlyoutStyle_Simple


        For Each docType As Integer In docTypes

            Dim cmdTab As ICommandTab= iCmdMgr.GetCommandTab(docType, Title)

            Dim bResult As Boolean


            If Not cmdTab Is Nothing And Not getDataResult Or ignorePrevious Then 'if
tab exists, but we have ignored the registry info, re-create the tab.  Otherwise the ids won't matchup and the tab
will be blank

                Dim res As Boolean= iCmdMgr.RemoveCommandTab(cmdTab)

                               cmdTab = Nothing

             End If


            If cmdTab Is Nothing Then

                cmdTab = iCmdMgr.AddCommandTab(docType, Title)


                Dim cmdBox As CommandTabBox= cmdTab.AddCommandTabBox


                Dim cmdIDs(3) As Integer

                Dim TextType(3) As Integer


                cmdIDs(0) =cmdGroup.CommandID(cmdIndex0)

                TextType(0) = swCommandTabButtonTextDisplay_e.swCommandTabButton_TextHorizontal


                cmdIDs(1) =cmdGroup.CommandID(cmdIndex1)

                TextType(1) = swCommandTabButtonTextDisplay_e.swCommandTabButton_TextHorizontal


                cmdIDs(2) = cmdGroup.ToolbarId

                TextType(2) = swCommandTabButtonTextDisplay_e.swCommandTabButton_TextHorizontal



                bResult =cmdBox.AddCommands(cmdIDs, TextType)


                Dim cmdBox1 As CommandTabBox= cmdTab.AddCommandTabBox()

                ReDim cmdIDs(1)

                ReDim TextType(1)


                cmdIDs(0) = flyGroup.CmdID

                TextType(0) = swCommandTabButtonTextDisplay_e.swCommandTabButton_TextBelow


                bResult = cmdBox1.AddCommands(cmdIDs, TextType)




            End If



     thisAssembly = Nothing


    End Sub