tagSUJavaScriptInvokeHookData Struct Reference

#include <ShapeUpAPI.h>

List of all members.

Public Attributes

SUHookData hd
const char * name
DWORD flags
size_t argc
const SUJavaScriptArgumentargs
size_t retc
SUJavaScriptArgumentrets


Detailed Description

This is an example of how to construct the return values.
    // Let's return 2 values, a shape and a string, to the calling JavaScript
    // (Error handling omitted for simplicity)

    SUJavaScriptInvokeHookData *args; // From the hook function
    SUHANDLE hWorkspace;              // From the hook function

    args->retc = 2;
    ShapeUp_Allocate(sizeof(SUJavaScriptArgument) * args->retc, (void**)&args->rets);

    args->rets[0].type = DT_SUHANDLE;
    args->rets[0].handleVal = SUWorkspace(hWorkspace).GetTheme(0).GetShape(0);

    args->rets[1].type = DT_STRING;
    args->rets[1].stringVal = ShapeUp_DuplicateString("A string");
The return value is by default treated as an Array of values, even if there is only one element. To avoid this if the intention is just to return one value, set the flags member of SUJavaScriptInvokeHookData to include JSIHDF_TREATRETURNASSINGLEVALUE.

The following return values are supported:

Note:
It's important to use ShapeUp_Allocate() or one of its relatives to allocate memory for the return values since ShapeUp will deallocate the structure.
The hook function can return any of:
See also:
ShapeUp_Allocate(), ShapeUp_DuplicateString()
Examples:

example_javascriptable.cpp.


Member Data Documentation

SUHookData tagSUJavaScriptInvokeHookData::hd

SUHookData header.

const char* tagSUJavaScriptInvokeHookData::name

Contains the name of the property or method being invoked.

Examples:
example_javascriptable.cpp.

DWORD tagSUJavaScriptInvokeHookData::flags

See JavaScriptInvokeHookDataFlags for appropriate values.

size_t tagSUJavaScriptInvokeHookData::argc

Count of the arguments pointed to by args.

Examples:
example_javascriptable.cpp.

const SUJavaScriptArgument* tagSUJavaScriptInvokeHookData::args

Argument array containing the data sent to the plug-in.

Examples:
example_javascriptable.cpp.

size_t tagSUJavaScriptInvokeHookData::retc

Count of the return values pointed to by rets. Filled in by the GPI.

Examples:
example_javascriptable.cpp.

SUJavaScriptArgument* tagSUJavaScriptInvokeHookData::rets

Return array containing the data sent back to the JavaScript. Filled in by the GPI.

Examples:
example_javascriptable.cpp.


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