Add Program-level events
Program level events are the events which are triggered with respect to the program. These could be UI based or Non-UI based events.
To add a new program-level event to the newly created program‘c/custmord.p’,we follow the steps below:
Select the program, as per your requirement and click new button in the Event. Here we have used program ‘c/custmord.p’, for demonstration purpose.
Create a widget. Here for demo purpose we have created a text widget and named it as v-displaycontent.

- In the Event field select the event type that needs to be triggered; here we select the event BEFORE-DISPLAY.
- Enter a unique sequence no. in the Sequence field.
- Type a procedure name in the Procedure field; here we give the procedure name as p-beforeDisplay.
- In the Run field enter the file name which contains the above specified procedure, here we give the filename ‘c/custlord.p’.
- Select NO-APP in Appserver field as shown in the figure below.

- Enter the character ‘ * ’ in the Frontend field, this denotes that the event runs in every environment.
- Check the field ‘All Values’ if it is not already checked.
NOTE: For the program level events, the File and Widget fields are not required to be filled, as these events are not related to any particular widget or table. Here, the ‘All Values’ checkbox could also be selected if the screen values of other widgets are required in the logic, which could be accessed through the function f-getvalue(‘<Widget name>’).
- Once the above steps are completed, click on the save.
- Next, click on the Editor button, to generate the procedure file that would run the procedure triggered by the event. Refer the figure below:
- Write the logic as required for Before-display Here is an example of a code for before display event.
procedure p-beforeDisplay:
/*------------------------------------------------------------------------------
Event : BEFORE-DISPLAYDescription :
Created : 16/12/14 Javra Software
------------------------------------------------------------------------------*/
assign
p-result = "v-displaycontent" + chr(1) + "Before Display Event".end procedure. /* p-beforeDisplay */
The logical file c/custlord.p that will be used in our program will be created automatically if you have mentioned the program directory in X/E-Files>X/E Master Files>System Defaults.

This explains that when the program starts, an event is triggered called BEFORE-DISPLAY, which in turn runs the file c/custlord.p , where the procedure p-beforeDispay is called which executes the code and gives the output as data value in the field v-displaycontent as shown in the figure below.
