there has got to be a better way, this could get ugly
with 10 fields or so
#include <PalmOS.h>
#include "testaleart.h"
#include "testaleart_res.h"
Char testdata[256], testdata1[256];
Boolean nofield = false;
UInt16 status;
static Boolean frmMain_frmTestButton_OnSelect(EventPtr event)
{
UInt16 fld;
// Insert code for frmTestButton
GetFieldData( fldTest, testdata, 255 );
if(nofield)
{
status = FrmCustomAlert(frmAleart, "Name", NULL, NULL);
nofield = false;
}
else
{
GetFieldData( fldTest1, testdata1, 255 );
}
if(nofield)
{
status = FrmCustomAlert(frmAleart, "Number", NULL, NULL);
nofield = false;
}
else
{
//go to routine to save records
}
return true;
}
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)return false;
if (FldGetTextLength (pField))
{
StrNCat (text, FldGetTextPtr (pField), maxLen);
}
else
{
nofield = true;
}
return true;
}
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/