- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Static Public Member Functions

# MEventMessage Class Reference

# OpenMaya - API module for common classes

Search for all occurrences

## Detailed Description

Event messages.

This class is used to register callbacks for specific events.

The first parameter passed to the add callback method is the name of the event that will trigger the callback. The list of available event names can be retrieved by calling the getEventNames method or by using the -listEvents flag on the scriptJob command.

The add callback method returns an id which is used to remove the callback.

To remove a callback use MMessage::removeCallback.

All callbacks that are registered by a plug-in must be removed by that plug-in when it is unloaded. Failure to do so will result in a fatal error.

`#include <MEventMessage.h>`

Inheritance diagram for MEventMessage:
[legend]

List of all members.

## Static Public Member Functions
static MCallbackId | addEventCallback (const MString &event, MMessage::MBasicFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| This method registers a callback for event occurred messages.
static MStatus | getEventNames (MStringArray &names)
| This method returns the list of available event names.
static const char * | className ()
| Returns the name of this class.

## Member Function Documentation

MCallbackId addEventCallback | ( | const MString & | eventName,
|  | MMessage::MBasicFunction | func,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

This method registers a callback for event occurred messages.

The callback function will be passed the any client data that was provided when the callback was registered.

Parameters:

  [in] | eventName | the event to register the callback for
  [in] | func | the callback function

- clientData User defined data passed to the callback function

Parameters:

  [in] | clientData | User defined data that will be passed to the callback function
  [out] | ReturnStatus | status code

Returns:
  Identifier used for removing the callback.

Status Codes:
  - MS::kSuccess Operation succeeded
  - MS::kUnknownParameter The named event could not be found
  - MS::kInsufficientMemory No memory available
  - MS::kFailure Error adding callback

Examples:
  eventTest.cpp, and undoRedoMsgCmd.cpp.

MStatus getEventNames | ( | MStringArray & | names | ) | `[static]`

Search for all occurrences

This method returns the list of available event names.

Parameters:

  [out] | names | set to the array of available event names.

Returns:
  - MS::kSuccess Operation succeeded
  - MS::kInsufficientMemory No memory available
  - MS::kFailure Error retrieving event names

Examples:
  eventTest.cpp.

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  The name of this class.

Reimplemented from MMessage.

MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage
MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage MEventMessage