unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Rtti, System.Classes,
System.IOUtils, System.Variants, FMX.Types, FMX.Controls, FMX.Forms,
FMX.Dialogs, FMX.StdCtrls, FMX.Edit, FMX.ListBox, FMX.Layouts;
type
TForm1 = class(TForm)
Butt_start: TButton;
Butt_newName: TButton;
Butt_deleteName: TButton;
NameList: TListBox;
ListBoxGroupHeader_active: TListBoxGroupHeader;
ListBoxGroupHeader_inactive: TListBoxGroupHeader;
Edit1: TEdit;
Butt_change_aktiv: TButton;
procedure Butt_down(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Single);
procedure Butt_up(Sender: TObject; Button: TMouseButton; Shift: TShiftState;
X, Y: Single);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
buttPress: boolean;
hP: array[0..10] of integer;
nact: integer;
implementation
{$R *.fmx}
procedure TForm1.FormCreate(Sender: TObject);
var
F: Text;
dstr: string;
i, ii: integer;
begin
dstr := TPath.GetDirectoryName(ParamStr(0));
try
AssignFile(F, dstr + '\NameList.txt');
Reset(F);
ReadLn(F, nact); { Read the first line of the file }
for i := 1 to nact do
begin // aktive Namen einlesen und auflisten
ReadLn(F, dstr); { Read Names }
NameList.Items.Insert(i, dstr); { insert Name }
ii := i;
end;
while not Eof(F) do
begin // inaktive Namen einlesen und auflisten
ReadLn(F, dstr);
inc(ii);
NameList.Items.Insert(ii + 1, dstr);
end;
CloseFile(F);
// nact := NameList.Items.IndexOf('heute nicht dabei:');
if nact > 0 then
Edit1.Text := 'Die Liste enthält ' + IntToStr(nact) + ' aktive und ' +
IntToStr(NameList.Count - nact - 2) + ' inaktive Namen'
else
Edit1.Text := 'Die Datei enthält keine Namen!';
Edit1.Text := Edit1.Text + ' ' + ParamStr(0);
except
MessageDlg('NameList.txt existiert nicht!', mtError, [mbOK], 0);
end;
end;