Just a question first... do you need to be using fields? It seems to me that
you are displaying static data in the fields - in that case make your job
easier and either use labels, or use WinDrawChars to image the text directly
to the screen...

Gavin.

-----Original Message-----
From: Dave Mottorn [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 18 December 2001 11:20 AM
To: Palm Developer Forum
Subject: Memory Handles


        Im still having problems with the memory handles when I update
fields on
forms - at least I think that is where the problem is.

        My main form has eight fields on it and I use this routine, and
another
version of it for strings.

void UpdateFieldTm(int newtime, ULong fieldname){
        FieldPtr fld;
        FormPtr frmP;
        VoidHand oldhand;
        CharPtr fldptr;
        Int fldIndex;


        frmP = FrmGetActiveForm();
        fldIndex = FrmGetObjectIndex(frmP, fieldname);
        fld = FrmGetObjectPtr(frmP, fldIndex);

        oldhand = FldGetTextHandle(fld);
        if (!(oldhand)) oldhand = MemHandleNew(11);
        if (MemHandleSize(oldhand) < 11) MemHandleResize(oldhand, 11);

        fldptr = MemHandleLock(oldhand);

        StrIToA(fldptr, newtime);
        FldSetTextHandle(fld, oldhand);
        FldDrawField(fld);
        MemHandleUnlock(oldhand);
}

        It seems to work ok for the main form but as soon as I load another
form
and try to update fields on it my program aborts.  I can load other forms
and close them repeatedly and redraw the main form each time with no
problem.  It seems that as soon as I update a field on another field I get
problems.

regards,

Dave Mottorn



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

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