Community
Showing results for 
Search instead for 
Do you mean 
Reply

how i can make sub menu ?

Avid Listener
Posts: 83
Country: Malaysia

how i can make sub menu ?

hi all,

 

i managed to add custome menu to ACt. But how i can add submenu ?

 

Thanks.

Copper Contributor
Posts: 34
Country: United States

Re: how i can make sub menu ?

Here ya go in C#. Lucky for you I'm pulling an all nighter. Smiley Tongue

 

//Create and place top level menu

m_objCommandBarButton_Menu = new CommandBarButton("AXCiANT", "AXCiANT Configuration and Help Menus", new EventHandler(ParentMenu_Click), "AXCiANT.Toolbar.Menu", Properties.Resources.icoHistory32X32, CommandBarControl.ItemDisplayStyle.TextOnly, true);

References.ActApp.Explorer.CommandBarCollection["Connected Menus"].ControlCollection.Add(m_objCommandBarButton_Menu);

 

//Create & place sub (1st level) items

//About Items

objCommandBarControl_Menu_About = new CommandBarButton("About", "Provides Information About AXCiANT Plugins", new EventHandler(ParentMenu_Click), "AXCiANT.Toolbar.Menu.About", Properties.Resources.icoInfo32, CommandBarControl.ItemDisplayStyle.ImageAndText, true);

m_objCommandBarButton_Menu.AddSubItem(objCommandBarControl_Menu_About);

Was this post helpful? If so please take a moment to learn a little bit about my ACT! products for yourself or resell to your clients.

Thank You
JB

http://www.axciant.com/act/actrecordescape.asp
Avid Listener
Posts: 83
Country: Malaysia

Re: how i can make sub menu ?

Hi Ramjet,

 

Here is my code. How i can add sub menu from here ?

 

Act.UI.Core.CommandBarControl parentMenu = this.application.Explorer.CommandBarCollection[CONNECTED_MENUBAR].ControlCollection[GetParentControlURN(urn)];

Act.UI.Core.CommandBarButton newMenu = new Act.UI.Core.CommandBarButton(text, text, null, urn, null, null);newMenu.DisplayStyle = Act.UI.Core.

CommandBarControl.ItemDisplayStyle.TextOnly; this.application.RegisterCommand(urn, new Act.UI.CommandHandler(Handler), Act.UI.RegisterType.Shell);

parentMenu.AddSubItem(newMenu);

 

 

 

i tried use your code but got compile errors.

 

Thanks.

Copper Contributor
Posts: 34
Country: United States

Re: how i can make sub menu ?

What are you reading / where are you getting your info from for the method you are using? It would help me understand where you are coming from.
Was this post helpful? If so please take a moment to learn a little bit about my ACT! products for yourself or resell to your clients.

Thank You
JB

http://www.axciant.com/act/actrecordescape.asp
Avid Listener
Posts: 83
Country: Malaysia

Re: how i can make sub menu ?

Hi Ramjet ,

 

here is my code. Actually now i have ubs accounting menu under tools menu. But can i create a new menu  ?

 

Thanks.

 

namespace Act.Samples

{

class CustomMenuPlugin : IPlugin

{

private const string CONNECTED_MENUBAR = "Connected Menus";

private const string DISCONNECTED_MENUBAR = "Disconnected Menus";

private const string CUSTOM_MENU_URN = "act-ui://com.act/application/menu/tools/custom";

// jeff - to add custom menu to ACT.

 private const string CUSTOM_MENU_TEXT = "UBS Accounting";

private const string m_objCommandBarButton_Menu = "";

private ActApplication application; void IPlugin.OnLoad(ActApplication application)

{

// hold on to the application

 this.application = application;

// be sure to keep track of when a user logs in or is logged out

application.AfterLogon += new EventHandler(Application_AfterLogon);application.BeforeLogoff += new EventHandler(Application_BeforeLogoff);

}

void IPlugin.OnUnLoad()

{

// this is equivalent to being disposed,

// so make sure to detach from any events

 if (application != null)

{

application.AfterLogon -=
new EventHandler(Application_AfterLogon);

application.BeforeLogoff -= new EventHandler(Application_BeforeLogoff);

ActFramework framework = application.ActFramework; if (framework != null)

{

framework.Database.BeforeDatabaseLock -=
new Act.Framework.Database.DatabaseLockHandler(Database_BeforeDatabaseLock);

}

}

}

private void Application_AfterLogon(object sender, EventArgs e)

{

//TODO: attach to any events or perform actions

// also, keep track of when we're about to be locked out

application.ActFramework.Database.BeforeDatabaseLock += new Act.Framework.Database.DatabaseLockHandler(Database_BeforeDatabaseLock);

 

 

// add custom menu

AddMenuItem(CUSTOM_MENU_URN, CUSTOM_MENU_TEXT, new Act.UI.CommandHandler(DoStuff)); this.application.ActFramework.Database.BeforeDatabaseLock += new Act.Framework.Database.DatabaseLockHandler(this.BeforeDatabaseLock);

 

}

private void Application_BeforeLogoff(object sender, EventArgs e)

{

// make sure to detatch from anything framework/database/user related,

//as we are about to be logged out

// Remove this so it doesn't become part of the customized menus

RemoveMenuItem(CUSTOM_MENU_URN);

}

//// do something

 private void DoStuff(string command)

{

//MessageBox.Show("Do something");

// UbsaccConnector.ConnectingForm form = new UbsaccConnector.ConnectingForm();

//form.Show();

 Form Form3 = new Form3();

Form3.Show();

}

 

public void BeforeDatabaseLock(object obj, Act.Framework.Database.DatabaseLockInformation LockInfo)

{

}

#region Custom Menu private void AddMenuItem(string urn, string text, Act.UI.CommandHandler Handler)

{

try

{

if (MenuItemExists(urn) == true)

{

RemoveMenuItem(urn);

}

Act.UI.Core.
CommandBarControl parentMenu = this.application.Explorer.CommandBarCollection[CONNECTED_MENUBAR].ControlCollection[GetParentControlURN(urn)];

Act.UI.Core.CommandBarButton newMenu = new Act.UI.Core.CommandBarButton(text, text, null, urn, null, null);newMenu.DisplayStyle = Act.UI.Core.

CommandBarControl.ItemDisplayStyle.TextOnly; this.application.RegisterCommand(urn, new Act.UI.CommandHandler(Handler), Act.UI.RegisterType.Shell);

parentMenu.AddSubItem(newMenu);

}

catch { }

}

private void RemoveMenuItem(string urn)

{

try

{

this.application.RevokeCommand(urn);

Act.UI.Core.CommandBarControl RemoveMenu = this.application.Explorer.CommandBarCollection[CONNECTED_MENUBAR].ControlCollection[urn];

this.application.Explorer.CommandBarCollection[CONNECTED_MENUBAR].ControlCollection[GetParentControlURN(urn)].RemoveSubItem(RemoveMenu);

}

catch { }

}