0 Replies Latest reply on Nov 4, 2014 5:34 PM by Seth Ruhan

    Addin context button

    Seth Ruhan



      I am trying to add a context button, However can not work out how to do this.


      I am able to get a context menu, however that's not what I'm after. I would like the button to site directly in the normal menu, with out its own menu.

      (see image)


      This is the code I have used.

      Public Sub AddComponentContext(iCmdMgr As ICommandManager)


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

                  Dim menuToolbarOption As Integer = 0

                  Dim PartContext As ICommandGroup


                  PartContext = iCmdMgr.AddContextMenu(ButtonID.ComponentContextMenu, "Part Context")

                  PartContext.SelectType = swSelectType_e.swSelCOMPONENTS

                  PartContext.LargeIconList = iBmp.CreateFileFromResourceBitmap("OU_SW_SEAP_Addin.ToolbarLarge.bmp", thisAssembly)

                  PartContext.SmallIconList = iBmp.CreateFileFromResourceBitmap("OU_SW_SEAP_Addin.ToolbarSmall.bmp", thisAssembly)

                  PartContext.LargeMainIcon = iBmp.CreateFileFromResourceBitmap("OU_SW_SEAP_Addin.AddinIcon.bmp", thisAssembly)

                  PartContext.SmallMainIcon = iBmp.CreateFileFromResourceBitmap("OU_SW_SEAP_Addin.AddinIcon.bmp", thisAssembly)



                  PartContext.AddCommandItem2("Make Unqiue", -1, "Makes this component unqiue", "Makes this component unqiue", IconEnum.Blank, ButtonClass.MethodName(AddressOf UI_MakeComponentUnique), ButtonClass.MethodName(AddressOf IC_MakeComponentUnique), ButtonID.ComponentUnique, menuToolbarOption)





              Catch ex As System.Exception

                  LogWriter.WriteLog("Error ACC1 :" & ex.Message)

                  LogWriter.WriteLog("Stack : " & ex.StackTrace & "|" & ex.ToString)

              End Try

          End Sub



      Any help would be great