Component Writer's Guide :: Array properties

From RadPHP XE2 Documentation
Jump to: navigation, search

Array properties allows you to have complex properties in your components, those properties can be edited on the IDE, saved to an XML resource file, etc. Internally, the value for an array property is treated as a string, that can be done by using serialization/unserialization when required.

There is no difference on your property declaration if you property is an array, just set the value for the protected member where you hold the property to an array, this way:

Array properties, inside the IDE, are treated as strings, and serialized/unserialized when required.

    protected $_arrayproperty=array();
 
    function getArrayProperty() { return $this->_arrayproperty; }
    function setArrayProperty($value) { $this->_arrayproperty=$value; }
    function defaultArrayProperty() { return array(); }

And you should provide a property editor so the user is able to edit such property on design-time.

Sample properties are Memo::Lines, TreeView::Items, MainMenu::Items, ActionList::Actions, etc.

Personal tools