on 8/25/00 10:27 AM, Andrew Lathrop at [EMAIL PROTECTED] wrote:

> I am trying to use FrmGetFormPtr so that I don't have to use
> FrmGetActiveForm and call call the function from other places.  When i use
> FrmGetFormPtr, i always get a value of 0x00000000.  For example, i used the
> following lines.  1000 is the resource ID for InputOneForm
> 
> FormPtr form2, form3;
> form2 = FrmGetFormPtr( 1000 );
> form3 = FrmGetFormPtr( InputOneForm );
> 
> And even if i assume that the values i am seeing in the debugger are
> incorrect, it crashes when i try to use the form2 or form3 later in the
> function.  Any ideas as to what i am doing wrong?  Thanks
> Andrew

The API states that FrmGetFormPtr() will return NULL if the form is not in
memory. What it MEANS to say is that it will return NULL if the form has not
been initialized and its drawing window is not in the system's window list.
If you haven't loaded a form (FrmInitForm(), etc.) you will always get NULL
as a return value. So your results above make perfect sense as long as form
ID 1000 hasn't been initialized.

FrmGetActiveForm() is a convenient and inexpensive call (it currently just
returns a system global pointer) - no problem using it in several places
(although I usually call it once in a function block and store the result in
a stack variable or pass it as a parameter). The only time you have to be
careful is if you are using FrmDoDialog() and want to initialize objects on
the dialog - the new form will not be the active form until FrmDoDialog()
executes.

-JB

----------------------------------------------
JB Parrett                 [EMAIL PROTECTED]
Palm, Inc.         

We grow a lot faster than trees,
so we miss a lot of stuff. - B. Andreas


-- 
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