Adding custom commands to the MenuBar


Author
Message
Arthur Warren
Arthur Warren
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)
Group: Forum Members
Posts: 9, Visits: 1
I've been able to create a new command and add that command to an existing toolbar or a new toolbar by implementing my own overrides of NDiagramToolbarsBuilder, but I don't see a simple way / similar to add to the existing menus. Can I get a reference to the "File" or "View" menu to add my own commands in, or what is the easiest way to do this?

Thanks,
Herb.
Reply
Arthur Warren
Arthur Warren
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)
Group: Forum Members
Posts: 9, Visits: 1
I may have found a way - might not be the easiest.

I've made a new class inheriting from NDiagramMainMenuBuilder and making up the list of commands from it from scratch, adding my own in where I need them, and removing ones where I don't want them.

Unfortunately, the base properties (FileCommandIds, EditCommandIds, etc) that return the command ids all throw an exception:

System.InvalidCastException was unhandled
Message="At least one element in the source array could not be cast down to the destination array type."
Source="mscorlib"
StackTrace:
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
at System.Collections.ArrayList.ToArray(Type type)
at Nevron.Diagram.WinForm.Commands.NDiagramMainMenuBuilder.get_FileCommandIds()

For now, I've gone through all the values in the DiagramCommand enumeration and have overridden all of NDiagramMainMenuBuilder, as I needed to get these properties.

That said, if there's a better way to customize the menu than this, I'd love to hear it.

Thanks,
Herb.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search