17:33:07 GMT)   
   71f3ab5f   
   From: Marco van de Voort    
      
   On 2011-12-29, Jim Leonard wrote:   
   > Along those lines, here's my first question: If everything in the TV   
   > application framework is event-based, doesn't that mean the main event   
   > handler could get extremely large, like several hundreds of lines   
   > long,   
      
   No   
      
   > with a hundred or more event handlers?   
      
   Yes :-)   
      
   A TV form is more or less organized as a tree, (form-> container control (*)   
   -> base component). Only the path to the focussed element get the main   
   stream of events. A rarer, special "broadcast" event goes to all widgets.   
      
   So the main event loop (also called message pump since it just pumps events   
   from the "drivers" part to the active form, which pumps it to the controls,   
   which pump it to their children etc.    
      
   (*) a container control is a control that can contain other controls. A   
   form (window) is also a container, but has way more logic   
      
   > And is that best   
   > practice, to put every event handler in a single loop, even for events   
   > that are only generated/handled by modal dialogs? (by "modal" I   
   > believe it means "grabbing focus until closed")   
      
   Usually only focussed elements get the events, unless they are of the   
   broadcast type. (which is usually stuff like "exiting, save your stuff".   
      
   > Is there source code for any large TV programs (applications, not   
   > libraries or utilities) out in the wild that I could study?    
      
   The textmode IDE of Free Pascal, while it probably not compiles with turbo   
   pascal anymore, is still close enough to study the general structure of   
   larger programs. It is in FPC source archives in the directory IDE, e.g.   
      
   ftp://ftp.freepascal.org/pub/fpc/dist/2.4.4/source/short/separate/idesrc.zip   
      
      
   --- Internet Rex 2.31   
    * Origin: The gateway at Omicron Theta (1:261/20.999)   
|