Article View: borland.public.cppbuilder.internet.socket
Article #3792Re: Events
From: Rafal Z
Date: Thu, 28 Apr 2005 09:03
Date: Thu, 28 Apr 2005 09:03
38 lines
2321 bytes
2321 bytes
bigtommy napisa๏ฟฝ(a):
> Hello,
> Once again I cannot manage work with dynamically created components. Hans
> helped me with creating TServerSocket by
> TServerSocket* ServerSocket = new TServerSocket(NULL);
> but I don't know how to hadle events not directly from the Object Inspector.
> Could you please help or include links to other sites with solution
> Tomek
>
>
You have to create a procedure of the type of the event you want to
implement. For example OnClick has an event of the type: TNotifyEvent
that means:
Type TNotifyEvent=procedure(Sender: TObject);
or
Type TClientConnect procedure(Sender: TObject; Socket:
TCustomWinSocket);
the last declares a procedural type for the OnClientConnect of
TServerSocket.
If you know the type of procedure needed for Event you can implement
such Event:
procedure TForm1.ServerSocket1ClientConnect(Sender: TObject; Socket:
TCustomWinSocket);
begin
//some code
end;
Now you can assign this procedure to the Eventproperty of TServersocket:
SeverSocket1.OnClientConnect=ServerSocket1ClientConnect;
This could you do in FormCreate event of the Form. After this line the
event will be called each time the event OnClientConnect fires
Technical Details
Message-ID:
<4270a6c7$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news2.euro.net!fi.sn.net!newsfeed2.fi.sn.net!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42709e36@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,1a3cca2661ee4f16 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII Date: Thu, 28 Apr 2005 11:03:03 +0200 From: Rafal Z <rafzio4@wp.pl> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: pl, en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: Events References: <42709e36@newsgroups.borland.com> In-Reply-To: <42709e36@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 62.111.150.186 Message-ID: <4270a6c7$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1114678983 62.111.150.186 (28 Apr 2005 02:03:03 -0700) Lines: 40 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news2.euro.net!fi.sn.net!newsfeed2.fi.sn.net!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail