Note: ABL named events are completely different from the key function, mouse, widget, and direct manipulation events described in the “Handle-based Object Events Reference” section. They are also different from the class events described in the “Class Events Reference” section.
PUBLISH event-nameFROM publisher-handle( parameter , parameter )A quoted character string or character expression representing the name of a named event. If you use a quoted character string, ABL adds event-name to the PUBLISHED-EVENTS attribute’s list of events.FROM publisher-handleThe FROM option lets a procedure publish an event on behalf of another procedure or widget. For example, if you want procedure A to publish a named event on behalf of procedure B, set publisher-handle to the procedure handle of B.Also, if a named event has one or more parameters, the PUBLISH statement and each subscriber’s local internal procedure (which the SUBSCRIBE statement names and which the AVM runs when the named event occurs) must specify identical signatures-where signature means the number of parameters and the data type and mode (INPUT, etc.) for each.The parameter syntax is identical to that of the RUN statement. For its specification, see the Parameter passing syntax reference entry.The following example consists of four procedure files: a driver, a publisher, and two subscribers. The driver, r-nedrvr.p, runs the publisher and the two subscribers persistently, then subscribes to the event NewCustomer on behalf of the second subscriber.The publisher, r-nepub.p, publishes the event NewCustomer:
/* r-nepub.p */PROCEDURE NewCust:DEFINE VARIABLE name AS CHARACTER NO-UNDO INITIAL "Sam"./* Let subscriber know new customer */PUBLISH "NewCustomer" (INPUT name).END PROCEDURE.The first subscriber, nesub1.p, subscribes to the event NewCustomer:The second subscriber, nesub2.p, already subscribed to the event NewCustomer, cancels all subscriptions:To start the example, run the driver, r-nedrvr.p.
If publisher-handle is a handle, the value of SOURCE-PROCEDURE in each of the subscribers’ internal procedures will be the handle of the procedure that created the widget.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |