Creating Views Objects at Run Time

In Script for Views, you can use the new operator to create Views objects at run time just as you would create other Script native objects, such as strings, numbers, and so on.

You can create the following types of objects at run time:

To create a gadget, such as an IlvButton, we recommend that you use Views Studio.

IlvPoint and IlvRect

Certain Views object methods take an IlvPoint or an IlvRect as their arguments. These can be created at run time as shown below:

var myPoint = new IlvPoint(20, 20);

myPanel.move(myPoint);

IlvGadgetContainer

You can create new panels at run time. Here is an example:

var size = new IlvRect(20, 20, 400, 300);

var myNewPanel = new IlvGadgetContainer("Panel", "My panel", size);

myNewPanel.readFile("panel.ilv");

myNewPanel.readDraw();

Application.addPanel(myNewPanel);

We recommend that you add the new panel to Application after it has been created.

For more information, see “Accessors for class IlvGadgetContainer” in the Gadgets Accessor Reference Manual.