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). Once it worked I didn't really
dig much further. But the answer to your question was the gadget on the
form, and the answer to that is 'yes' I've only one form at this poing :/
I think I read somewhere after posting that I 'had' to do it the above way.
<shrug>
--
Matt Disher
[EMAIL PROTECTED]
>> 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/