Simulating Multicast Events in Win32 Delphi
Simulating Multicast Events in Win32 Delphi
When you develop (Win32) applications using Delphi you Join the Discussion
almost always write the code to handle some "Post your views, comments,
questions and doubts to this
component's event(s). For example, when you drop a article."
Discuss!
TButton on a form and double click it, an empty event
Related Resources
handler is created where you write the code to react on • OOP in Delphi
• Simulating class properties in
the user click action. Win32 Delphi
• Language features in Delphi
Win32 Delphi allows you to assign only one method as a for .NET
With Delphi for .NET a notion of multicast events was introduced. A developer can
assign two or more methods to be called when an event gets fired.
Let's see how to build a Win32 Delphi object that maintains a list of the methods its
event(s) is handled by - thus creating a simulation of multicast event handling.
Before we start, I strongly suggest that you freshen up your Delphi OOP and
custom component development memory...
PMethod = ^TMethod;
TMutliEvent = procedure(const Value : string) of
object;
TMultiEventClass = class
private
fMultiEventHandlers : TList;
public
constructor Create;
destructor Destroy; override;
procedure AddMultiEvent(const Value: TMutliEvent);
procedure RemoveMultiEvent(const Value:
TMutliEvent);
procedure FireMultiEvent;
end;
Related Articles
Zarko Gajic
Delphi Programming Guide
• My Blog
• My Forum