procedure TForm1.FormShow(Sender: TObject);
begin
//Form1.Height := 167 ;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
I : Integer ;
begin
//Ändere Die Größere und setze die Listbox aus sichtbar
//Form1.Height := 321 ;
//Listbox1.Visible := True ;
if (Edit1.Text <> '
')
and (Edit2.Text <> '
')
and (Edit3.Text <>'
')
then
begin
nNode := Treeview1.Items.AddFirst(Treeview1.Selected, Edit1.Text) ;
// BroadCast(Edit1.Text) ;
end
else
begin
Showmessage('
Bitte füllen sie Startort,Zielort und Startzeit aus!') ;
end;
end;
procedure TForm1.TreeView1Addition(Sender: TObject; Node: TTreeNode);
begin
if Hops < 25
then
begin
Hops := Hops +1 ;
Broadcast(Node.Text) ;
end;
end;
procedure TForm1.Broadcast(Trainstation :
string) ;
var
TrainstationDest,TrainstationDestination,FinalDestination,Line,Info :
string ;
Destinations : TStringlist ;
I : Integer ;
begin
//Look for all Destinations the Trainstation is going to in the DB
with AdsTable1
do
begin
if not Active
then
Open ;
Locate('
Bahnhof',Trainstation,[loCaseInsensitive,loPartialKey]) ;
end;
Trainstationdest := AdsTable1.Fieldbyname('
Ziele/Linie').asString ;
Destinations := Tstringlist.Create ;
repeat
TrainstationDestination := (copy(TrainstationDest,1,pred(pos('
,',TrainstationDest))));
Destinations.Add(TrainstationDestination) ;
delete(TrainstationDest,1,(pos('
,',TrainstationDest))) ;
until TrainstationDest = '
' ;
// Now the single Information (Destination and Line)
for I := 0
to Destinations.Count - 1
do
begin
Info := Destinations[I] ;
FinalDestination :=copy(Info,1,pred(pos('
/',Info)));
delete(Info,1,(pos('
/',Info))) ;
Line:= Info;
nNode := Treeview1.Items.AddChild(nNode,FinalDestination) ;
end;