Community
Showing results for 
Search instead for 
Do you mean 
Reply

Create menu item

Copper Contributor
Posts: 11
Country: Netherlands

Create menu item

[ Edited ]

There are many topics about creating your own menu item but I couldn't find a good solution.

In the CustomMenuPlugin.cs:

AddMenuItem("act-ui://com.act/application/menu/tools/custom", "test", new Act.UI.CommandHandler(DoStuff));

RemoveMenuItem("act-ui://com.act/application/menu/tools/custom");

 

So now i want a option test in tools. Option test has 3 options, option1,option2,option3

AddMenuItem("act-ui://com.act/application/menu/tools/custom", "test", null);

AddMenuItem("act-ui://com.act/application/menu/tools/custom/test", "option1", new Act.UI.CommandHandler(DoStuff));

AddMenuItem("act-ui://com.act/application/menu/tools/custom/test", "option2", new Act.UI.CommandHandler(DoStuff));

AddMenuItem("act-ui://com.act/application/menu/tools/custom/test", "option3", new Act.UI.CommandHandler(DoStuff));

 

RemoveMenuItem("act-ui://com.act/application/menu/tools/custom/test");

RemoveMenuItem("act-ui://com.act/application/menu/tools/custom");

 

but this doesn't work, how this all work with urn in ACT? Is there a document about this...

 

Is there also a reason for the text "custom" in the urn?

Message Edited by RvdK on 10-09-2009 02:40 AM
Message Edited by RvdK on 10-09-2009 05:22 AM
Message Edited by RvdK on 10-09-2009 05:23 AM
Copper Super Contributor
Posts: 59
Country: USA

Re: Create menu item

Hi,

 

The urn is a string unique to each menu item. So your code is almost right, you only need to change these 3 lines to the following:

 

AddMenuItem("act-ui://com.act/application/menu/tools/custom/test1", "option1", new Act.UI.CommandHandler(DoStuff));

AddMenuItem("act-ui://com.act/application/menu/tools/custom/test2", "option2", new Act.UI.CommandHandler(DoStuff));

AddMenuItem("act-ui://com.act/application/menu/tools/custom/test3", "option3", new Act.UI.CommandHandler(DoStuff));

  

I changed the urn to be unique on each line. Think of the urn as a folder path, it shows you where the menu items are located.

Hugo Vale
Datastream Custom Solutions
http://www.datastreamcs.com