unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Grids, ValEdit;
type
TForm1 =
class(TForm)
ValueListEditor1: TValueListEditor;
Edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
BitBtn5: TBitBtn;
Memo1: TMemo;
BitBtn6: TBitBtn;
BitBtn7: TBitBtn;
BitBtn8: TBitBtn;
BitBtn9: TBitBtn;
BitBtn10: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure BitBtn5Click(Sender: TObject);
procedure BitBtn6Click(Sender: TObject);
procedure BitBtn7Click(Sender: TObject);
procedure BitBtn9Click(Sender: TObject);
procedure BitBtn10Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1 : TForm1;
Aktienname : TStringList;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
with ValueListEditor1
do
begin
DisplayOptions := [doColumnTitles,doAutoColResize];
TitleCaptions[0] := '
WKN';
TitleCaptions[1] := '
Aktienname';
// PickListe
Aktienname := TStringList.Create;
Aktienname.Add('
Cameco');
Aktienname.Add('
Infineon');
Aktienname.Add('
Livent');
Aktienname.Add('
Lynas');
Aktienname.Add('
Nordex');
Aktienname.Add('
Nel');
Aktienname.Add('
PlugPower');
Aktienname.Sort;
Edit1.Text := '
?`';
end;
end;
(* Hinzufügen *)
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with ValueListEditor1
do
begin
InsertRow(Edit1.Text,'
',False);
with ItemProps[Row-1]
do
begin
EditStyle := esPickList;
// Klappbox
PickList :=Aktienname;
end
end;
end;
(* Zeile löschen *)
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
With ValueListEditor1
do if Strings.Count > 0
Then DeleteRow(Row);
end;
(* Zeile überschreiben *)
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
with ValueListEditor1
do if Strings.Count > 0
then Keys[Row] := Edit1.Text;
end;
(* Speichern *)
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
ValueListEditor1.Strings.SaveToFile('
TestDat');
end;
(* Laden *)
procedure TForm1.BitBtn5Click(Sender: TObject);
begin
ValueListEditor1.Strings.LoadFromFile('
TestDat');
end;
(* Inhalt VLE --> Memo *)
procedure TForm1.BitBtn6Click(Sender: TObject);
begin
Memo1.Lines := ValueListEditor1.Strings;
end;
(* PickListe aktualisieren *)
procedure TForm1.BitBtn7Click(Sender: TObject);
begin
Aktienname.Add(Edit1.Text)
end;
(* gesammte PickListe löschen *)
procedure TForm1.BitBtn9Click(Sender: TObject);
begin
Aktienname.Clear;
end;
(* PickListe --> Memo1 *)
procedure TForm1.BitBtn10Click(Sender: TObject);
Var Laenge,i : Integer;
begin
Laenge := AktienName.Count;
showMessage(IntToStr(Laenge));
// Laenge ist OK
For i := 0
to (Laenge -1)
do
begin
ShowMessage(AktienName[i]);
// hier OK !! es kommen alle 7 Aktienklarnamen
Memo1.Lines[i] := AktienName[i];
// Hier Fehler !!?? hier kommen nur 2 ?
end;
end;
end.