Dear friends, Pl. help me solve the following
Problem :
I am getting handle of text field -
when i am resizing it it gives error memErrChunkLocked
for correcting it if i write function memHandleUnlock befor resizing
it gives me error message:
"MyMail" 1.0 reports "MemoryMgrNew.c, Line 4498, Chunk under-locked".
I am not getting my bug. My function is as below-----
// Append the text in a field
static void appendText( FieldPtr field, CharPtr text )
{
VoidHand hfield; // Handle of field text
CharPtr pfield; // Pointer to field text
Word txtLen;
txtLen = FldGetTextLength( field );
hfield = FldGetTextHandle( field );
//txtLen = txtLen + StrLen( text ) + 1;
txtLen = StrLen( text ) + 1;
if( hfield != NULL )
{ int err;
/*if( (err = MemHandleUnlock( hfield ) ) != 0 )
{
Handle htxt = MemHandleNew(80);
CharPtr ctxt = MemHandleLock(htxt);
StrPrintF (ctxt, "Lock Err no : %d - %d", err,
memErrInvalidParam);
ErrDisplay(ctxt);
}*/
if( (err = MemHandleResize( hfield, txtLen ) ) != 0 )
{
Handle htxt = MemHandleNew(80);
CharPtr ctxt = MemHandleLock(htxt);
StrPrintF (ctxt, "Resize error : %d - %d , %d , %d", err,
memErrInvalidParam, memErrNotEnoughSpace, memErrChunkLocked);
ErrDisplay(ctxt);
errorExit( MemoryErrorAlert );
}
}
else
{ // Allocate a handle for the string
ErrDisplay("Allocating new memory");
hfield = MemHandleNew( txtLen );
if( hfield == NULL )
errorExit( MemoryErrorAlert );
}
pfield = MemHandleLock( hfield );
//StrCat( pfield, text );
StrCopy( pfield, text );
MemHandleUnlock( hfield );
FldSetTextHandle( field, hfield );
FldDrawField( field );
return;
}
_____________________________________________________________________________________
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/