PRIMER 22.1
Defining Callback Functions
Defining callback functions
Callback functions (onClick, onChange, etc.) can be assigned to the window and widgets in the properties window, by adding the name of a function to call.
For example to set the onClick property of a widget so it calls a function called :

This function then needs to be defined in your script:
Use("C:\\test.jsi");
if (gui) gui.my_window.Show();
function pressed()
{
Message("You clicked me!");
}