Create A New Command Menu

New command menus are only required when a programmer adds a new interaction mode or hierarchy node. New command menus must be added directly to the XML file. This exercise shows you how to create a new command menu although you won't be able to use in inside an application. DO NOT complete this exercise unless you are comfortable using a text editor to make changes to XML or C++ code!

Implement The Command Menu XML Code

  1. Start your application.
  2. Open application interface definition file, such as my_designer_desktop.xml, in a text editor.
  3. Find the first entry named <contextmenu>
  4. Before the first <contextmenu> entry, create a blank context menu entry as shown below:
    <contextmenu></contextmenu>
  5. Set an appropriate name attribute. It should be similar to the C++ class name or C++ interaction mode name.
    <contextmenu name="User Node"></contextmenu>
  6. Set the class attribute to the C++ class name of the new hierarchy node or interaction mode. This must exactly match the C++ class name. For this example, we're using a fictional class named UserNode.
    <contextmenu name="User Node" class="UserNode"></contextmenu>
  7. Save the XML file when you are finished.
  8. Close the XML file.

Display The Command Menu

  1. Start the application
  2. Select Desktop » Customize from the listed options.
  3. Left click the Menu tab. This is a picture of the customization center Menu tab.
  4. Notice the Default Menu is highlighted.
  5. Hit TAB on the keyboard.
  6. You created a command menu named User Node for class UserNode.
  7. Examine the Select Context Menu drop down list.
  8. Hit U on the keyboard. This displays the UserNode command menu.
  9. The command menu appears on the upper left corner of the interface. It's small and empty. This is a picture of the new, empty command menu.
  10. This command menu is now ready to accept commands.
  11. Close the application and remove the command menu XML code if you wish to remove the new command menu.