After you have finished executing your application, examine the resulting report as follows:
warning: procedure for event type {a} ran for {b} seconds (address {c} in {d})
Where the parameters are:
If the program you are debugging is your initial program, you do not need to set a breakpoint because you are already where you want to be. However, if the affected program is not the initial program, set a breakpoint at the beginning of the program with:
B .0,PROGRAM-ID
Where PROGRAM-ID is the ID of your program.
Run the program until you hit that breakpoint.
Now you can look up the event type by locating the acugui.def COPY file. This is normally be included in the program, so you can just use the ft acugui.def command. From here you can scan or search for the event type number, for example, f 16413 leads to the line that corresponds to Msg-Tv-Expanding, which shows you the name of the event type.
To find the Event Procedure, you can use the command w followed by the address {c}. This centers the screen at the start of the Event Procedure. For example, if the reported address is .0001A9, you can simply type w .1a9.
From this point you can set further breakpoints and perform normal debugging, though often it is simply adequate to read the Event Procedure to see what it is doing.
For more information on using the built-in run-time debugger, see Run-Time Debugger.
Basically, any case where the control itself needs the results of the Event Procedure is legitimate, providing the remainder of the UI is kept inert. Subsidiary controls such as password boxes, search boxes, and message boxes can run, but you should avoid this when the rest of the screen is being kept alive during the Event Procedure.
PERFORM THREAD <long-running code> END-PERFORM
Starting a new thread to handle the long-running code allows the Event Procedure itself to finish quickly, and allows control to return to the UI while the long-running code runs in parallel. This remedy is usually appropriate as long as the control generating the event does not directly rely on the information returned by the Event Procedure.
To generate an exception, you can use the EVENT-ACTION field of the EVENT-STATUS item defined in crtvars.def. By setting this to EVENT-ACTION-TERMINATE in the Event Procedure, the UI terminates with a CRT STATUS value of W-EVENT, generating an exception state.