This module provides many functions to integrate scripted functionalities in the UI of Harmony.
Methods
(static) addAction(action)
This method defines an action that can be called by a menu, a shortcut or a toolbar button. Please note that callback functions must be quick if defined because they might have a performance impact on the whole application.
Example
// Defining the action
var toggleCoordinatesAction = {
id: "com.toonboom.toggleMouseCoordinateDisplay",
text: "Toggle Mouse Coordinates Display Settings",
icon: "earth.png",
checkable: true,
isEnabled: true,
isChecked: preferences.getBool("DRAWING_VIEW_SHOW_RAW_MOUSE_COORDINATES", false),
onPreferenceChanged: function () {
this.isChecked = preferences.getBool("DRAWING_VIEW_SHOW_RAW_MOUSE_COORDINATES", false);
},
onTrigger: function () {
this.isChecked = !this.isChecked;
preferences.setBool("DRAWING_VIEW_SHOW_RAW_MOUSE_COORDINATES", this.isChecked);
}
};
// Adding the action to the system
ScriptManager.addAction(toggleCoordinatesAction);
// Adding the action in a menu of Harmony
ScriptManager.addMenuItem({
targetMenuId: "View",
id: toggleCoordinatesAction.id,
text: toggleCoordinatesAction.text,
action: toggleCoordinatesAction.id
});
// Here is how to call the action from the Action object
Action.perform("onTriggerScriptAction(QString)", "ScriptManagerResponder", toggleCoordinatesAction.id);
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
action |
Object | The definition of the action.
Properties
|
(static) addShortcut()
This method adds a shortcut to the list of Harmony shortcuts.
(static) addToolbar(toolbar)
This method adds a toolbar to Harmony.
Parameters:
Name | Type | Description |
---|---|---|
toolbar |
ScriptToolbarDef | The toolbar to add |