GEM and X11 applications usually have one loop that cyclic gets an event from the event list and executes this. The event-handler procedure usually consists of a hierarchy of case-statements testing for each possible event, and performing the desired action. These actions must be short, because during the event-handling, no other events can be processed. Lengthy calculations in response to a button click cannot be done in the event handler.