contents   index   previous   next



We've seen how to make class objects constructors, and prototype functions. However, it is often desirable to produce objects that are more flexible than a standard object. For instance, you may want to map the object to a real entity in your application and have changes to it immediately reflected. You might want to map an object to your display screen such that when a user writes:


displayObj.background = BLUE;


Your screen changes to the color blue. You do this using dynamic objects. While dynamic objects are most often used to make flexible class members, any object can be dynamic not just members of a class.


Very often you will want to associate one or more Java Objects directly with your object, so that when your wrapper function retrieve that object that can also retrieve the Java Object. Using seGetPointer() and sePutPointer() along with either SE.HIDDEN_MEM or SE.HIDDEN_UNIMEM or with an seInternalizeStringHidden property, is an excellent way to keep the data on your Java side safe from the script code and always associated with the proper objects.


SciptEase provides a related group of callback interfaces you can implement. The object which implements the interfaces is then associated with your object using the seSetCallbacks API function. Normally, you do this in your constructor when initializing an object of your class. These are interfaces for all the object manipulation tasks such as getting a member, putting a value to a member, deleting a member, etc.


Your callbacks will override the normal behavior for the object. To implement the above example, you would override the put behavior of the displayObj object. Your code would check for your special property background and changing the screen color to match the color being put to that member. You can override only some of the behaviors by implementing only the interfaces you are interested in.


Here is a list of the callback interfaces. When implementing any of these interfaces for your own object, remember that SE.THIS refers to the object being manipulated.


interface: SEGetCallback

interface: SEPutCallback

interface: SEHasPropCallback

interface: SECanPutCallback

interface: SEDeletePropCallback

interface: SEDefaultValueCallback

interface: SEOperatorOverloadCallback

inteface: SEGetByIndexCallback

interface: SEGetNameByIndexCallback

interface: SEMaxIndexCallback