O'Reilly logo

Delphi Cookbook - Second Edition by Daniele Teti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Decouple your code using a cross-platform publish/subscribe mechanism

The publish/subscribe pattern, also known as Observer, is a very popular design pattern. It comes under a lot of different names, but the final scope is always the same: alert someone when something interesting happens to it. In this recipe, we'll see some utilization of the TMessageManager class, the publish/subscribe mechanism implemented in the System.Messaging.pas unit.

Getting ready…

What exactly does the cross-platform TMessageManager class do? Put simply, it allows you to listen for events and assign actions to run when those events occur. Just like in VCL or FireMonkey, you know about mouse and keyboard events that occur on certain user interactions. These are very similar, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required