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
- Start your application.
- Open application interface definition file, such as my_designer_desktop.xml, in a text editor.
- Find the first entry named <contextmenu>
- Before the first <contextmenu> entry, create a blank context menu entry as shown below:
- Set an appropriate name attribute. It should be similar to the C++ class name or C++ interaction mode name.
<contextmenu name="User Node"></contextmenu>
- 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>
- Save the XML file when you are finished.
- Close the XML file.
Display The Command Menu
- Start the application
- Select Desktop » Customize from the listed options.
- Left click the Menu tab.
- Notice the Default Menu is highlighted.
- Hit TAB on the keyboard.
- You created a command menu named User Node for class UserNode.
- Examine the Select Context Menu drop down list.
- Hit U on the keyboard. This displays the UserNode command menu.
- The command menu appears on the upper left corner of the interface. It's small and empty.
- This command menu is now ready to accept commands.
- Close the application and remove the command menu XML code if you wish to remove the new command menu.