Here's a better way that has error checking, default processing and takes
advantage of a unique feature of the PalmOS "StrNCat()" function to prevent
stack corruption:
When using a functin like this where does the maxLen
value come from when passing the data to this function
Could I also make a change
Boolean GetFieldData (UInt16 fldNbr, Char *text, UInt16 maxLen) {
FormPtr pForm = FrmGetActiveForm ();
FieldPtr pField = FrmGetObjectPtr (pForm, FrmGetObjectIndex
(pForm, fldNbr));
if (text != NULL) *text = '\0'; // initialize
if (text == NULL || pField == NULL)
{
missing_field = true;
return false; // I like error checking !!
} // use missing_field to set an aleart window and brake the
//static Boolean frmMain_saveButton_OnSelect(EventPtr event)
// so as to not allow the save ??
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/