Using Release 5...

The OS Emulator has told me that I am attempting to read from low memory
when I simply bring up a form with a text field, and backspace over the
last character.  This only happens once.  No more errors until I start the
app again.  There are no problems other than the emulator's warning message.

Any ideas?  Thanks!

My method of setting the field text is shown here:

void SetFieldText( FormPtr formP, Word fieldID, CharPtr strP, BOOL bDrawIt )
{
        Handle          oldTxtH;
        Handle          txtH;
        CharPtr         txtP;

        FieldPtr                fldP;
        Boolean         fieldWasEditable;
        

        // get some space in which to stash the string.
                
        txtH    = (Handle) MemHandleNew(  StrLen( strP ) + 1 );
        txtP    = (CharPtr) MemHandleLock( txtH );


        // copy the string.
                
        StrCopy( txtP, strP );


        // unlock the string handle.
                
        MemHandleUnlock( txtH );
        txtP = 0;


        // get the field and the field's current text handle.
        
        fldP            = GetFieldPointer( formP, fieldID );    
        oldTxtH = FldGetTextHandle( fldP );
        
        
        // set the field's text to the new text.
        
        fieldWasEditable                = fldP->attr.editable;
        fldP->attr.editable     = true;
        
        FldSetTextHandle( fldP, txtH );
    if (bDrawIt)
            FldDrawField( fldP );
        
        fldP->attr.editable     = fieldWasEditable;


        // free the handle AFTER we call FldSetTextHandle().
        
        if ( oldTxtH != NULL ) 
        MemHandleFree( oldTxtH );

}



- Alan Macy
  http://www.ResponsiveSoftware.com
  Time and Billing for Consultants and Others
  

Reply via email to