From: "druid" <[EMAIL PROTECTED]>
> trying to determine if the field is empty and poping up a
> alert window then breaking the routine
> been at it a few days now, Im missing something
>
I think your outer logic is fine, but it's failing because inside
GetFieldData() nofield is set if the text buffer or the field is
missing - these shouldn't happen if your code is written
correctly.  What you want is to have that flag set if your
field is *empty*.  Change GetFieldData so that the
    if (FldGetTextLength (pField))
that does the copy has an else that sets nofield to true.

Your outer logic then has more chance of doing something
useful.

Chris Tutty

(snip)
> Boolean nofield = false;
> static Boolean frmMain_frmTestButton_OnSelect(EventPtr event)
> {
> // Insert code for frmTestButton
> GetFieldData( fldTest, testdata, 255 );
> if (nofield) status = FrmAlert(frmAleart);
> nofield = false;
>          break;
> return true;
> }
(snip)
> Boolean GetFieldData (UInt16 fld, Char *text, UInt16 maxLen)
>  {
>   FormPtr pForm = FrmGetActiveForm ();
>   FieldPtr pField = FrmGetObjectPtr (pForm, FrmGetObjectIndex (pForm,
fld));
>
>   if (text != NULL) *text = '\0'; // initialize
>   if (text == NULL || pField == NULL)
>    {
>     nofield = true;
>     return false;
>    }
>   if (FldGetTextLength (pField))StrNCat (text, FldGetTextPtr (pField),
maxLen);
>   return true;
>  }
> --
> 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