Posted by Guido, DelpiLand Team on February 25, 2005
In Reply to: Re: Creating objects on a form at runtime - how about
a ValueListEditor? posted
by Al on February 24, 2005
Difficult to say what could be wrong, I'd need more info... When do you get exceptions, and what does the error message say?
After dropping a ValueList Editor on the form, in the Object Inspector set the following in "Options" properties to True:
Setting the properties below to True is up to you, depends from how you want the thing to work:
Attention! the property RowCount is a read-only property. This gives you the number of strings in the Strings property, plus the number of fixed rows (typically one, for the column titles).
A short general overview:
TValueListEditor is a specialized grid for editing string lists that contain name/value pairs in the form Name=Value. You can look up the value for any name using the Values property.
The grid contains two columns, one for the names ("keys") 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 control how users edit the entries in the Value column using the ItemProps property. Each item has a separate TItemProp object that lets you:
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 runtime 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.
Accessing the string in a particular cell: use the Cells[aCol,aRow] property.
To access the strings in the name column, you can use the Keys property instead.
You can save the strings to a file an later load them form a file like this:
Related Articles and Replies