Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a right click
Message
Information générale
Forum:
ASP.NET
Catégorie:
Menus
Divers
Thread ID:
00779983
Message ID:
00780868
Vues:
12
No not really. When making an addin you cant use a visual contextmenu object because you dont have a form. It has to be done in code. What I want would add a context menu item to the popup that has; cut, copy, paste, run to cursor, and add 'task list shortcut' while you are in the VS.IDE. So then when you are coding you select some text and right click you get a popup with; cut, copy, paste, 'JoesAddin' when you click JoesAddin the code is modified in the editor (or whatever other task) as per the addin code. This is strictly for developers not for the usual end users. Sorry for not being clear. The code should look something this; Note: This code adds the addin to the standard menu but does not add the addin to the popup menu as it appears it should.
    Public Sub OnConnection(ByVal application As Object, _
                            ByVal connectMode As Extensibility.ext_ConnectMode, _
                            ByVal addInInst As Object, _
                            ByRef custom As System.Array) _
                                    Implements Extensibility.IDTExtensibility2.OnConnection

        applicationObject = CType(application, EnvDTE.DTE)
        addInInstance = CType(addInInst, EnvDTE.AddIn)
        If connectMode = Extensibility.ext_ConnectMode.ext_cm_UISetup Then
            Dim objAddIn As AddIn = CType(addInInst, AddIn)
            Dim CommandObj As Command

            Try
                CommandObj = applicationObject.Commands.AddNamedCommand(objAddIn, "LetsTestAddins", "LetsTestAddins", _
                                                "Executes the command for LetsTestAddins", True, 59, Nothing, 1 + 2) _
                                                    '1+2 == vsCommandStatusSupported+vsCommandStatusEnabled
                CommandObj.AddControl(applicationObject.CommandBars.Item("Tools"))

                m_objDTE = CType(application, EnvDTE.DTE)
                m_objCommandBarButton = _
                        m_objDTE.CommandBars.Item("GROOVYADDIN").Controls.Add(MsoControlType.msoControlButton)
                ' Set properties
                m_objCommandBarButton.Caption = "YourCaption"
                m_objCommandBarButton.TooltipText = "My ToolTip"
            Catch e As System.Exception
            End Try
        End If
    End Sub

    Private Sub m_objCommandBarButton_Click(ByVal Ctrl As Microsoft.Office.Core.CommandBarButton, _
                                            ByRef CancelDefault As Boolean) Handles m_objCommandBarButton.Click
        MsgBox("Your code here...")
    End Sub
>Hi Joe,
>
>In steps 2 and 3 below, I discuss how to add menu bars to a context menu. Isn't this what you are asking for?
>
>>In an addin the 'form' is the endusers work, maybe a source module. What I want to do is a context menu. However, it's in a VS.NET addin. I know how to add menu items to the regular menus... But not to the context menu.
>>
[snip]
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform