An external event can result in more than one internal event. For example, clicking the mouse in a fill-in might shift the focus from another field, causing ENTRY and LEAVE events, respectively. Since the ordering of events is significant, the AVM builds a stack based on events as they occur, starting with the first event at the bottom of the stack. Each succeeding event is added to the stack.
The stack is a LIFO (Last In First Out) stack, which means the AVM pushes events onto the stack in the reverse order of their firing. In the focus example above, clicking in the fill-in causes the focus to shift, so the ENTRY event is first in the stack.
In some cases, a trigger on one event takes precedence over a trigger on another event. For example, when you press the mouse button to choose a button, the AVM generates both a MOUSE-SELECT-CLICK event and a CHOOSE event for the button (among other possible events). Since the MOUSE-SELECT-CLICK trigger takes precedence over the CHOOSE trigger for a button, The AVM recognizes that the CHOOSE trigger should not fire and does not push it onto the stack.
Sometimes the AVM has to insert an event elsewhere in the stack than at the top. For example, when you click the mouse to choose a button, the AVM pushes the MOUSE-SELECT-DOWN and ENTRY events that are the first to occur, onto the stack. When you release the mouse button, a CHOOSE event occurs, but if the AVM pushes the CHOOSE event onto the top of the stack, a CHOOSE trigger on the button will fire before an ENTRY trigger. Since an ENTRY trigger always must fire before a CHOOSE trigger, the AVM inserts the CHOOSE event below the ENTRY event so the CHOOSE trigger will fire after the ENTRY trigger.
Once it adds the events for an external action to the stack, the AVM starts to remove events. Since the stack is built in reverse order, the last event pushed onto the stack is the first to be removed. As it removes each event, the AVM checks for triggers and runs the ABL code for each event trigger it finds.