OWLNext 7.0
Borland's Object Windows Library for the modern age
|
You can use the VN_DEFINE and NOTIFY_SIG macros to post your own custom view events and to define corresponding response table macros and event-handling functions.
This section describes how to define an event and set up the event-handling function and response table macro for that event.
First you must define the name of the event you want to handle. By convention, this name should begin with the letters vn followed by the event name. A custom view event should be defined as a const int greater than the value vnCustomBase. You can define your event values as being vnCustomBase plus some offset value.
For example, suppose you are defining an event called vnPenChange. The code would look something like this:
Next use the NOTIFY_SIG macro to specify the signature of the event-handling function. The NOTIFY_SIG macro takes two parameters: the event name and the exact parameter type to be passed to the function. The size of this parameter can be no larger than type long; if the object being passed is larger than a long, you must pass it by pointer. For example, suppose for the vnPenChange event, you want to pass a TPen object to the event-handling function. Because a TPen object is quite a bit larger than a long, you must pass the object by pointer. The macro would look something like this:
Now you need to define the response table macro for your event. By convention, the macro name uses the event name, in all uppercase letters, preceded by EV_VN_. Use the #define macro to define the macro name. Use the VN_DEFINE macro to define the macro itself. This macro takes three parameters:
Specify the value that most closely corresponds to the event-handling function's parameter type.
The definition of the response table macro for the vnPenChange event would look something like this: