> From: Brad Jenkins
>
> If I
> send less than 5 characters it will still display 5, the last ones will be
> what ever was last in the buffer.  Here is a sample of the code that I am
> using
>
> MemHandle htext;
> FieldPtr fld;
> FormPrt frm;
> char* ptext;
> buffer[81]
>
> htext = MemHandleNew(81);
> frm = FrmGetActiveForm();
> fld = (FieldPtr)FrmGetObjectPtr (frm, FrmGetObjectIndex(frm, MyField));
> FldSetTextHandle(fld, htext);
>
> // charactors are loaded form port into buffer
>
> ptext=MemHandleLock(htext);
> StrCopy(ptext,buffer);
> MemHandleUnlock(htext);
> FrmDrawForm(frm);
>
> // on exit from the program
> MemHandleFree(htext);
>

You don't show the code for loading chars into the buffer.  StrCopy(ptext,
buffer) will copy chars from the address pointed to by buffer to the address
pointed to by ptext stopping after it finds a '\0'.  So it sounds like you
have 5 chars plus '\0' in the buffer.


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