12-15-2010 03:06 AM
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
12-20-2010 01:15 PM
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
12-16-2010 08:24 AM
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.
12-17-2010 04:13 AM
My question concerns native tab pages in programm (eg Opportunity-Product/Services tab page. Is it possible to add additional button there?
best regards
12-17-2010 06:18 AM
Context menu (after right mouse button is clicked over eg Opportunity-Product/Services tab page) maybe? Instead button.
best regards
12-18-2010 07:48 PM
of course you can add your own item to the toolbar in existing tabpages using the SDK
12-20-2010 12:35 AM
Ozie - good news
Could you give me any advice?
best regards
12-20-2010 01:15 PM
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
12-21-2010 01:43 AM
Ozie!
Thank You very much! Works great.
Best regards
Bernard
12-21-2010 02:35 AM
03-20-2013 03:23 AM