Editor Properties
- 3 minutes to read
Every editor in the ExpressEditors Library maintains various properties via the Properties object. Using the Properties object’s attributes, you can adjust the editor behavior as your programming needs dictate. The base class representing the editor properties is TcxCustomEditProperties. Other property classes add new functionality as needed by the different types of editor. The following image shows the Object Inspector window displaying the properties of a TcxTextEdit control.
You can assign a repository item to editors and this enables you to provide centralized property values for these editors. Once a repository item is assigned, all its attribute values are copied to an editor. Use the RepositoryItem property to set a repository item. For more details, refer to the Edit Repository Items topic.
Many text editors implement an automatic completion feature. These editors provide a list of predefined strings which a user can select by typing their initial characters. This list of strings is contained in the LookupItems member. LookupItems also maintains a list of strings for the incremental search function for the text editors containing an associated dropdown list. When a user types within the edit box of such a control, the dropdown window is opened and the first value within the dropdown list is located whose first characters match the typed characters.
The Properties object publishes a number of events, enabling you to control different aspects of an editor’s behavior and thus extend its functionality.
Default Property Values
The data-aware and corresponding non data-aware editors have the same Properties object class. However, working with a data-aware editor is a bit different. One of the distinctions is the editor’s read-only status: data-aware editors cannot write to a read-only dataset field even if you set the editor’s ReadOnly property to False. The ReadOnly property of a data-aware editor has a default value obtained from the linked dataset field. It is based on the TField.CanModify attribute value. You can set the ReadOnly property to False, but still cannot modify the edit value if your editor is linked to a read-only field. Unlike data-aware editors, the default value of the ReadOnly property for a non data-aware editor is always False.
Some other editor properties also have default values obtained from the linked dataset field. These properties include:
Alignment (declared in TcxCustomEditProperties, TcxCustomCheckBoxProperties and TcxCustomMemoProperties); default values are determined only for the horizontal alignment from the TField.Alignment attribute value.
MaxLength; default values are retrieved from the TField.Size property.
MinValue and MaxValue; default values for these properties are determined for integer, float and BCD dataset fields. For instance, if an editor is linked to an integer field, the default values are defined by TIntegerField.MinValue and TIntegerField.MaxValue respectively.
EditMask; default values are determined by the TField.EditMask property value.
ValueType; default values are vtFloat for float, currency and BCD fields.
DisplayFormat; default values are determined from the TNumericField.DisplayFormat property value.
You can change the above-mentioned property values and later revert to default values by calling the RestoreDefaults method. At design time, you can revert to default values by right-clicking on your editor and selecting the Restore properties option from the popup menu as shown below: