Richard,
You're correct in your description of the second and third parameters, but
incorrect in their application. According to you, FldDelete(txtPtr, 0, 0) would
delete 1 character. That is, if (0, 2) deletes 3 characters, then (0, 1) would
delete 2 characters, and so (0, 0) would delete 1 character. However, (0, 0)
actually doesn't delete any. See the Palm OS API documentation, especially
where it says:
This function deletes all characters from the starting offset up to the
ending offset and sets the field's dirty attribute. It does not delete
the character at the ending offset.
Therefore, the "+ 1" is necessary.
-- Keith Rollin
-- Palm OS Emulator engineer
"Richard Burmeister" <[EMAIL PROTECTED]> on 12/13/2000 05:59:35 PM
Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent by: "Richard Burmeister" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
cc: (Keith Rollin/US/PALM)
Subject: Re: Problem in MemoryMgr.c...when performing a FldDelete
From: "James Tu" <[EMAIL PROTECTED]>
> FieldPtr debugfldP;
> CharPtr debug_text;
>
> //The field is a non-editable field
> //This Causes an error "MemoryMgr.c, Line: 4340, NULL handle" for some
> reason!!!
>
> debugfldP = GetObjectPtr(MainDebugFieldField);
> debug_text = FldGetTextPtr(debugfldP);
> if (debug_text != NULL){
> FldDelete(debugfldP, 0, StrLen(debug_text) + 1);
> }
The second param to FldDelete is the offset into the field's text string of
the start of the range, and the third param is the offset of the end of the
range. I haven't tested this, but I think that makes StrLen(debug_text)+1
is too big. (E.g., to delete all of a 3 char text field, I think you would
use 0 and 2, not 0 and 3). Also, if your Palm supports multi-byte
characters, you have to account for the fact that one character may take 2
bytes.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/