Example of Beginning Notifications

The following example shows the use of the beginClassNotification method and the beginNotification method when loading a form.

load() updating;
vars
    a1     : A;
    b1     : B;
    c1, c2 : C;
begin
    // Creates instances of classes A, B, and C which will be the target
    // instances of the notifications.
    beginTransaction;
       create a1;
       create b1;
       create c1;
       create c2;
    commitTransaction;
    // For each of these notifications, the false parameter specifies that
    // the notification will only occur if the instance is persistent, the
    // Response_Continuous parameter specifies that a notification will be
    // sent whenever an event occurs and the final eventTag parameter is an
    // integer value that is returned with each notification.
    // Registers the receiver (in this case, the form) to be notified when a
    // system event (create, update, or delete) occurs on an instance of
    // class A.  When the notification is received, the sysNotify event of
    // the form will be executed.
    beginClassNotification(A, false, Any_System_Event, Response_Continuous,
                           1);
    // Registers the receiver to be notified when a user event with an
    // eventType of 16 (User_Base_Event) occurs on an instance of class B.
    // When the notification is received, the userNotify event of the form
    // will be executed.
    beginClassNotification(B, false, User_Base_Event, Response_Continuous,
                           2);
    // Registers the receiver to be notified when a system event occurs on
    // the instance c1 (that is, when c1 is created, updated or deleted.
    // When the notification is received, the sysNotify event of the form
    // will be executed.
    beginNotification(c1, Any_System_Event, Response_Continuous, 3);
    // Registers the receiver to be notified when a user event with an
    // eventType of 17 occurs on the instance c2.  When the notification is
    // received, the userNotify event of the form will be executed.
    beginNotification(c2, 17, Response_Continuous, 4);
end;