Value List Editors

From RAD Studio
Jump to: navigation, search

Go Up to Types of Controls Index

TValueListEditor is a specialized grid for editing string lists that contain name/value pairs in the form Name=Value. The names and values are stored as a TStrings descendant that is the value of the Strings property. You can look up the value for any name using the Values property. TValueListEditor is Windows-only.

The grid contains two columns, one for the names and one for the values. By default, the Name column is named "Key" and the Value column is named "Value". You can change these defaults by setting the TitleCaptions property. You can omit these titles using the DisplayOptions property (which also controls resize when you resize the control.)

You can control whether users can edit the Name column using the KeyOptions property. KeyOptions contains separate options to allow editing, adding new names, deleting names, and controlling whether new names must be unique.

You can control how users edit the entries in the Value column using the ItemProps property. Each item has a separate TItemProp object that lets you

  • Supply an edit mask to limit the valid input.
  • Specify a maximum length for values.
  • Mark the value as read-only.
  • Specify that the value list editor displays a drop-down arrow that opens a pick list of values from which the user can choose or an ellipsis button that triggers an event you can use for displaying a dialog in which users enter values.

If you specify that there is a drop-down arrow, you must supply the list of values from which the user chooses. These can be a static list (the PickList property of the TItemProp object) or they can be dynamically added at run time using the value list editor's OnGetPickList event. You can also combine these approaches and have a static list that the OnGetPickList event handler modifies.

If you specify that there is an ellipsis button, you must supply the response that occurs when the user clicks that button (including the setting of a value, if appropriate). You provide this response by writing an OnEditButtonClick event handler.

See Also