Loading Script Modules

Three different types of scripts can be loaded into a scriptable Views application:

Static functions that may be defined in these scripts have a limited function, as discussed in Script Static Functions .

Inline Scripts

Scripts that you create from ivfstudio while designing graphic panels are called inline scripts. These scripts are saved in .ilv files by ivfstudio. Inline scripts are loaded together with the .ilv files in which they are stored when these files are loaded into a Views scriptable application. See Making Views Applications Scriptable .

Default Script Files

When an .ilv file, such as panel.ilv, that does not contain inline scripts is being loaded into a Views scriptable application, Views looks into the directory where the file is located for a Script file with the same name that has the .js extension and automatically loads it. The panel.js file is called the default Script file of panel.ilv.

Independent Script Files

You can load independent Script modules into a Views scriptable application using the loadScript method:

IlvScriptContext::loadScript("c:\\myscripts\\myscript.js");

Using this method, you can load Script files that are shared by several applications.

Script Static Functions

Inline and default scripts are associated with an .ilv file. The names of static functions defined in such scripts have a limited scope:

  • The name scope of a Script static function is limited to the module where it is defined. It is not visible from other Script modules.

  • It can only be used as a callback for the gadgets in the associated .ilv file and for the gadgets in the subpanels of the gadget container defined by the associated .ilv file, if any.

Here is an example of a static function:

static function OnClick(graphic)

{

graphic.foreground = "red";

}