The following code comes from Palm OS Tutorials MemoPad04 and later
static FieldPtr GetFocusObjectPtr(void)
{
FormPtr frm;
Word focus;
// Get a pointer to tha active form and the index of the form object
with focus.
frm = FrmGetActiveForm();
focus = FrmGetFocus(frm);
// If no object has the focus return NULL pointer.
if (focus == noFocus)
return (NULL);
// Return a pointer to the object with focus.
return (FrmGetObjectPtr(frm, focus));
}
"if (focus == noFocus)" always return TRUE (i.e. go to "return (NULL);")
no matter focus = 1, 2 or whatever. then I change this line to
if (focus == -1)
it also always return TRUE no matter what value of focus is.
If a field in a From receive focus, then "if (focus == noFocus)"
should return FALSE.
The performance of this piece of code is odd, does anyone know
what going on here?
Regards,
Guanghe Pan