I am receiving "Object not in Form" errors. My application attempts to
create  dynamic forms by using FrmHideObject and FrmShowObject calls.
Occasionally, the FrmGetObjectPtr(frm,wObjectIndex) produces an "Object not
in Form" error. I have verified that the wObjectIndex value is correct (i.e.
the object is in the form!).  This form has 23 different objects that I may
hide or show (Maybe its too many).

What surprises me that the same FrmGetObjectPtr call earlier in the code
prior to hiding the object works fine. What is even more puzzling is the
fact that at least one dynamic form that I created using the same
FrmHideObject and FrmShowObject calls works flawlessly!! In fact - one
object in the form may work and another object in the form may not work!

Any ideas???? FrmNewForm's & FrmNewLabels are not the answer - Palm seems to
have problems with Dynamic memory allocation!

Snippet of the code: (Note - TemplateLabelResourcesID[][] array is
initialized with 0's
                                and only valid Object ID's for the form are
inserted into the array)



....
frmP = FrmGetFormPtr(uiFormNum);

if (frmP && header)
 {
        //
        // First Hide all objects in the Form
        //
        for (uiI=0; uiI < MAX_NUMBER_ENTITIES_PER_TYPE; uiI++)
        {

            if ((wObjID=TemplateLabelResourcesID[uiTemplateNum][uiI]) > 0)
            {
                wObjectIndex=FrmGetObjectIndex (frmP, wObjID);
                FrmHideObject(frmP,wObjectIndex);

            }
        }
    }

.......

        wObjID=TemplateLabelResourcesID[uiTemplateNum][uiI];
        if (wObjID > 0)
        {

            wObjectIndex=FrmGetObjectIndex (frmP, wObjID);     /////
OCCASIONALLY CRASHES HERE!
            FrmSetObjectPosition (frmP,wObjectIndex, (SWord)wRemUlX, (SWord)
wUlY);
            if (StrLen(ei->sAdjacentLabel) < MAX_NUM_CHARS_IN_LABEL)
                FrmCopyLabel (frmP, wObjID,ei->sAdjacentLabel);
            else
                FrmCopyLabel (frmP,  wObjID,sLabelTooLargeError);

            FrmShowObject(frmP,wObjectIndex);
        }


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