Callbacks
A callback that you attach to an object can be written either in C++ or in Script. In jsstudio, you can specify the language you want to use in the Generic Inspector at the bottom of the Main window or in the Callbacks Inspector.
If most of your callbacks are written in Script for Views, you might want the callback language to default to JvScript. (JvScript is the symbolic name of Script for Views.) In this case, you can set the defaultCallbackLanguage option to JvScript in an option file.
To attach a callback written in Script to an object, you can either enter a name in the callback field and select the IS toggle button to its right in the Generic Inspector or enter a name and select the Script toggle button to the right of the Value field in the Callbacks page of the object inspector panel (see Callbacks Page of the Button Inspector Panel).
Callbacks Page of the Button Inspector Panel
You can access the object inspector panel by either double clicking the object or by selecting the object and clicking .
You can click the button to the right of the Script toggle to find and edit the Script function corresponding to the specified callback. If this function is not defined in the inline script attached to the buffer, a sample function will be automatically generated.
The Script function that you define must have the same name as its associated callback. It will be invoked whenever the callback is triggered. The function receives the graphic object to which the callback is associated as its first argument. If you specify a value for the callback in the Value column of the Callback Inspector, this value is passed as the second parameter to the function.