Here is a simple way to do what you are doing.

static void GetFieldData( UInt16 fld, Char *text )
{
        FormPtr     frm = FrmGetActiveForm();
        FieldPtr    fldP = FrmGetObjectPtr(frm,
FrmGetObjectIndex(frm,fld));
        
        if(FldGetTextLegnth(fldP))
        {
                StrCopy(text, FldGetTextPtr(fldP);
        }
}

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:bounce-449914-
> [EMAIL PROTECTED] On Behalf Of druid
> Sent: Friday, July 22, 2005 8:53 PM
> To: Palm Developer Forum
> Subject: Checking to see if field has data in it before passing it
routine
> 
>  I need to check to see if the field has data in it before I pass it
to
> GetFieldData.
> What is the best way to do that and assign a text value to name
> if the field is NULL
> 
> 
> GetFieldData( fldName, name );
> 
> 
> 
> 
> static void GetFieldData( UInt16 fld, Char *text )
> {
>     FormPtr     frm = FrmGetActiveForm();
>     FieldPtr    fldP = FrmGetObjectPtr(frm,
FrmGetObjectIndex(frm,fld));
> 
>        MemHandle hText = FldGetTextHandle(fldP);
>       if (hText)
>       {
>         MemPtr *pMem = MemHandleLock( hText );
>         StrCopy( text, (Char*)pMem );
>         MemHandleUnlock( hText );
>     }
> }
> --
> For information on using the PalmSource Developer Forums, or to
> unsubscribe, please see http://www.palmos.com/dev/support/forums/



-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to