>> I know this is a pretty simplistic question, but Ill be damned
>> if I can get it to work. All I want to do is copy the contents
>> of a field (a string) on the current form into char array.
>
>I don't know what you've been doing, but this should work for you:
>(Warning! This code is off the top of my head with no testing.)
>
>// copy text from yourField to Name
>// assumes the text is not more than 9 chars
>Char Name[10];
>Char * textPtr;
>textPtr = FldGetTextPtr( (FieldPtr) GetObjectPtr( yourField ) );
>StrCopy(Name, textPtr);
Here's what I use:
CharPtr GetTextFromField( Word fieldID )
{
FormPtr frm = FrmGetActiveForm( );
FieldPtr fldP;
Handle hand;
CharPtr text;
fldP = FrmGetObjectPtr( frm, FrmGetObjectIndex( frm, fieldID ));
hand = FldGetTextHandle( fldP );
if( hand )
{
FldSetTextHandle( fldP, NULL );
text = MemHandleLock( hand );
}
MemHandleUnlock( hand );
return( text );
}
Works well...release the Handle after the unlock, if you want, with
MemHandleRelease.
-Rus
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/