SUJavaScript Class Reference

Handles JavaScripts in ShapeUp. More...

#include <ShapeUpAPI.h>

Inheritance diagram for SUJavaScript:

SUObject List of all members.

Public Member Functions

 SUJavaScript ()
 SUJavaScript (SUHANDLE hJavaScript)
void Run ()
void CallFunction (const char *func_name)
void Close ()

Detailed Description

An SUJavaScript object can be loaded using SUWorkspace::LoadJavaScript(). This script can then be executed via Run(), or a single function in the script may be called.
Note: When creating a JavaScript, ShapeUp will have to run it once to instanciate the function objects. This will have the side effect that any code at file level will be executed the first time the CallFunction() method is called, after which the desired function is called. You can either avoid this by not having any code at file level, or make use of it as an initialisation method. See the following example:
var myState1 = 0;
var myLayer = null;

function doSomething()
{
    myState++;
}

function init()
{
    myLayer = workspace.addNewLayer('Point');
    workspace.refresh();
}

// call to init() on file level, see SUJavaScript
init();


Constructor & Destructor Documentation

SUJavaScript::SUJavaScript (  )  [inline]

Default constructor.

SUJavaScript::SUJavaScript ( SUHANDLE  hJavaScript  )  [inline]

Constructor.

Parameters:
hJavaScript = handle to a ShapeUp JavaScript.
See also:
SUWorkspace::LoadJavaScript(), Workspace_LoadJavaScript()


Member Function Documentation

void SUJavaScript::Run (  )  [inline]

Executes a loaded JavaScript.

See also:
JavaScript_Run(), SUWorkspace::LoadJavaScript(), Workspace_LoadJavaScript()

void SUJavaScript::CallFunction ( const char *  func_name  )  [inline]

Executes a named function in a loaded JavaScript.

Todo:
There is currently no support for passing arguments to the function back and forth.
Parameters:
func_name = name of the function to execute.
See also:
JavaScript_CallFunction(), SUWorkspace::LoadJavaScript(), Workspace_LoadJavaScript()

void SUJavaScript::Close (  )  [inline]

Closes a loaded JavaScript.

See also:
JavaScript_Close(), SUWorkspace::LoadJavaScript(), Workspace_LoadJavaScript()


The documentation for this class was generated from the following file:
Generated on Thu Apr 15 10:55:35 2010 for ShapeUp API by  doxygen 1.5.2