unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, ValEdit, StdCtrls, Buttons;

type
  TForm1 = class(TForm)
    ValueListEditor1: TValueListEditor;
    Button1: TButton;
    Label1: TLabel;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    GroupBox1: TGroupBox;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    Label2: TLabel;
    procedure ValueListEditor1EditButtonClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


//zmiana komorek tytulowych
procedure TForm1.Button1Click(Sender: TObject);
begin
  Valuelisteditor1.TitleCaptions.Clear;
  Valuelisteditor1.TitleCaptions.Add('LP');
  Valuelisteditor1.TitleCaptions.Add('wartosc');
  Valuelisteditor1.Repaint;
end;

//dodaj wiersz na koncu, tylko w kolumnie wartosci tekst aaa
procedure TForm1.Button2Click(Sender: TObject);
begin
  Valuelisteditor1.InsertRow(InttoStr(ValueListeditor1.RowCount),'aaa',true);
  Repaint;
end;

//wykasuj wiersz o numerze 2
procedure TForm1.Button3Click(Sender: TObject);
begin
  Valuelisteditor1.DeleteRow(2);
end;

//lista w prawej komórce w wierszu 2
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  if CheckBox1.Checked then
  begin
    Valuelisteditor1.ItemProps[1].EditStyle:=esPicklist;
    Valuelisteditor1.ItemProps[1].PickList.Add('100');
    Valuelisteditor1.ItemProps[1].PickList.Add('200');
  end
  else
    Valuelisteditor1.ItemProps[1].EditStyle:=esSimple;
end;

//przycisk w komórce w wierszu 3
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
  if CheckBox2.Checked then
    Valuelisteditor1.ItemProps[2].EditStyle:=esEllipsis
  else
    Valuelisteditor1.ItemProps[2].EditStyle:=esSimple;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin

end;

//wstaw wiersz na poczatku tabeli, za wierszem tytulu, gdy trzeci parametr
//proc. InsertRow=false, lub na koncu tabeli, gdy true
procedure TForm1.Button4Click(Sender: TObject);
begin
  Valuelisteditor1.InsertRow(InttoStr(ValueListeditor1.Row),'99',false);
end;

//po kliknieciu przycisku w komorce
procedure TForm1.ValueListEditor1EditButtonClick(Sender: TObject);
begin
  ShowMessage('Biezacy numer wiersza'+InttoStr(Valuelisteditor1.Row));//.Keys[1]:='2';
end;

end.
