Gilles
You can find some additional information here :
https://manual.pvxplus.com/PXPLUS/directives/processevents.htmBasically :
- You define an event to be generated using the PROCESS EVENT directive, assigning a name and a list of arguments that will be passed to the event handler logic
- You assign an event handler using the ON PROCESS EVENT, specifying the name of the event to be handled and the name of a handler routine to CALL or PERFORM (there is an enhancement planned to be able to use also an object's method but it's not yet available)
- Whenever the event is triggered (the PROCESS EVENT is executed), the associated event handler is called/performed and passed the defined arguments as parameters
You would usually define the event handlers somewhere in the initialization logic of your application
You insert the event triggers in strategic locations in your application logic
This simplifies how you handle critical logic in your app with software changes as well as software customization.
No need to do search and replaces of critical CALLs throughout your application when your rename and rework them, just change the assigned event handler in one place.
Also, it makes easier to customize certain aspects of your app.
Imagine you have created a special invoice printing program for a few clients instead of the standard one. In your app logic you just have a
PROCESS EVENT "PrintInvoice",invoice_num$
Wherever an invoice is supposed to be printed.
In your initialisation logic you'll have
ON PROCESS EVENT "PrintInvoice" CALL "invoice.pxp;print_std" for all clients
ON PROCESS EVENT "PrintInvoice" CALL "invoice.pxp;print_special" for a few clients
The program name could even be stored in some parameter file, or whatever solution you see fit
Hope that helps.