unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
EventView: TListView;
Label1: TLabel;
LEdit: TEdit;
procedure LEditKeyUp(Sender: TObject;
var Key: Word; Shift: TShiftState);
procedure InsertOrUpdateRunner(RunnerNumber:
string) ;
procedure LEditKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Stream: TFileStream;
sl : TStringList;
i: Integer;
o: Integer;
Laeuferfeld:
Record
Laeufernummer,
Runde: Integer;
end;
implementation
{$R *.dfm}
procedure TForm1.InsertOrUpdateRunner(RunnerNumber:
string) ;
var
i: Integer ;
FFound : boolean ;
FNewround : Integer ;
begin
FFound := false ;
for i := 0
to (EventView.Items.Count -1)
do
begin
if(EventView.Items[i].Caption = RunnerNumber)
then
begin
FNewround := StrToInt(EventView.Items[i].SubItems[0]) + 1 ;
EventView.Items[i].SubItems[0] := IntToStr(FNewround) ;
FFound := true;
break ;
end;
end;
if (
not FFound)
then
begin
with EventView.Items.Add
do
begin
Caption := RunnerNumber ;
Subitems.Add('
1') ;
end;
end;
end;
procedure TForm1.LEditKeyUp(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if(Key = 13)
then
begin
InsertOrUpdateRunner(LEdit.Text);
LEdit.Text:='
';
end;
end;
procedure TForm1.LEditKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin
if (key = 13)
then
begin
sl := TStringList.Create;
try
for i:=0
to EventView.Items.Count -1
do
sl.add(EventView.Items[i].caption);
sl.SaveToFile('
.\Liste.csv');
finally
sl.free;
end;
end;
end;
end.