MenuBarManager Class — NXOpen Python API Reference 12.0.0 documentation

# MenuBarManager Class

class `NXOpen.MenuBar.``MenuBarManager`

  Bases: `object`

  Interface for the MenuBarManager object

  To obtain an instance of this class, refer to `NXOpen.UI`

  New in version NX6.0.0.

# Methods

Method | Description
--- | ---
AddMenuAction | Adds the action callback.
ApplicationSwitchRequest | Registers a request to switch to specified application and open the corresponding user environment.
GetButtonFromName | Finds the MenuButton associated with the given name
RegisterApplication | Registers the application
RegisterConfigureContextMenuCallback | Registers a callback that is called whenever a customizable context menu is about to be displayed.
UnregisterConfigureContextMenuCallback | Unregisters a callback for customizing context menus.

# Enumerations

MenuBarManagerCallbackStatus Enumeration | Return values for action callbacks

# Method Detail

## AddMenuAction

`MenuBarManager.``AddMenuAction`

  Adds the action callback.

  Signature `AddMenuAction(name, actionCallback)`

  Parameters:

  - name (str) – The name of the action. This name must match the string used in the .men file.
  - actionCallback (CallableObject) – The method to execute for this action

  New in version NX6.0.0.

  License requirements: None.

## ApplicationSwitchRequest

`MenuBarManager.``ApplicationSwitchRequest`

  Registers a request to switch to specified application and open the corresponding user environment.

  When the running journal or program finishes, the system will attempt to switch into the target application. The current application does not change immediately. The argument is an application button name as specified and registered in the ug_main.men file. For example specify UG_APP_MODELING to try to enter the modeling application. Button names registered for custom application as described in “Adding Custom Applications to NX” chapter of the NX Open Programmer’s Guide can also be used.

  Signature `ApplicationSwitchRequest(applicationName)`

  Parameters: | applicationName (str) – Button name of requested application

  New in version NX8.0.0.

  Deprecated since version NX11.0.0: Use `NXOpen.Session.ApplicationSwitchImmediate()` instead.

  License requirements: None.

## GetButtonFromName

`MenuBarManager.``GetButtonFromName`

  Finds the MenuButton associated with the given name

  Signature `GetButtonFromName(name)`

  Parameters: | name (str) – The name of the button. This name must match the button name used in the .men file.
  Returns: | The button associated with the given name
  Return type: | `NXOpen.MenuBar.MenuButton`

  New in version NX6.0.0.

  License requirements: None.

## RegisterApplication

`MenuBarManager.``RegisterApplication`

  Registers the application

  Signature `RegisterApplication(name, initializeCallback, enterCallback, exitCallback, supportsDrawings, supportsDesignInContext, supportsUndo)`

  Parameters:

  - name (str) – The name of the application. This name must match the string used in the .men file.
  - initializeCallback (CallableObject) – The method used to initialize the application
  - enterCallback (CallableObject) – The method called when entering the application
  - exitCallback (CallableObject) – The method called when exiting the application
  - supportsDrawings (bool) – Does this application support drawings?
  - supportsDesignInContext (bool) – Does this application support design in context?
  - supportsUndo (bool) – Does this application support undo?

  Returns: | Unique identifier for the registered application
  Return type: | int

  New in version NX6.0.0.

  License requirements: None.

## RegisterConfigureContextMenuCallback

`MenuBarManager.``RegisterConfigureContextMenuCallback`

  Registers a callback that is called whenever a customizable context menu is about to be displayed.

  Each callback is registered with a short name and a longer description which is used to identify the callback for debugging purposes.

  Signature `RegisterConfigureContextMenuCallback(name, description, configurePopupMenu)`

  Parameters:

  - name (str) – A short string identifying the callback
  - description (str) – A longer string describing the operation of the callback
  - configurePopupMenu (CallableObject) – Callback to register

  Returns: | Identifier of registered callback
  Return type: | int

  New in version NX8.5.0.

  License requirements: None.

## UnregisterConfigureContextMenuCallback

`MenuBarManager.``UnregisterConfigureContextMenuCallback`

  Unregisters a callback for customizing context menus.

  Signature `UnregisterConfigureContextMenuCallback(id)`

  Parameters: | id (int) – Identifier for callback to unregister

  New in version NX8.5.0.

  License requirements: None.