Community
Showing results for 
Search instead for 
Do you mean 
Reply

Add a button to opportunity menu bar

Tuned Listener
Posts: 17
Country: France

Add a button to opportunity menu bar

Hi

 

I just want to add a button to opportunity menu bar, on opportunity and lookup tab. 

Is it possible?

 

I know how to add a button to contact menubar but it seems to does'nt work for Opportunity.

 

Thanks!

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Add a button to opportunity menu bar

 

 

Here is a routin to add a toolbar item into the ACT UI

 

 

 Public Shared Sub AddToolBarItem(ByVal ToolbarName As String, _
                                     ByVal urn As String, _
                                     ByVal MenuText As String, _
                                     ByVal Handler As Act.UI.CommandHandler, _
                                     ByVal InvImageLg As System.Drawing.Image, _
                                     ByVal InvImageSm As System.Drawing.Image, _
                                     ByVal Position As Integer, _
                                     ByVal HasSeperator As Boolean, _
                                     ByVal ACTAPP As Act.UI.ActApplication)

        Try

            Dim ToolTip As String = MenuText

            Dim NewToolBarItem As Act.UI.Core.CommandBarButton = New Act.UI.Core.CommandBarButton(ToolTip, _
                                                                                                  ToolTip, _
                                                                                                  Nothing, _
                                                                                                  urn, _
                                                                                                  InvImageLg, _
                                                                                                  InvImageSm)

            NewToolBarItem.DisplayStyle = Act.UI.Core.CommandBarControl.ItemDisplayStyle.ImageOnly

            '-------------------------------------------
            ' Remove the current toolbar
            '-------------------------------------------
            RemoveToolBarItem(urn, ACTAPP)

            '-------------------------------
            ' Register the command in ACT
            '-------------------------------
            ACTAPP.RegisterCommand(urn, Handler, Act.UI.RegisterType.Shell)


            '-------------------------------------
            ' Add to all the toolbars available
            '-------------------------------------
            Dim tBar As Act.UI.Core.CommandBar
            For Each tBar In ACTAPP.Explorer.CommandBarCollection
                ' Only add to toolbar ( Not Menus )
                If tBar.Name.ToUpper().IndexOf("TOOLBAR") <> -1 Then
                    If tBar.Name.ToUpper() = ToolbarName Then
                        tBar.ControlCollection.Add(NewToolBarItem)
                        NewToolBarItem.IsVisible = False
                        NewToolBarItem.IsVisible = True
                        Application.DoEvents()
                        Exit For
                    End If
                End If
            Next

        Catch ex As Exception
            Throw New Exception("ACTAPPFunctions:AddToolBarItem", ex)
        End Try

    End Sub

 

 

Usage

AddToolBarItem("Opportunity Detail Toolbar", _
              Me.URN_OPPCon_ToolBar, _
              "Convert to Project", _
              "Convert to Project in a custom table.", _
              ACTConvertImage, _
              ACTConvertImage, _
              Me.HostApplication, _
              True, _
              2)

 

Hope this helps

-- Jim Durkin