{******************************************************************************}
{ Verbinden Dialog }
{******************************************************************************}
unit verbinden;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls;
type
TVerbindenDlg = class(TForm)
VerbindenBtn: TButton;
CancelBtn: TButton;
DlgBevel: TBevel;
AddrEdit: TEdit;
PortEdit: TEdit;
AddrLabel: TLabel;
PortLabel: TLabel;
NickLabel: TLabel;
NickEdit: TEdit;
procedure CheckValues;
procedure PortEditChange(Sender: TObject);
procedure AddrEditChange(Sender: TObject);
procedure NickEditChange(Sender: TObject);
end;
var
VerbindenDlg: TVerbindenDlg;
ClientPort : Integer;
ClientAddr,
ClientNick : String;
implementation
{$R *.DFM}
procedure TVerbindenDlg.PortEditChange(Sender: TObject);
begin
CheckValues;
end;
procedure TVerbindenDlg.AddrEditChange(Sender: TObject);
begin
CheckValues;
end;
procedure TVerbindenDlg.NickEditChange(Sender: TObject);
begin
CheckValues;
end;
{Eingaben überprüfen}
procedure TVerbindenDlg.CheckValues;
var
Buf,
Buf2 : String;
Cnt,
Code,
IChk,
CPos : Integer;
begin
VerbindenBtn.Enabled:=True;
{PortCheck}
Val(PortEdit.Text,ClientPort,Code);
if (Code0)or(ClientPort65535) then
VerbindenBtn.Enabled:=False;
{AddrCheck}
Buf:=AddrEdit.Text+\'.\';
for Cnt:=1 to 4 do
begin
CPos:=Pos(\'.\',Buf);
if CPos=0 then Break;
Buf2:=Copy(Buf,1,CPos-1);
Val(Buf2,IChk,Code);
if (Code0)or(IChk255) then Break;
Delete(Buf,1,CPos);
if Buf=\'\' then Break;
end;
if (Cnt |