mckernon wrote: > I can't for the life of > me figure out where the replacement for PG's filters belongs in the > structure of an Appearance Project. < snip > > *How can IF 0 THEN RETURN ever execute, since 0 would always be false? > *Where would the filter code RETURN to, without it getting called from > anywhere? IF 0 THEN RETURN is merely a trick to force the compiler to insert a MacsBug label. The return is indeed never executed. The real RETURN is in your xxxx.MAIN file (see below). > *Where in this event loop do I stash code for filters? Here are some notes I made on 'How the PG runtime works'. They don't exactly answer your question, but... A core of a PG program resides in Runtime.INCL. It consists in setting up handlers, with the GOSUB format (obsolete in a non-PG program), and then entering an infinite loop: // in Runtime.INCL ON BREAK GOSUB "PG:Chk Break" ... ON EVENT GOSUB "PG:Event" ... DO HANDLEEVENTS UNTIL 0 The all-important handler PG:Event in simplified form just calls PG:Main Program, again by GOSUB. // in Runtime.INCL "PG:Event" gAction = _otherAction GOSUB "PG:Main Program" RETURN "PG:Main Program" // end of Runtime.INCL The subroutine named PG:Main Program is a multi-file monster that contains all the filters, and ends with a RETURN in your xxxx.MAIN file // Filters go here. They work by inspecting // gAction and other PG global variables // and then calling local FNs as required. // in xxxx.MAIN SELECT gAction CASE _mainAction :GOSUB "Action:Main" CASE _menuAction :GOSUB "Action:Menu" CASE _buttonAction :GOSUB "Action:Button" CASE _mouseAction :GOSUB "Action:Mouse" CASE _windowAction :GOSUB "Action:Window" CASE _fieldAction :GOSUB "Action:Field" CASE _otherAction :GOSUB "Action:Other" END SELECT:RETURN // <-- return to PG:Event Robert P.