One of the great new features of RadVC's
"Open Architecture" is its use of a powerful and very flexible event model. In
many ways, this model is far more superior than the traditional models used by MFC and ATL
class libraries. However this new model does not replace the existing models, it merely
extends them to a new level.
- How Does it Work:
- The model is based on a concept called "Publishing
and Subscription", where the event "publisher" manages the events in a way
that when an event occurs (created / raised / fired), it has the responsibility to notify
(broadcast) it to the event subscriber (sink) that handles the event.
-
- Features:
- Here is a list of the main features of the RadVC' event
architecture:
(1) Library Independence: The model is independent of any
C++ class library like MFC or ATL. The event model used by MFC and ATL are tightly coupled
and have two different ways to make the contract between the event source and the event
sink. In RAD C++ Event model, the user now can use one unified approach to
implement an
event connection.
(2) Class Independence: The event model used by MFC and
ATL only allows you to add events to classes that are derived from certain classes. For
example, to add an event to a MFC class, the class must be derived from CCmdTarget or any
of its derived class (e.g. CWnd). This is not the case in "RAD C++
Event" model, the class that implements the event source and the event sink can be derived from any
class.
(3) Dynamic: In "RAD C++ Event" model,
the link between the event source and the event sink can be added any time during program
execution. Also, if a sink becomes redundant at a certain time during the execution, then
that sink can be easily detached from the event source.
(4) Multiple Sink: In "RAD C++ Event" model,
several event sinks can be connected to an event source simultaneously, both in design and
runtime. Thus when the event source (publisher) raises (or publishes) and event that event
notification is broadcast simultaneously to the all event sinks that are connected to the
event source.
- How to Use:
- Please read the tutorial in "Spice up your C++ Control with a Touch of
RAD", where we show you how to manually create a RAD C++ control in Visual C++
(without RadVC).
-
- You can also read Part 6: Adding an
Event to the New Control to find how an event can be added automatically to a RAD C++
control in RadVC environment and Part 9: Testing the Modified
Control to know how an event sink can be added to the client module.
-
|