I think you want to set the fields text handle to null while you're mucking
with it...
MemHandle theHandle = FldGetTextHandle(pField);
if(theHandle)
{
Boolean fDirty = FldDirty(pField);
FldSetTextHandle(pField, NULL);
Char *pszText = (Char *) MemHandleLock(theHandle);
TxtGlueStripSpaces(pszText, true, true);
MemPtrUnlock(pszText);
FldSetTextHandle(pField, theHandle);
FldSetDirty(pField, fDirty);
FldDrawField(pField);
}
David
"Jeff Wheeler (Laridian)" <[EMAIL PROTECTED]> wrote in message
news:43844@palm-dev-forum...
>
> I'm having a problem using TxtGlueStripSpaces(), and don't find any
> references to it in the Knowledge Base. I'm trying to use this function
to
> remove leading and trailing spaces from text data entered by my user.
> Here's a brief description of what I'm trying to do.
>
> 1. Use MemHandleNew() to create a MemHandle.
> 2. Associate that handle with a field on a form.
> 3. Wait for user to save changes.
> 4. Get handle from field on form.
> 5. Lock handle to obtain a Char *.
> 6. Use TxtGlueStripSpaces() to remove leading and trailing spaces.
> 7. Unlock handle.
>
> When the string in the memory handle does not contain leading spaces, this
> works. When it does contain leading spaces, I get: AppName called
> SysFatalAlert with message: "Field.c, Line:201, Invalid field length."
(The
> line number varies based upon which ROM I am using in the emulator.)
>
> Any advice would be much appreciated.
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/