XMLSpyControl.MainMenu

www.altova.com Imprimer cette rubrique Page précédente Un niveau supérieur Page suivante

Accueil >  Programmers' Reference > ActiveX Integration > Object Reference > XMLSpyControl > Properties >

XMLSpyControl.MainMenu

Property: MainMenu as Command (read-only)

 

Dispatch Id: 1003

 

Description:

This property provides information about the structure and commands available in the XMLSpyControl main menu, as a Command object. The Command object contains all available submenus of XMLSpy (for example "File", "Edit", "View" etc.). To access the submenu objects, use the SubCommands property of the MainMenu property. Each submenu is also a Command object. For each submenu, you can then further iterate through their SubCommands property in order to get their corresponding child commands and separators (this technique may be used, for example, to create the application menu programmatically). Note that some menu commands act as containers ("parents") for other menu commands, in which case they also have a SubCommands property. To get the structure of all menu commands programmatically, you will likely need to create a recursive function.

 

 

public void GetXmlSpyMenus()
{
  // Get the main menu from the XMLSpy ActiveX control assigned to the current form
  XMLSpyControlLib.XMLSpyCommand mainMenu = this.axXMLSpyControl1.MainMenu;
 
  // Loop through entries of the main menu (e.g. File, Edit, etc.)  
  for (int i = 0; i < mainMenu.SubCommands.Count; i++)
  {
    XMLSpyControlLib.XMLSpyCommand menu = mainMenu.SubCommands[i];
    Console.WriteLine("{0} menu has {1} children items (including separators)", menu.Label.Replace("&", ""), menu.SubCommands.Count);
  }
}

C# example


© 2018 Altova GmbH