--- Shawn wrote:
> What is the alternate way of knwoing which is the
> active form. do reply back. 

FrmGetFormPtr().

There is nothing wrong with using FrmGetActiveForm() IF you call it
from the right section of your code.  For example, in your
MainFormHandleEvent(), you might have this:

  // this is perfectly OK
  case frmOpenEvent:
    frmP = FrmGetActiveForm();
    MainFormInit( frmP );
    FrmDrawForm ( frmP );
    handled = true;
    break;

The problem arises if you call FrmGetActiveForm() when the currently
active form is not the one you think it is, and then you follow that
with an attempt to get a pointer to an object that is supposed to be on
that form (but isn't there because you have the wrong form pointer).

If you don't know what the current form is, don't call
FrmGetActiveForm() without verifying that it returns the right pointer.
 If you want to get a pointer to a particular form, use FrmGetFormPtr()
and pass in the form id of the form you want.

If you are dynamically creating forms or dynamically adding objects to
forms, then read the documentation carefully and pay attention to which
functions can change the form pointer.  Always use the new pointer
after it has been changed.


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

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

Reply via email to