CustomPopupMenuHandler Class — NXOpen Python API Reference 12.0.0 documentation

# CustomPopupMenuHandler Class

class `NXOpen.``CustomPopupMenuHandler`

  Bases: `NXOpen.TransientObject`

  Represents Custom Popup Menu Handler class

  New in version NX6.0.4.

# Methods

Method | Description
--- | ---
AddMenu | Adds and returns a menu to the COTS (Commercial, off-the-shelf) RMB menu
AddMenuItem | Adds and returns a menu item to the COTS (Commercial, off-the-shelf) RMB menu
AddMenuSeparator | Adds a separator to the COTS (Commercial, off-the-shelf) RMB menu
Dispose | Frees the object from memory.
GetInvokedCommand | Returns the menu item for the command invoked
GetSelectedNodes | Returns a list of node(s) selected during a RMB click.
RegisterAddCustomPopupMenuCallback | Registers the add_custom_popup_menu_callback callback method with the popup menu handler object.
RegisterCustomPopupMenuInvokedCallback | Registers the add_custom_popup_menu_callback callback method with the popup menu handler object.

# Method Detail

## AddMenu

`CustomPopupMenuHandler.``AddMenu`

  Adds and returns a menu to the COTS (Commercial, off-the-shelf) RMB menu

  Signature `AddMenu(menuId, menuName)`

  Parameters:

  - menuId (int) – Id of the menu
  - menuName (str) – name of the menu

  Returns: | menu
  Return type: | `NXOpen.CustomPopupMenu`

  New in version NX6.0.4.

  License requirements: None.

## AddMenuItem

`CustomPopupMenuHandler.``AddMenuItem`

  Adds and returns a menu item to the COTS (Commercial, off-the-shelf) RMB menu

  Signature `AddMenuItem(menuItemId, menuItemName)`

  Parameters:

  - menuItemId (int) – Id of the menu item
  - menuItemName (str) – name of the menu item

  Returns: | menu item
  Return type: | `NXOpen.CustomPopupMenuItem`

  New in version NX6.0.4.

  License requirements: None.

## AddMenuSeparator

`CustomPopupMenuHandler.``AddMenuSeparator`

  Adds a separator to the COTS (Commercial, off-the-shelf) RMB menu

  Signature `AddMenuSeparator()`

  New in version NX6.0.4.

  License requirements: None.

## Dispose

`CustomPopupMenuHandler.``Dispose`

  Frees the object from memory.

  After this method is called, it is illegal to use the object. In .NET, this method is automatically called when the object is deleted by the garbage collector.

  Signature `Dispose()`

  New in version NX6.0.4.

  License requirements: None.

## GetInvokedCommand

`CustomPopupMenuHandler.``GetInvokedCommand`

  Returns the menu item for the command invoked

  Signature `GetInvokedCommand()`

  Returns: | menu item
  Return type: | `NXOpen.CustomPopupMenuItem`

  New in version NX6.0.4.

  License requirements: None.

## GetSelectedNodes

`CustomPopupMenuHandler.``GetSelectedNodes`

  Returns a list of node(s) selected during a RMB click.

  Customer can call this query API inside the implementation of `NXOpen.CustomPopupMenuHandler.AddCustomPopupMenuCallback` or `NXOpen.CustomPopupMenuHandler.CustomPopupMenuInvokedCallback` to obtain additional information

  Signature `GetSelectedNodes()`

  Returns: | Selected Nodes
  Return type: | list of `NXOpen.TreeListNode`

  New in version NX6.0.4.

  License requirements: None.

## RegisterAddCustomPopupMenuCallback

`CustomPopupMenuHandler.``RegisterAddCustomPopupMenuCallback`

  Registers the add_custom_popup_menu_callback callback method with the popup menu handler object.

  Signature `RegisterAddCustomPopupMenuCallback(popupCb)`

  Parameters: | popupCb (CallableObject) –

  New in version NX6.0.4.

  License requirements: None.

## RegisterCustomPopupMenuInvokedCallback

`CustomPopupMenuHandler.``RegisterCustomPopupMenuInvokedCallback`

  Registers the add_custom_popup_menu_callback callback method with the popup menu handler object.

  Signature `RegisterCustomPopupMenuInvokedCallback(popupCb)`

  Parameters: | popupCb (CallableObject) –

  New in version NX6.0.4.

  License requirements: None.