Fandom

Delphi Programming

TValueListEditor Class

2,918pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

This page is intended as a supplement to the official documentation on Delphi programming. CodeGear is in the process of putting the Delphi documentation on the Web. Once they have done so, this page will link to the relevant page in the official documentation.
Stub
This article is a stub.
Please help enhance the Delphi Programming Wiki by expanding it.
Info
see the VCL Documentation Guidelines for an overview on doc pages

UnitEdit

HierarchyEdit

DescriptionEdit

This component is a handy way to administer properties. It displays a two column grid where the first is read only, listing the value names. In the second the user can set the values. You, as a programmer, can put edit masks on user input, use combobox selection or add a popup-dialog though an ellipse-button.

All pretty neat if it you don't expect too much. The component is, however, far from perfect and is quite difficult to master. I'm not there yet.


Technical CommentsEdit

In Delphi versions older than D7 the TItemProp objects added were not freed.

ExamplesEdit

Application that uses basic TValueListEditor to import data form text file using specified delimiter and therefore exporting it to text file: http://code.google.com/p/sedev See Wiki pages for more information!

See AlsoEdit

(Please provide links to items specifically related to this item.)

User Comments/TipsEdit

Adding rows to the list (80.196.30.106 10:24, 14 November 2007 (UTC), H. Carlsen):

  vle.Strings.Add(format('%s=%d',['Value',10])); 

or

  vle.Values['NotFoundInListValue'] := 'Hello';

Setting up a picklist for the 'Value'-key (80.196.30.106 10:24, 14 November 2007 (UTC), H. Carlsen):

  ItemProp := TItemProp.Create(vle);
  ItemProp.EditStyle := esPickList;
  ItemProp.ReadOnly := true; // choose editable or not.
  vle.ItemProps['Value'] := ItemProp;

The PropItem should be feed automatically in versions newer than Delphi 7.

Adding data to the picklist using the OnPickList event (80.196.30.106 10:24, 14 November 2007 (UTC), H. Carlsen):

  Values.Clear;
  Values.Add('Mary');
  Values.Add('had');
  Values.Add('a');
  Values.Add('little');
  Values.Add('Lamb (lies down on Broadway)');

Unfortunately there is no way to select an item. Therefor there is no way to find the selected one either. You'll have to match through the text, which is error prone.

You might think these values could now be found in the current rows ItemProp.PickList property (vle.ItemProps['Value'].PickList). Well, you can't. It's always empty. The get-method of the TPropItem.PickList property checks if the OnGetPickList-event is assigned and, if so, clears the list. Access to the PickList is useless when OnGetPickList is assigned.

Indirect method of determining selected cell (Lunarplasma 14:15, 15 September 2008 (UTC)): One way to indirectly determine the selected cell is by using the OnSelectCell event. In this event, assign ACol and ARow to two public variables, which can be then used in other procedures.


selecting a cell:

type
  ve=class(TValueListEditor);   // IMPORTANT

  TForm1 = class(TForm)
    ValueListEditor1: TValueListEditor;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;


procedure TForm1.Button1Click(Sender: TObject);
begin
  ve(ValueListEditor1).FocusCell(1,1, true);
end;

ValueListEditor1.Selection.Top tells you the grid row you're on.

Also on Fandom

Random Wiki