Factories

Previous Next

GUI elements are created by factories. Every GUI element has its own factory. A factory is a JavaScript object that must at least have some mandatory members. Factories can be derived from other factories. There is one abstract factory that is the superclass of all factories: Control. The Control factory is defined in the file usoft.ui.js. The Control factory provides the foundation for control creation.

The factories for all other GUI elements are defined in the file usoft.ui.controls.js. There is no need but it is also not desired to alter the file usoft.ui.controls.js. Changes or new factory definitions can be written in a new JavaScript file and/or the CustScript.js file.

registerControl()

To alter an existing factory or to create a new factory, use the registerControl() function.

This function returns nothing.

The call syntax is:

.registerControl( name, super-class-name, definition )

Name is the name of a factory. Only when name is equal to the name of an existing control, the definition of that control is overridden.

Super-class-name is a string that identifies an existing superclass factory. Super-class-name may be null, in which case the factory is derived from Control.

Definition is an object that specifies the changes when compared to the superclass.

 

Example

$.udb.ui.registerControl("MyControl", null, {...});