contents   index   previous   next

interface: SEGetCallback


public boolean get(SEContext se, int prop, boolean call_hint);


The get callback is used when a member of the object's value is being accessed. It is also used when trying to determine if an object has a property if you have not implemented SEHasPropCallback (see below). Implementing SEHasPropCallback is the preferred method.


The prop parameter, a parameter to most of these dynamic callback functions, indicates which member of the SE.THIS object is to be accessed. Normally, you use seInternalizeString at the beginning of your program to internalize your special properties, then you can compare them with the property being accessed using a single integer comparison. The alternative is to turn prop into a String using seGetInternalString then compare with a String.equals, but this is a lot of work and must be done on each get operation.


call_hint is a boolean indicating if ScriptEase believes the returned value is going to be used as a function to call. This would be the difference between:


a =; /* call_hint==false */




a =; /* call_hint==true */


Knowing this information is useful in certain dynamic objects in which a property and a method require different setup routines, such as COM.


Once you've decided what value the dynamic property should have, you return it using the usual SE.RETURN object and return true from the function. If you've decided the property is not one you are interested in, return false. ScriptEase will act just as if the dynamic callback did not exist in this case, looking up the property in its internal storage for the object.


Note that you can access the internal storage of the object within your dynamic callback implementation. You should use the Direct versions of the seGetXXX and sePutXXX API calls in order to bypass your dynamic properties. If you use the non-Direct versions, the internal storage will be used for your object, but only for gets. This is because a particular callback for an object is shut off inside that callback, to prevent infinite recursion. However, only that one callback is shut off. If you use the object in a way that uses another callback, ScriptEase will use that callback. On rare occasions, you want that behavior. Most of the time, however, the implementation of a dynamic callback will want to directly access the members of its object. It is usually much clearer and quicker to just use the Direct versions of all ScriptEase API calls while implementing a dynamic callback.


interface: SEPutCallback