I am trying to set some text in a text field. The text does get set, no
problem. But odd behavior is displayed with the emulator and the device. If
I set the text "Hello World", the cursor appears at the end of "Hello World"
( expected behavior ). Yet when I type in any character, the cursor jumps to
the beginning of the string. It is like the string is displayed but not held
in the buffer. Here is the code I am using. In this sample, m_pField is a
valid handle...

Thanks for your time..
Ralph Krausse

****************************************************************************
**************************************************

void CFieldObject::SetText(const CharPtr pSrcText)
{
        Handle hText = FldGetTextHandle(m_pField);
        
        if(hText)
        {
                FldSetTextHandle(m_pField,NULL);
                if(MemHandleResize(hText,StrLen(pSrcText) + 1))
                        return;
        }
        else
        {
                hText = (Handle)MemHandleNew(StrLen(pSrcText) + 1);
                if(!hText)
                        return;
        }
        
        
        CharPtr pFieldText = (CharPtr)MemHandleLock(hText);
        StrCopy(pFieldText,pSrcText); 
        MemHandleUnlock(hText);
        FldSetTextHandle( m_pField,(Handle)hText);
        FldDrawField( m_pField );
}


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