Class Hierarchy
AcRxObject AcEdUIContext
C++
class AcEdUIContext : public AcRxObject;
File
aced.h
Description
This class is used by ObjectARX applications to add items to AutoCAD shortcut (context) menus.
When no command is running, there is no pick first selection set, and the user right-clicks for a shortcut menu, the menu will contain some standard items read from the CMDEFAULT POP menu in the CUI file. If there are loaded ObjectARX applications that wish to append items to this shortcut menu, they can do so. Any number of loaded ObjectARX applications can supply HMENUs and callback functions for items that will appear in the shortcut menu as a submenu. The top-level item (submenu name) will be the name of the ObjectARX application if no submenu name is provided. The ObjectARX application must return an HMENU* when AutoCAD calls the getMenuContext() member function of the AcEdUIContext object that the application has added. If the user picks one of these appended items, AutoCAD calls the onCommand() member function of the AcEdUIContext object with the ID associated with that item that was in the HMENU provided as the argument.
Use acedAddDefaultContextMenu() to add an AcEdUIContext instance to the default mode shortcut menu, and acedRemoveDefaultContextMenu() to remove one.
When a pick first selection set exists and the user right clicks for a shortcut menu, the menu will contain some standard items read from the CMEDIT POP menu in the CUI file. In addition, the selected object(s) can append items to the menu. Each AcRxClass in the hierarchy of an object can contain an AcEdUIContext object. The shortcut menu code determines a common parent for all objects in the selection set. Starting with that class and going up the class hierarchy, it queries each class for an AcEdUIContext object and then appends items to the shortcut menu from the supplied HMENU. In this way, each class in an object's class hierarchy can contribute items to a shortcut menu. The ObjectARX application must return an HMENU* when AutoCAD calls the getMenuContext() member function of the AcEdUIContext object it retrieves from the class hierarchy. If the user picks one of these appended items, AutoCAD calls the onCommand() member function of the AcEdUIContext object for the object that provided the menu item, using the ID associated with that item in the HMENU as the argument.
Use acedAddObjectContextMenu() to add an AcEdUIContext instance to an object, and acedRemoveObjectContextMenu() to remove one.
When an ObjectARX command is running and the user right clicks for a shortcut menu, the menu will contain some standard items read from the CMCOMMAND POP menu in the CUI file. In addition, if the command prompt issued by the ObjectARX application has command options in it and the command prompt uses the standard syntax, these options will appear as individual items in the shortcut menu. When the user picks a command option from the shortcut menu, the option keyword will be sent to the current command throat. These command options are always added to the shortcut menu and the ObjectARX developer need only provide a command prompt in standard form to get this functionality.
If the ObjectARX application wishes to append additional items to the shortcut menu for a particular command, it must supply an HMENU* and a callback function to AutoCAD. An AcEdUIContext object for an ObjectARX command object is specified using the UIContext argument of AcEdCommandStack::addCommand. The ObjectARX application must return an HMENU* when AutoCAD calls the getMenuContext() member function of the AcEdUIContext object it retrieves from the ObjectARX command object. The menu items in the HMENU provided are appended to the shortcut menu for that command. If the user picks one of these appended items, AutoCAD calls the onCommand() member function of the AcEdUIContext object for that command with the ID associated with that item that was in the HMENU provided as the argument.
Notes
There is no limit on the number of menu items, but items should contain only text. Cascading menus are allowed. Shortcut menu items provided by ObjectARX applications should contain no keyboard accelerators. No status line menu item help is displayed for these added items.
Links
See Also
acedAddDefaultContextMenu(), acedRemoveDefaultContextMenu(), acedAddObjectContextMenu(), acedRemoveObjectContextMenu(), AcEdCommandStack::addCommand