Rogue Wave Views 5.5.1 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
User accessor whose behavior is implemented by a script. More...
#include <ilviews/protos/jsacc.h>
Public Member Functions | |
IlvJavaScriptAccessor (const char *name, const IlvValueTypeClass *type, IlvDisplay *display, const char *setScriptName, const char *getScriptName) | |
Creates a script accessor of name name and type type. | |
virtual void | initialize (const IlvAccessorHolder *object) |
Attachment method to an IlvAccessorHolder . | |
Protected Member Functions | |
virtual IlBoolean | changeValue (IlvAccessorHolder *object, const IlvValue &val) |
Called by the method IlvAccessible::changeValue for each IlvAccessor attached to the IlvAccessorHolder . | |
virtual IlvValue & | queryValue (const IlvAccessorHolder *object, IlvValue &val) const |
Called by the method IlvAccessible::queryValue for each IlvAccessor attached to the IlvAccessorHolder . |
User accessor whose behavior is implemented by a script.
Library: ilvproto
Lets you program the behavior of your prototypes using the scripting language interpreter supplied with Rogue Wave Views.
IlvJavaScriptAccessor::IlvJavaScriptAccessor | ( | const char * | name, | |
const IlvValueTypeClass * | type, | |||
IlvDisplay * | display, | |||
const char * | setScriptName, | |||
const char * | getScriptName | |||
) |
Creates a script accessor of name name and type type.
When the name property of the prototype is set, the script function setScriptName is executed by the script interpreter. This script function must have the following signature:
function SetName(obj, newval) { ... }
If setScriptName is equal to the string "none"
, no script function is executed when the property is set. When the name property of the prototype is retrieved, the script function getScriptName is executed by the script interpreter, and its return value is returned as the value of the property. This script function must have the following signature:
function GetName(obj)
{
...
return(val);
}
If getScriptName is equal to the string "none"
, no script function is executed when the property is retrieved. The script functions must be defined in the global context of the script interpreter.
Naming conflicts can occur if you load several prototypes with script accessors that use the same function names. Therefore, it is recommended to prefix all the function names of prototype scripts with the name of the prototype they belong to. For instance, in the samples.thermo prototype, if the Temp value has a Script accessor, its functions should be called SamplesThermoTempGet() and SamplesThermoTempSet().
When the script accessor is attached to a prototype, it tries to load a script file <prototype name>="">.ijs
(where <prototype name>="">
is the name of the prototype) from the directory or the prototype library file that contains the prototype definition. This script file should contain the definitions of the script functions. When a prototype is designed using Prototype Studio, the script functions associated with a script accessor can be edited in the script editor of Rogue Wave Views Studio. The script file is saved and loaded automatically to the appropriate location. When you use script accessors in your prototypes, you must make sure that the Rogue Wave Views Script interpreter is linked in the final application. For this, you must include the file: ilviews/jvscript/script.h
. This include file is added automatically by Rogue Wave Views Studio when you generate an application that uses prototypes.
virtual void IlvJavaScriptAccessor::initialize | ( | const IlvAccessorHolder * | object | ) | [virtual] |
Attachment method to an IlvAccessorHolder
.
This method is called when the accessor object is attached to a group. You can redefine it in subclasses of IlvUserAccessor
to perform any kind of initialization.
object | The object the accessor is attached to. |
Reimplemented from IlvUserAccessor.
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.