[Lazarus] TValueListEditor example

Bart bartjunk64 at gmail.com
Sun Dec 15 15:59:12 CET 2013


Hi,

> Please could someone give me an example of how to programmatically add column and then
> items into a TValueListEditor?

You cannot (maybe you can, but you really should NOT) add colums to
TValueListEditor.
It will always have exactly 2 colums by design.

Adding items isn't that hard.

The easiest way is to add the Key/Value pair to the Strings property:

ValEdit.Strings.Add('MyValue=AValue');

If you want you can hav teh Value column for this item behave like a
dropdownlist:

  with ValEdit.ItemProps['MyValue'] do
  begin
    KeyDesc := 'MyValue: PickList';  //optional description
    EditStyle := esPickList;
    ReadOnly := True;  //user cannot add options to dropdownlist
    PickList.Add('AValue');
    PickList.Add('AnotherValue');
  end;

Bart




More information about the Lazarus mailing list