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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends

# MPxControlCommand Class Reference

# OpenMayaUI - API module for user interface | Proxy classes

Search for all occurrences

## Detailed Description

Base class for control creation commands.

MPxControlCommand is the base class for user defined UI control commands. This command gives all of the flags and options of the base control command in addition to any user defined flags or behaviours. When registering this command, use the MFnPlugin::registerControlCommand() method. All control commands have a corresponding MPxUIControl. It is important to note that a given MPxControlCommand is reponsible for only ONE MPxUIControl.

`#include <MPxControlCommand.h>`

List of all members.

## Public Member Functions
| MPxControlCommand ()
| Class constructor.
virtual | ~MPxControlCommand ()
| Class destructor.
virtual MPxUIControl * | makeControl ()=0
| This method is called when the UI control should be created.
virtual MStatus | doEditFlags ()
| This method is called when the command is called in edit mode.
virtual MStatus | doQueryFlags ()
| This method is invoked during query mode, and the default method should be overridden in user-defined control commands to determine which query flags are set in conjunction with the argument parser for the command.
virtual MStatus | appendSyntax ()
| This method should be overridden to append syntax to the control command.
virtual bool | skipFlagForCreate (const MString &longFlag)
| Returns true if the passed long flag name should be skipped during the creation portion of the command.
void | clearResult ()
| This method should be called to clear the result to be output by the command.
MStatus | setResult (bool result)
| This method should be called when the result of the control command is a boolean.
MStatus | setResult (int result)
| This method should be called when the result of the control command is an integer.
MStatus | setResult (double result)
| This method should be called when the result of the control command is a double.
MStatus | setResult (const MString &result)
| This method should be called when the result of the control command is a string.
MStatus | setResult (const MStringArray &result)
| This method should be called when the result of the control command is a string array.
MStatus | setResult (const MIntArray &result)
| This method should be called when the result of the control command is a integer array.
## Static Public Member Functions
static const char * | className ()
| Returns the name of this class.
## Protected Member Functions
MPxUIControl * | control (MStatus *ReturnStatus=NULL)
| USE _control() IN SCRIPT.
MSyntax | syntax (MStatus *ReturnStatus=NULL) const
| USE _syntax() IN SCRIPT.
MArgParser | parser (MStatus *ReturnStatus=NULL) const
| USE _parser() IN SCRIPT.
## Friends Search for all occurrences
class | MPxUIControl Search for all occurrences
class | MPxUITableControl Search for all occurrences

## Member Function Documentation

MPxUIControl * makeControl | ( |  | ) | `[pure virtual]`

Search for all occurrences

This method is called when the UI control should be created.

You need to create a new MPxUIControl on call to this method (the base implementation is abstract, so that the compiler will force you to define an implementation of this method).

Returns:
  - NULL - unable to create the UI control for this command.
  - pointer to control - ui control successfully created.

MStatus doEditFlags | ( |  | ) | `[virtual]`

Search for all occurrences

This method is called when the command is called in edit mode.

This method should be overridden by control commands to determine which edit flags are set in conjunction with the argument parser for this command. The argument parser for this command can be obtained by calling the parser method.

If the command is called with both the edit flag and the query flag, then the query flag will be ignored.

If the command returns MS::kUnknownParameter, the flag is processed by the parent class.

Returns:
  - MS::kSuccess operation successful
  - MS::kUnknownParameter pass to the parent class
  - MS::kFailure operation failed

MStatus doQueryFlags | ( |  | ) | `[virtual]`

Search for all occurrences

This method is invoked during query mode, and the default method should be overridden in user-defined control commands to determine which query flags are set in conjunction with the argument parser for the command.

The argument parser for this command can be obtained by calling the parser method. If the command is called with both the edit flag and the query flag, then the query flag will be ignored.

If the command returns MS::kUnknownParameter, the flag is processed by the parent class.

Returns:
  - MS::kSuccess operation successful
  - MS::kUnknownParameter pass to the parent class
  - MS::kFailure operation failed

MStatus appendSyntax | ( |  | ) | `[virtual]`

Search for all occurrences

This method should be overridden to append syntax to the control command.

The syntax object can be obtained by calling the syntax method. The following flags cannot be used as user-defined flags as they are reserved for edit and query: "-e", "-edit", "-q", "-query".

Returns:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

bool skipFlagForCreate | ( | const MString & | longFlag | ) | `[virtual]`

Search for all occurrences

Returns true if the passed long flag name should be skipped during the creation portion of the command.

Parameters:

  [in] | longFlag | The string containing the long flag name.

Returns:
  true if the flag shoiuld be skipped during creation.

Status Codes:
  - MS::kSuccess Operation successful

MStatus setResult | ( | bool | result | ) |

Search for all occurrences

This method should be called when the result of the control command is a boolean.

Parameters:

  [in] | result | the boolean result

Returns:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MStatus setResult | ( | int | result | ) |

Search for all occurrences

This method should be called when the result of the control command is an integer.

Parameters:

  [in] | result | the integer result

Returns:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MStatus setResult | ( | double | result | ) |

Search for all occurrences

This method should be called when the result of the control command is a double.

Parameters:

  [in] | result | the double result

Returns:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MStatus setResult | ( | const MString & | result | ) |

Search for all occurrences

This method should be called when the result of the control command is a string.

Parameters:

  [in] | result | the string result

Returns:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MStatus setResult | ( | const MStringArray & | result | ) |

Search for all occurrences

This method should be called when the result of the control command is a string array.

Parameters:

  [in] | result | the string result

Returns:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MStatus setResult | ( | const MIntArray & | result | ) |

Search for all occurrences

This method should be called when the result of the control command is a integer array.

Parameters:

  [in] | result | the integer array result

Returns:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

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

Search for all occurrences

Returns the name of this class.

Returns:
  Name of this class.

MPxUIControl * control | ( | MStatus * | ReturnStatus = `NULL` | ) | `[protected]`

Search for all occurrences

USE _control() IN SCRIPT.

Returns the control instance.

All UI commands require the name of the UI control as the last argument. This name is stored in a table that has the pointer to the control. When the command is executed, the pointer is retrieved. You should only call this method in the doEditFlags & doQueryFlags. All other cases are invalid.

Parameters:

  [out] | ReturnStatus | return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MSyntax syntax | ( | MStatus * | ReturnStatus = `NULL` | ) | const `[protected]`

Search for all occurrences

USE _syntax() IN SCRIPT.

This method returns the syntax object of this control command.

The syntax object can be appended to in an overridden version of the appendSyntax method.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  - the syntax object

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MArgParser parser | ( | MStatus * | ReturnStatus = `NULL` | ) | const `[protected]`

Search for all occurrences

USE _parser() IN SCRIPT.

This method returns the argument parser of this control command.

The argument parser can be used in the overridden versions of doEditFlags and doQueryFlags to determine which flags are set.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  The argument parser

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand
MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand MPxControlCommand