At 2:05 PM -0500 2002/03/08, Matt Disher (TiBook) wrote:
>For some reason:
>
>void GadgetRedrawGadget()
>{
>    FormGadgetType*    theGadgetPtr;
>    UInt16            gadgetIndex;
>    FormPtr            frmP;
>   
>    frmP = FrmGetFormPtr(MainForm);
>    gadgetIndex = FrmGetObjectIndex(frmP, MainFooGadget);
>    theGadgetPtr = FrmGetObjectPtr (frmP, gadgetIndex);
>
>    GadgetInitialDraw(theGadgetPtr);
>}
>
>worked and the former didn't (see below).

Probably because in the working version above, you do FrmGetFormPtr(MainForm) but in 
the non-working version you did FrmGetActiveForm to get the form pointer. If the form 
containing MainFooGadget hadn't yet been *drawn* then it's not yet the active form, so 
FrmGetActiveForm would have returned the form pointer of some other form which does 
not contain your MainFooGadget. Step-debugging either version of the routine should 
make this apparent.

We were particularly interested in looking into this because we thought it might have 
some bearing on a Palm OS 5 emulator issue we were tracking down... but, it looks like 
that's not the case... which is a good thing this close to GM, believe me... ;o)

Best Regards,

Jim Schram
PalmSource Inc.
Partner Engineering

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

Reply via email to