loadControl
loadControl(index: Integer): Control;
The loadControl method of the Control class enables an existing control (with an attached window) defined in the JADE development environment to be "cloned" at run time; that is, one or more copies of that control can be created at run time on that form. Using the development copy of the control creates these new controls.
Each control calls the same methods defined for the original control, passing its own control object as the first parameter. (Note, however, that control event methods are not called if you change the name of a control.)
In addition, you must assign a unique identifier to each control, to be passed to the loadControl method. You can use the index parameter to access this unique identifier through the control.
Although all primitive properties values are copied, the loadControl method clones only the persistent instance of the control; not the transient runtime instance.
Controls created in Painter in the JADE development environment or by using the addControl method have an index parameter value of zero (0). Most commonly, the value of the index parameter would be just that: an index. The values do not need to be sequential, but they cannot be duplicated.
The code fragment in the following example shows the creation of a new control.
cntrl := c.loadControl(id);
In the above example, the c value is the control that is being cloned, the cntrl value is the new copy of the created control, and the id value is the unique copy index supplied by the caller.
Any control that is added is automatically deleted when the form is destroyed. These controls can also be deleted dynamically, by using the
Access to these cloned controls can be achieved by using the controls method or by using the getControl method.