At 2:54 PM -0500 2002/03/06, Matt Disher (TiBook) wrote:
>Working with extended Gadgets, and I want to trigger a redraw.
>
>FormGadgetType*    theGadgetPtr;
>   
>theGadgetPtr = GetObjectPtr( MainFooGadget );
>GadgetReDraw(theGadgetPtr);
>
>(returns a -1 instead of a ptr to the gadget)  The sample code for extended

Are you certain MainFooGadget is in the current active form?

GetObjectPtr is probably a routine in your own code which does FrmGetActiveForm 
followed by FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, objectID)) on that form. 
FrmGetObjectIndex will return 0xFFFF (-1) when the object is not found on the form 
(that's the frmInvalidObjectId value). If that value is used directly by 
FrmGetObjectPtr without error checking, you'll be indexing off a weird element of the 
form's object list (element -1) which will cause unpredictable results. If your 
version of GetObjectPtr is a bit smarter about checking for errors, perhaps it's 
returning the error from FrmGetObjectIndex rather than NULL?

Some food for thought.

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