Community
Showing results for 
Search instead for 
Do you mean 
Reply

Add new Menus

Copper Contributor
Posts: 119
Country: USA

Add new Menus

by russell.jones on 11-12-2007 8:19 AM

Is it possible to add new menus in ACT! ?

I've tried a few examples i've found but they all add entries to an existing menu rather than creating an entire new menu.  

For the moment I've attached my menu to the tools menu and it seems to work OK but I'd like it more visible if possible. Is there a way of adding new Menu content within the Act application?

 Thanks,

 

Russell

Copper Contributor
Posts: 119
Country: USA

Re: Add new Menus

by Mark.Coffman on 11-12-2007 8:31 AM

I would really like to be able to do this as well.

Copper Contributor
Posts: 119
Country: USA

Re: Add new Menus

by Xavier on 11-12-2007 6:16 PM

When you say a new menu, do you mean a new top-level menu (such as File or Tools)?

Copper Contributor
Posts: 119
Country: USA

Re: Add new Menus

by russell.jones on 11-13-2007 2:51 AM

Yes,

 

I can create submenus on the menus that are already there but can't find a way to add a Top-Level Menu.

 

Russell 

Copper Contributor
Posts: 119
Country: USA

Re: Add new Menus

by Russell.Jones on 11-21-2007 5:50 AM

I seem to have cracked this. 

This is some way off production code but it does the job.  Most notably I haven't got round to removing the child items in the OnUnLoad() yet. 

Russell 

 

     ActApplication _actInstance;
        public void OnLoad(ActApplication actApp)
        {
            _actInstance = actApp;
            _actInstance.AfterLogon += AfterLogon;   
        }
        public void AfterLogon(object sender, EventArgs ea)
        {
            CommandBarButton MyMenu = new CommandBarButton("hello world", "hello world tooltip", null, @"act-ui://com.act/application/menu/helloworld", null, null);
            MyMenu.Parent = _actInstance.Explorer.CommandBarCollection["Connected Menus"].ControlCollection;
            _actInstance.Explorer.CommandBarCollection["Connected Menus"].ControlCollection.Add(MyMenu);
            CommandBarControl MyMenuChild1 = new CommandBarButton("Child1", "Child1 tooltip", null, @"act-ui://com.act/application/menu/helloworld/Child1", null, null);
            CommandBarControl MyMenuChild2 = new CommandBarButton("Child2", "Child2 tooltip", null, @"act-ui://com.act/application/menu/helloworld/Child2", null, null);
            CommandBarControl MyMenuGrandChild = new CommandBarButton("GrandChild1", "GrandChild1 tooltip", null, @"act-ui://com.act/application/menu/helloworld/Child1/GrandChild1", null, null);
            _actInstance.RegisterCommand(@"act-ui://com.act/application/menu/helloworld/Child1", new CommandHandler(DoStuff), RegisterType.Shell);
            _actInstance.RegisterCommand(@"act-ui://com.act/application/menu/helloworld/Child2", new CommandHandler(DoStuff), RegisterType.Shell);
            _actInstance.RegisterCommand(@"act-ui://com.act/application/menu/helloworld/Child1/GrandChild1", new CommandHandler(DoStuff), RegisterType.Shell);
            MyMenu.AddSubItem(MyMenuChild1);
            MyMenu.AddSubItem(MyMenuChild2);
            MyMenuChild1.AddSubItem(MyMenuGrandChild);
            
        }
        private void DoStuff(string command)
        {
            MessageBox.Show(command);
        }
        public void OnUnLoad()
        {
        }