Board index » cppbuilder » How to fire events from a form

How to fire events from a form

Hello,

The situation:
I have made a server wich supports connectionpoints.
It is possible now to fire events from the implemented methods, but this
is not very useful yet, because the server is now just echoing.

The problem:
My final goal is to fire events from a thread, but I even cannot fire events
from a form.
How can I do that? Is there a pointername somewhere in the code that I can
use to
call the method? Or should I make a pointer myself?
I have tried to make one myself, but sofar that didn't work. I got errors
that the
class was abstract.   other classes did not work either. Maybe anybody has a
piece of example code?

thank you.

 

Re:How to fire events from a form


Hello, I can finally fire events from my server form. However, I still
cannot send a message to all
clients, only to one at a time.
Quote
Greydanus <b.p.greyda...@philips.com> wrote in message

news:923481327.543561@dibbs3.eur.cis.philips.com...
Quote
> Hello,

> The situation:
> I have made a server wich supports connectionpoints.
> It is possible now to fire events from the implemented methods, but this
> is not very useful yet, because the server is now just echoing.

> The problem:
> My final goal is to fire events from a thread, but I even cannot fire
events
> from a form.
> How can I do that? Is there a pointername somewhere in the code that I can
> use to
> call the method? Or should I make a pointer myself?
> I have tried to make one myself, but sofar that didn't work. I got errors
> that the
> class was abstract.   other classes did not work either. Maybe anybody has
a
> piece of example code?

> thank you.

Re:How to fire events from a form


Quote
>Hello, I can finally fire events from my server form. However, I still
>cannot send a message to all
>clients, only to one at a time.

I suppose you're using some kind of multi-instance server (local or remote).
In any case, you'll need a global structure to hold either all client
connections (managed by you Advise/Unadvise code) or a "static" list will
all your co-objects.

There may be another approach, but I have never tested it: using a
"singleton" object, which would receive all client connections and would
take advantange of the multicasting allowed implicitly by connection points.
May be writing an ad-hoc class factory, overriding the CreateInstance's
default behaviour to return that singleton object instead of a new one ...
Ian

Re:How to fire events from a form


There's a good article by Steve Texeira in this month's Delphi Magazine,
about firing events to multiple clients.

Other Threads