🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3793

Re: Events

#3793
From: Hans Galema
Date: Thu, 28 Apr 2005 09:00
37 lines
1952 bytes
bigtommy wrote:

> but I don't know how to hadle events not directly from the Object Inspector.

Do you mean that you want to assign eventhandlers to your dynamic
created instance of TServerSocket ?

In general you can do it in following way. First look how an eventhandler
would look like. For instance for the OnClientConnect event. Use
the Object Inspector to find out. It will give you:

void __fastcall TForm1::ServerSocket1ClientConnect(TObject *Sender,
       TCustomWinSocket *Socket)
{

}

Now in the class where you construct the ServerSocket add a
memberfunction:

void __fastcall TMyClass::ServerSocket1ClientConnect(TObject *Sender,
       TCustomWinSocket *Socket)
{

}

For the rest it is -in TMyClass-:

   TServerSocket *ServerSocket = new TServerSocket ( NULL );

   ServerSocket->OnClientConnect = ServerSocket1ClientConnect;

   // use ...

   delete ServerSocket; // you will not forget this!?

Hans.
Technical Details
Message-ID: <4270a6d0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <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-7-bit
Date: Thu, 28 Apr 2005 11:00:31 +0200
From: Hans Galema <notused@notused.nl>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: 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-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 129.125.201.248
Message-ID: <4270a6d0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1114678992 129.125.201.248 (28 Apr 2005 02:03:12 -0700)
Lines: 37
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail