Avid Listener
Posts: 30
Country: india
Message 1 of 3 (2,489 Views)

Custom Tab


I know through design layout we can create a Tab but if I want show DataGrid in this Tab Just like History,So how can it possible.




Bronze Contributor
Posts: 966
Country: USA
Message 2 of 3 (2,458 Views)

Re: Custom Tab

Try this code to add a tab.  I think there is also an example in the SDK.



'------------------------------------ ' Create a new TabPage '------------------------------------ Dim ACTTabPage As Windows.Forms.TabPage = New Windows.Forms.TabPage(sTabDisplayName) '------------------------------------ ' Create your custom usrcontrol '------------------------------------ Dim CustomGridExControl As usrEntityGridExControl = New usrEntityGridExControl() '------------------------------------ ' Add your custom control to the tab '------------------------------------ ACTTabPage.Controls.Add(CustomGridExControl) '------------------------------------ ' make your custom control visible '------------------------------------ CustomGridExControl.Visible = True '--------------------------------------------------------- ' This is if we are still using ACT tabPages Controler '--------------------------------------------------------- Toolkit.ACTAPP.UILayoutDesignerManager.AddTabToCurrentLayout(ACTTabPage)


 Hope this helps


 -- jim durkin

New Member
Posts: 3
Country: USA
Message 3 of 3 (2,090 Views)

Re: Custom Tab

[ Edited ]

I'm trying to create a simple tab with basic controls from a plugin.  Like add a text box on a tab that loads on startup.  I'm using C# and below is the code I've come up with that loads but does not show the tab.  Any ideas.  I'm using premium for workgroups.



/* * This sample shows the basics of creating a plugin for ACT!. * Copy the .dll created to the folder C:\Program Files\ACT\ACT for Windows\Plugins. * It will add a menu item to the Tools menu. * When selected it will display the Contact field from the current record. */ using System; using System.Windows.Forms; using Act.Framework.Contacts; namespace CS_App_Simple01 { public class Class1 : Act.UI.IPlugin { Act.UI.ActApplication ActApp; public Class1() { } public void OnLoad(Act.UI.ActApplication APP) { ActApp=APP; APP.AfterLogon+=new System.EventHandler(this.AfterLogon); APP.BeforeLogoff+=new System.EventHandler(this.BeforeLogoff); } public void OnUnLoad() { } private void AfterLogon(object Sender, System.EventArgs e) { AddMenuItem("act-ui://com.act/application/menu/tools/Test","Simple Sample 01",new Act.UI.CommandHandler (this.Test01)); ActApp.ActFramework.Database.BeforeDatabaseLock+=new Act.Framework.Database.DatabaseLockHandler(this.BeforeDatabaseLock); AddTab(); } private void BeforeLogoff(object Sender, System.EventArgs e) { RemoveMenuItem("act-ui://com.act/application/menu/tools/Test"); } public void BeforeDatabaseLock(object obj, Act.Framework.Database.DatabaseLockInformation LockInfo) { } public void AddTab() { TabPage pg = new TabPage("JeffDummy"); TextBox txt = new TextBox(); pg.Controls.Add(txt); txt.Visible = true; ActApp.UILayoutDesignerManager.AddTabToCurrentLayout(pg); } private void AddMenuItem(string urn,string MenuText,Act.UI.CommandHandler Handler) { if (MenuItemExists(urn)==true) { RemoveMenuItem(urn); } Act.UI.Core.CommandBarControl ParentMenu = ActApp.Explorer.CommandBarCollection["Connected Menus"].ControlCollection[GetParentControlURN(urn)]; Act.UI.Core.CommandBarButton NewMenu = new Act.UI.Core.CommandBarButton(MenuText, MenuText, null, urn, null, null); NewMenu.DisplayStyle=Act.UI.Core.CommandBarControl.ItemDisplayStyle.TextOnly; ActApp.RegisterCommand(urn, new Act.UI.CommandHandler(Handler), Act.UI.RegisterType.Shell ); ParentMenu.AddSubItem(NewMenu); } private bool MenuItemExists(string urn) { return (ActApp.Explorer.CommandBarCollection["Connected Menus"].ControlCollection[urn]!=null); } private string GetParentControlURN(string urn) { return urn.Substring(0,urn.LastIndexOf("/")); } private void RemoveMenuItem(string urn) { ActApp.RevokeCommand(urn); Act.UI.Core.CommandBarControl RemoveMenu = ActApp.Explorer.CommandBarCollection["Connected Menus"].ControlCollection[urn]; ActApp.Explorer.CommandBarCollection["Connected Menus"].ControlCollection[GetParentControlURN(urn)].RemoveSubItem(RemoveMenu); } //This is the function that gets called when the menu item is clicked. //You can replace the contents of this function with the application examples //from the samples help file. private void Test01(string sDummy) { //------Put your code below here------ Contact cContact = ActApp.ApplicationState.CurrentContact; ContactFieldDescriptor cField = ActApp.ActFramework.Contacts.GetContactFieldDescriptor("TBL_CONTACT.FULLNAME"); object oValue = cField.GetValue(cContact); //Display the result. A blank field will leave the object 'oValue' set to null. //Referencing a null object will generate an error. Be sure to check for this. if(oValue != null) { MessageBox.Show(oValue.ToString()); } else { MessageBox.Show("oValue was null"); } //------Put your code above here------ } //Test01 } }



Message Edited by jeffstine on 02-18-2009 11:55 AM