Here's a patch to make PalmKey automatically decrement the count each time you calculate a response:
--- palmkey.c (revision 57)
+++ palmkey.c (working copy)
@@ -348,6 +348,9 @@
FormPtr frm;
FieldPtr fld;
Char buf[80], *chr, *p;
+ UInt16 newcount;
+ MemHandle tmp, oldH;
+ Char *txt;
/* Truncate string buffer. */
buf[0] = 0;
@@ -376,6 +379,23 @@
return;
}
+ /* Decrement count. */
+ newcount = count - 1;
+ tmp = MemHandleNew(5);
+ FatalErrorIf(tmp == NULL, NullHandleMsg, file, __LINE__);
+ txt = MemHandleLock(tmp);
+ FatalErrorIf(txt == NULL, NullPtrMsg, file, __LINE__);
+ StrIToA(txt, newcount);
+ MemHandleResize(tmp, StrLen(txt)+1);
+ MemHandleUnlock(tmp);
+ fld = GetObjectPtr(frm, CountField);
+ FatalErrorIf(fld == NULL, NullPtrMsg, file, __LINE__);
+ oldH = FldGetTextHandle(fld);
+ FldSetTextHandle(fld, tmp);
+ FldDrawField(fld);
+ if (oldH)
+ MemHandleFree(oldH);
+
/* Get pointer to seed field. */
fld = GetObjectPtr(frm, SeedField);
FatalErrorIf(fld == NULL, NullPtrMsg, file, __LINE__);