Seems the typical event handler works by using something like  (borrowed from 
http://onboardc.sourceforge.net/cookbook.html ):
=======================
static Boolean
        appHandleEvent (EventPtr pEvent) 
        {
                FormPtr pForm;
                Int16   formId;
                Boolean handled = false;

                if (formId == MainForm)
                FrmSetEventHandler (pForm, mainFormEventHandler);
                        
                        // *** ADD NEW FORM HANDLING HERE *** //
etc, etc......

        }
======================

Then, in the "mainFormEventHandler" code:



=======================
static Boolean
        mainFormEventHandler(EventPtr pEvent)
        {
                Boolean handled = false;
                FormPtr pForm   = FrmGetActiveForm();
                switch (pEvent->eType)
                {  
                  etc., etc.,........

        }
=======================

MY QUESTION:  Why isn't the active form pointer passed in to 
"mainFormEventHandler(...)" by the calling function [somewhere inside of 
FormDispatchEvent() possibly].  This would make sense, because the association 
between the handler and the pointer to the form was already established during 
execution of 
appHandleEvent(...).

Is it slower to do that (use the stack)?   Did Palm, Inc., just want to be free 
to hide the implementation of the form-to-handler association??

Thanks!

Jay 

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to