procedure TForm1.Button3Click(Sender: TObject);
var err_srv,err_init,anz:integer;
host,
ip,ip2:string;
dtr,rts:boolean;
ChannelsInfo : Array[0..1023] of TtsrChannelInfo;
Records : Integer;
I,l: integer;
server:TtreeNode;
serverinfo:ttsrserverinfo;
players: Array[0..1023] of Ttsrplayerinfo;
channel: TTreeNode;
begin
try
tsrgetplayers(@players,@anz);
except
showmessage('ERROR');
end;
try
err_init:=tsrGetChannels(@ChannelsInfo, @records);
except
if not (err_init = 0) then
showmessage('ERROR');
end;
tsrgetserverinfo(@serverinfo);
tvchannels.Items.Clear; { Vorhandene Knoten entfernen }
server := tvchannels.Items.Add(nil,serverinfo.ServerName);
server.ImageIndex := 2;
server.SelectedIndex:= 2;
if Records > 0 then
for I :=1 to Records-1 do begin
if ChannelsInfo[I].ChannelParentID = -1 then begin
tvChannels.FullExpand;
tvchannels.Items.AddChild(nil,ChannelsInfo[I].Name);
tvchannels.Items.Item[i].ImageIndex:=3;
tvchannels.Items.Item[i].SelectedIndex:=3;
for l :=0 to anz-1 do begin
if players[l].ChannelID = ChannelsInfo[I].ChannelID then
begin
channel:=findrootnode(ChannelsInfo[I].Name,tvchannels);
tvchannels.Items.AddChild(channel,players[l].NickName);
//tvchannels.Items.Item[l+1].ImageIndex:=0;
//tvchannels.Items.Item[l+1].SelectedIndex:=0;
end;
end;
end
else
begin
tvChannels.FullExpand;
tvchannels.Items.AddChild(nil,ChannelsInfo[I].Name);
tvchannels.Items.Item[i].ImageIndex:=3;
tvchannels.Items.Item[i].SelectedIndex:=3;
for l :=0 to anz-1 do begin
if players[l].ChannelID = ChannelsInfo[I].ChannelID then begin
channel:=findrootnode(ChannelsInfo[I].Name,tvchannels);
tvchannels.Items.AddChild(channel,players[l].NickName);
//tvchannels.Items.Item[l].ImageIndex:=0;
//tvchannels.Items.Item[l].SelectedIndex:=0;
end;
end;
end;
end;
end;