Community
Showing results for 
Search instead for 
Do you mean 
Reply

Context menu or own button on build tab page

Accepted Solution Solved
Tuned Listener
Posts: 38
Country: Poland
Accepted Solution

Context menu or own button on build tab page

I know how to add own entry to main menu, and how to add extra tab page to detail window. But I would like to add my own button to existing tab page (eg. on Products/Services tab page on Opportunities window). Or add own entry to context menu which is fired after right mouse button is clicked on that tab page.

 

best regards


Accepted Solutions
Solution
Accepted by topic author bernardo
‎09-25-2015 03:20 AM
Copper Super Contributor
Posts: 112
Country: Australia

Re: Context menu or own button on build tab page

this code is dirty because i slapped it together as 'proof of concept'.. do with it what you like

 

 

Imports Act.UI
Imports System.Windows.Forms
Imports System.Drawing

Public Class TabpageMenu
    Implements IPlugin

    Dim WithEvents actApp As ActApplication 'ACT! application object
    Dim buttonAdded As Boolean = False

    Public Sub OnLoad(ByVal actAppl As Act.UI.ActApplication) Implements Act.UI.IPlugin.OnLoad
        actApp = actAppl
    End Sub

    Public Sub OnUnLoad() Implements Act.UI.IPlugin.OnUnLoad

    End Sub

    Private Sub actApp_ViewLoaded(ByVal sender As Object, ByVal e As Act.UI.ViewEventArgs) Handles actApp.ViewLoaded
        If buttonAdded Then Exit Sub

        'the toolbar is not loaded until the IOpportunityDetailView form is displayed at startup
        'so we load the button when we know the form has been loaded
        If actApp.CurrentViewName = "Act.UI.IOpportunityDetailView" Then
            Dim view As Form = DirectCast(actApp.CurrentView, Form)
            Dim ctls() As Control = view.Controls.Find("actionStrip", True)
            Dim s As Windows.Forms.ToolStrip = ctls(0)

            Dim si As Windows.Forms.ToolStripItem

            si = s.Items.Add("My Toolbar Item")
            si.Image = My.Resources.getting_started
            AddHandler si.Click, AddressOf Me.toolbarClick

            buttonAdded = True

        End If
    End Sub

    Private Sub toolbarClick()
        MessageBox.Show("HI, from my toolbar item")
    End Sub


End Class

 

 

View solution in original post


All Replies
Employee
Posts: 1,163
Country: USA

Re: Context menu or own button on build tab page

To create a button on a custom tab page, you'll have to go the route of creating a custom control. I unfortunately do not have an example of doing exactly this, there is however an example in the developers download section that should get you going in the right direction.

Matthew Wood
Act! SDK Support
Community Moderator
Tuned Listener
Posts: 38
Country: Poland

Re: Context menu or own button on build tab page

My question concerns native tab pages in programm (eg Opportunity-Product/Services tab page. Is it possible to add additional button there?

 

best regards

Tuned Listener
Posts: 38
Country: Poland

Re: Context menu or own button on build tab page

Context menu (after right mouse button is clicked over eg Opportunity-Product/Services tab page) maybe? Instead button.

 

best regards

Copper Super Contributor
Posts: 112
Country: Australia

Re: Context menu or own button on build tab page

of course you can add your own item to the toolbar in existing tabpages using the SDK

 

toolbarimage

 

 

Tuned Listener
Posts: 38
Country: Poland

Re: Context menu or own button on build tab page

Ozie - good news Smiley Happy

Could you give me any advice?

 

best regards

Solution
Accepted by topic author bernardo
‎09-25-2015 03:20 AM
Copper Super Contributor
Posts: 112
Country: Australia

Re: Context menu or own button on build tab page

this code is dirty because i slapped it together as 'proof of concept'.. do with it what you like

 

 

Imports Act.UI
Imports System.Windows.Forms
Imports System.Drawing

Public Class TabpageMenu
    Implements IPlugin

    Dim WithEvents actApp As ActApplication 'ACT! application object
    Dim buttonAdded As Boolean = False

    Public Sub OnLoad(ByVal actAppl As Act.UI.ActApplication) Implements Act.UI.IPlugin.OnLoad
        actApp = actAppl
    End Sub

    Public Sub OnUnLoad() Implements Act.UI.IPlugin.OnUnLoad

    End Sub

    Private Sub actApp_ViewLoaded(ByVal sender As Object, ByVal e As Act.UI.ViewEventArgs) Handles actApp.ViewLoaded
        If buttonAdded Then Exit Sub

        'the toolbar is not loaded until the IOpportunityDetailView form is displayed at startup
        'so we load the button when we know the form has been loaded
        If actApp.CurrentViewName = "Act.UI.IOpportunityDetailView" Then
            Dim view As Form = DirectCast(actApp.CurrentView, Form)
            Dim ctls() As Control = view.Controls.Find("actionStrip", True)
            Dim s As Windows.Forms.ToolStrip = ctls(0)

            Dim si As Windows.Forms.ToolStripItem

            si = s.Items.Add("My Toolbar Item")
            si.Image = My.Resources.getting_started
            AddHandler si.Click, AddressOf Me.toolbarClick

            buttonAdded = True

        End If
    End Sub

    Private Sub toolbarClick()
        MessageBox.Show("HI, from my toolbar item")
    End Sub


End Class

 

 

Tuned Listener
Posts: 38
Country: Poland

Re: Context menu or own button on build tab page

Ozie!

Thank You very much! Works great.

 

Best regards

Bernard

Copper Super Contributor
Posts: 112
Country: Australia

Re: Context menu or own button on build tab page

no problemo
Tuned Listener
Posts: 19
Country: India

Re: Context menu or own button on build tab page

Hello, Thanks for sample code.But how we can implement it with ACT Sage dashboard or how do we need to use this code to show custom tab in ACT Dashboard? Thanks