Action Class Reference

The Action JavaScript global object. Trigger action associated to menu or tool bar items. More...

Public Slots

void perform (String &slot)
 Perform the requested action (slot - menu item, toolbar item,...) More...
 
void perform (String &slot, String &responder)
 Perform the requested action (slot - menu item, toolbar item,...) More...
 
void perform (String &slot, String &responder, QVariant parameters)
 Execute an action using the action manager on the given responder with parameters. More...
 
void performForEach (String &slot, String &responder)
 Execute an action using the action manager on all responder instances. More...
 
QVariant validate (String &slot)
 Validate the requested action (slot - menu item, toolbar item,...) More...
 
QVariant validate (String &slot, String &responder)
 Validate the requested action (slot - menu item, toolbar item,...) More...
 
StringList getResponderList ()
 Retrieve the list of responder names. More...
 
StringList getActionList (String &responder)
 Retrieve the list of actions for a given responder. More...
 

Detailed Description

The Action JavaScript global object. Trigger action associated to menu or tool bar items.

Call either global actions or actions associated to a specific responder.

function callAbout()
{
// Call the global action onActionAbout() which will show the About dialog.
Action.perform("onActionAbout()");
}
function callDisable3DSubnode()
{
// Validate if the action is available right now. In this example, it will fail if no subnode is selected.
if(Action.validate("onActionHideSubNode()", "graph3dresponder").isEnabled)
{
// Call the hide subnode action from the 3D Graph menu (or toolbar).
Action.perform("onActionHideSubNode()", "graph3dresponder");
}
}

Member Function Documentation

◆ getActionList

StringList Action::getActionList ( String &  responder)
slot

Retrieve the list of actions for a given responder.

Parameters
responderresponder identity to investigate.

Example usage:

var aList = Action.getActionList("Node View");
for(var i=0; i < aList.length; ++i)
{
MessageLog.trace( "availableAction=" + aList[i] );
}

◆ getResponderList

StringList Action::getResponderList ( )
slot

Retrieve the list of responder names.

Example usage:

var rList = Action.getResponderList();
for(var i=0; i < rList.length; ++i)
{
MessageLog.trace( "ResponderIdentity=" + rList[i] );
}

◆ perform [1/3]

void Action::perform ( String &  slot)
slot

Perform the requested action (slot - menu item, toolbar item,...)

Perform the requested action for the main application responder. If the main responder doesn't own the requested action, try to use the current view with focus as the responder.

Action.perform("onActionAbout()");
Parameters
slotThe action function name (ex: onMyAction()).

◆ perform [2/3]

void Action::perform ( String &  slot,
String &  responder 
)
slot

Perform the requested action (slot - menu item, toolbar item,...)

Perform the requested action for a specific responder.

Action.perform("onActionToggleApplyToolToAllLayers()", "drawingView");
Parameters
slotThe action function name (ex: onMyAction()).
responderThe responder to the function name (ex: drawingView).

◆ perform [3/3]

void Action::perform ( String &  slot,
String &  responder,
QVariant  parameters 
)
slot

Execute an action using the action manager on the given responder with parameters.

Parameters
slotaction to execute. See Action.getActionList() for action list.
respondercommand target. See Action.getResponderList() for responder list.
parametersaction parameter(s). Use an array [] to provide multiple action parameters.

Example usage:

Action.perform("onActionShowDeformer(String)","miniPegModuleResponder", "Top/Deformation-Drawing" );

◆ performForEach

void Action::performForEach ( String &  slot,
String &  responder 
)
slot

Execute an action using the action manager on all responder instances.

Parameters
slotaction to execute. See Action.getActionList() for action list.
respondercommand target. See Action.getResponderList() for responder list.

Example usage:

Action.perform("onActionFocusOnSelectionNV()", "Node View");

◆ validate [1/2]

QVariant Action::validate ( String &  slot)
slot

Validate the requested action (slot - menu item, toolbar item,...)

Validate the requested action for the main application responder. If the main responder doesn't own the requested action, try to use the current view with focus as the responder.

var validateData = Action.validate("onActionAbout()");
Parameters
slotThe action function name(ex : onMyAction()).
Returns
A script object that has the isValid, enabled and checked boolean properties.

◆ validate [2/2]

QVariant Action::validate ( String &  slot,
String &  responder 
)
slot

Validate the requested action (slot - menu item, toolbar item,...)

Validate the requested action for a specific responder.

// Toggle on the Apply Tool to Line and Colour Art option only if it's off.
var validateData = Action.validate("onActionToggleApplyToolToAllLayers()", "drawingView");
if(!validateData.checked)
Action.perform("onActionToggleApplyToolToAllLayers()", "drawingView");
// Validate that the action "Create New Deformation Chain" is currently executable.
var validateData = Action.validate("onActionCreateNewDeformationChain()", "miniPegModuleResponder");
if(!(validateData.isValid && validateData.enabled))
MessageLog.trace("The desired action is unavailable, please select an element node");
Parameters
slotThe action function name (ex: onMyAction()).
responderThe responder to the function name (ex: drawingView).
Returns
A script object that has the isValid, enabled and checked boolean properties.