> This is how I set up text in a field:
>
> static void uiSetText(FormPtr frm, Word fID, CharPtr fData, ULong fSize)
> {
> Word fldIndex = FrmGetObjectIndex(frm, fID);
> FieldPtr fld = (FieldPtr) FrmGetObjectPtr(frm, fldIndex);
> VoidHand fieldHandle = MemHandleNew(fSize);
> VoidPtr fieldData = MemHandleLock(fieldHandle);
> StrCopy((CharPtr) fieldData, fData);
> MemHandleUnlock(fieldHandle);
> FldSetTextHandle(fld, (Handle) fieldHandle);
> }
>
Regards
horace
-----Original Message-----
From: Matt Steppuhn [mailto:[EMAIL PROTECTED]]
Sent: 1999 Aug 30 Mon 06:01
To: [EMAIL PROTECTED]
Subject: Passing a Char Array to a field
Hello there Palm Pilot Gurus!
I am new to Palm Pilot Programming and was wondering if anyone could
point me in the right direction in duplicating the strcpy command to a field
on the
PalmPilot. I have started a few tidbits below but am unsure on how to
proceed
after I have a handle and pointer. I sure wish this was treated in a more
Java "TextField"
type of way to free the novice like me of all this
pointer->handle->memory-lock
stuff. It seems like a lot of trouble to just display a long string of
text.
Thanks for your help in advance!!
frm=FrmGetActiveForm();
Word wIDField = FrmGetObjectIndex (frm, ViewMessagesSubField);
FieldPtr pCtlField = (FieldPtr) FrmGetObjectPtr(frm, wIDField);
Handle hText = FldSetTextHandle(pCtlField, NULL);
CharPtr pText =(CharPtr)MemHandleLock(hText);
//Now I want to perform a String copy like function
//ie strcpy(vmsfield, sub_field);
MemHandleUnlock(hText);
FldSetTextHandle(pCtlField, hText);
FldDrawField(hText);
Matt Steppuhn
DataTrac Systems
116-3547 Skaha Lake Road
Penticton, B.C.
Canada
ph.(250) 492-5363 Ext. 132
fax (250) 493-9238
e-mail: [EMAIL PROTECTED]
Website: www.datatrac.ca