Does an implementation of the signals and slots mechanism for event dispatching exist for Delphi?
Asked
Active
Viewed 1,644 times
4
-
Non-multicast event handling is built in. It's just the multicast part that needs add-ons. – Warren P Jul 23 '11 at 22:38
-
1I added a mixup of the suggested methods at https://bitbucket.org/MX4399/multicast-events-using-generics – MX4399 Sep 16 '11 at 10:26
3 Answers
4
Search for multicast events. There are a few implementations out there, e.g.
- http://www.deltics.co.nz/blog/?p=137
- http://blogs.embarcadero.com/abauer/2008/09/03/38867
- http://www.codebot.org/delphi/?doc=9568
Some of them need generics, so are D>2009 only.

Uli Gerhardt
- 13,748
- 1
- 45
- 83
-
-
@Downvoter: I tried to use TApplicationEvents for my own multicast events once. Unfortunately it's designed mostly un-reuseable, like most of the VCL. :-/ – Uli Gerhardt Jul 23 '11 at 16:25
2
Whilst you can implement multi-cast events yourself, they are not directly supported in the the language unlike in C# and VB.NET. Lack of language support makes any attempt to emulate multi-cast events rather clumsy.
Interestingly, C++ lacks support for signals and slots and the Qt solution involves an extra process in the compilation tool chain, the Meta Object Compiler.

David Heffernan
- 601,492
- 42
- 1,072
- 1,490
-
1More importantly, the *VCL* and the *IDE* don't support whatever *your* implementation of multi-cast events is, making it's use clumsy. The language as-is could be used to implement nice multi-cast events, even implement the full-blown registration-free "signals and slots" thing (using RTTI Attributes). Using operator overloading you can almost get C# syntax working. – Cosmin Prund Jul 22 '11 at 10:05
1
I spent some time a while ago getting Allen Bauer's Multicast Event code working. It has some limitations, but works well in my code. You can see the code here.
Of course, it only works in Delphi > 2009
-
The original post from Allen only supported 32 bit. If you are looking for a version that supports 64 bit as well you can find it here: https://github.com/JensBorrisholt/OnlineOffline – Jens Borrisholt Sep 30 '18 at 18:39