Is there a way to disable / hide a menu item?

I´ve been trying to hide / disable the “File-> New -> New Debit Memo” item from the Menu bar in AP Invoice Entry. Also, I`ve been trying to do the same thing in the “Standard Tool bar” but unfortunately tool bars are not customizable.

I know the method I want to block is: GetNewAPInvHedDebitMemo, any suggestions?

1 Like

You could create a method directive against it and throw an exception.

1 Like

Or Process/Service Security could also be used against that method.

3 Likes

Thank you Chris. that make the trick.

1 Like

Thank you Nathan,

I´ve just created a method directive and that did the trick, later today I will try the process/security option.

1 Like

Could you share some code examples or snippets.

If you want to just disable the menu\tool

requires these using statements:

using Infragistics.Win.UltraWinGrid;
using System.Reflection;

In this example I am on TimeExpenseForm. You must know key of your tool

{

	var obj= TimeExpenseForm.GetType().InvokeMember("baseToolbarsManager", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic, null, TimeExpenseForm, null);
	var tools = (Infragistics.Win.UltraWinToolbars.UltraToolbarsManager)obj;


	if(tools.Tools.Exists("CopyTool"))
	{
 		tools.Tools["CopyTool"].SharedProps.Enabled = false;
	}
}

In a pinch you can get a list of a all tool names

var obj= TimeExpenseForm.GetType().InvokeMember("baseToolbarsManager", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic, null, TimeExpenseForm, null);
var tools = (Infragistics.Win.UltraWinToolbars.UltraToolbarsManager)obj;

string toolnames = "";
forearch(var t in tools.Tools)
{
    toolnames += t.Keys +" , ";
}

MessageBox.Show(toolnames);
7 Likes

@asmar

No code required. Create a Method Directive on the desired method you want to stop.

Add Exception block

Set params and make sure Terminate on Error is checked

@Ruben_Corral_Yrureta Mark solution please :slight_smile:

1 Like

Thank you Chris

1 Like

Should be t.Key not t.Keys.

1 Like

I am trying to replicate your form customization code for the Time and Expense form. I am able to get the list of main menus using the code you provided. Very Nice. However, in your case you disabled the copy tool? I am running 10.1.400 and I don’t see the CopyTool. In my case, how will I get/reference the list of sub-menu(s) and all items such as New> New Time …using the example you provided?

I placed the code you provided in the Form load event and that produced a much longer list of menu items. This maybe the root cause of my issue.

1 Like

1 Like

Wow its working know. I tested this from the Supplier Maintenance screen (load form event). I confirmed that the menu “New Suppliers” does get grayed out from the File> New> New Supplier and from the File icon (blank sheet) menu drop down. However, if you click on the blank sheet (not drop down arrow) a new row iemptysheeticonmenuemptysheeticonmenu2s inserted for a new supplier.

1 Like