[Lazarus] TValueListEditor example
Richard Mace
richard.mace at gmail.com
Sun Dec 15 21:06:49 CET 2013
Bart,
Many thanks for your reply, it's starting to make sense now :)
It is possible to make the "key" column read only?
Richard
On 15 December 2013 14:59, Bart <bartjunk64 at gmail.com> wrote:
> 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
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131215/99031bf3/attachment-0003.html>
More information about the Lazarus
mailing list