Profile Picture

Disable menu items.

Posted By Steve Warner 14 Years Ago
Author
Message
Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Trudy,

The diagram command bars manager will automatically update the Enabled state of the UI command that is used as a visual front end of a certain NDiagramCommand, such as the NOpenDrawingCommand. That is why you cannot simply disable the UI command itself, because the diagram command bars manager will reset it to result of the underlying NDiagramCommand after a certain period of time. You can however override the NOpenDrawingCommand implementation like this:

...

NDiagramCommand cmd = manager.Commander.Commands.GetCommandFromId((int)DiagramCommand.OpenDrawing);
int index = manager.Commander.Commands.IndexOf(cmd);
manager.Commander.Commands.RemoveAt(index);
manager.Commander.Commands.Insert(index, new NMyOpenDrawingCommand());

...

public class NMyOpenDrawingCommand : NOpenDrawingCommand
{
   public override bool Enabled
   {
      get
      {
         return false;
      }
   }
}



Best Regards,
Nevron Support Team



Steve Warner
questionmark Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 15, Visits: 1
I need to be able to "gray out" or disable menu items, i.e. File->New. I need to be able to do this without rebuilding the entire CommandBars. I do not want to do it at time of building the Menu, like in the CustomMenuBuilder class. Is there a simple way of a disabling a menu item on the fly so that users will know not to press it?



Similar Topics


Reading This Topic