TROEventReceiver suggestion and question


(estebanp) #1

Hi guys,

First question, Do we only need one Event Receiver per program? I mean the “ServiceName” property only needs to point to a service on the service library in order to receive all/any event sinks? (just to confirm).

Second, and the suggestion…

We have a method to register event handlers on the EventReceiver that follows the syntax:

procedure RegisterEventHandler(const EventID : string; const EventHandler : TObject);

So e.g. I go and register two different “forms” to receive multiple sinks and implement their respective interfaces on both.

Due to some reason, I need to unregister one of the EventIds from a form, but leave the other ones. There is no method to do that, there is no

procedure UnRegisterEventHandler(const EventID : string; const EventHandler : TObject);

I can only unregister all the existing EventIds, or completly remove the Object from receiving events. I can NOT specifically say I want to stop receiving events on this form for this specific eventID. Just like we did with the registration.

I’m using Delphi Tokyo.

(EvgenyK) #2


yes, you can have only one event receiver in application.

you can unregister specific event or specific object from event receiver.

You are first person why have such problems with event receiver.

Why you can have personal object per event, like

  TestEventObject = class(TComponent, ITest_EventSink)
    procedure Event_String(const NewParam: string);
    procedure Event_Struct(const NewParam: TestStruct);


(estebanp) #3

Hi Evgeny,

Thank you for the response. Probably I’m not explaining myself correctly, what I’m saying is:

If I have a form that implements two event sinks:

TForm1 = class(TForm, ISink1, ISink2)

I can register it as

EventReceiver.RegisterEventHandler(EID_Sink1, Self);

EventReceiver.RegisterEventHandler(EID_Sink2, Self);

Now, what if i want to unregister ONLY EID_Sink2 from Form1, what is the call im supposed to use?

If we have the option to register the objects and sinks individually, shouldnt we have the same functionality to unregister them individually?

As far as I can see we only have:

procedure UnregisterEventHandler(const EventHandler : TObject); overload;
procedure UnregisterEventHandler(const EventIDs : string); overload;

Hope this helps.

Thank you in advance.

(EvgenyK) #4

this call should work for you:


(estebanp) #5

Hi Evgeny!,

Would that unregister EID_Sink2 from all other forms that may have it implemented or just from Form1?

How the eventreceiver knows what form (object) i want that sink to be unregister?

I could have multiple objects listening to the sink, and I only want to let the eventreceiver know that I dont want it anymore on a specific object (Form1).

Just like it allowed me to register it on different objects if I want it to.

Thank you again.

(RemObjects) #6

Thanks, logged as bugs://80349

(RemObjects) #7

Thanks, logged as bugs://80350

(EvgenyK) #8

logged for Delphi and .NET side

(RemObjects) #9

bugs://80349 got closed with status fixed.

(RemObjects) #10

bugs://80350 got closed with status fixed.