Quick search:


How to add a property

To add a property you need to override the initPropertyDescriptors method.

In this method first the parent method should be called in order to initialize the inherited propertydescriptors. Then addFieldProp can be called to add a field property, addDerivedProp to add a derived property or addMultiValueProp to add a multi value property.

All these methods return a reference to a propertyDescriptor. If this reference is assigned to a variable using =& it can be used make additional settings for the property, for example its label. See example1.Employee::initPropertyDescriptors for an example.

By adding more calls more properties can be added. If a property is added with the same name as an inherited property, the new definition overrides the inherited one.

Names and defaults of the parameters of the methods for adding properties can be seen by clicking on their respective hyperlinks. The meanings of $name, $type, $readOnly, $minValue, $maxValue, $minLength, $maxLength and $classDir are documented with their getter methods in the class pnt.meta.PntPropertyDescriptor. If $minLength is larger then 0, the property is compulsory: null values are not allowed. Single value derived properties are also cumpulsory if their idPropterty is compulsory.

For persistent objects, properties can be persistent. Click the following hyperlink for the meaning of $persistent. Persistent properties can also be added from column definitions in the database, see how to add field properties for database columns automatically (requires version 1.2).