I recently fixed some "bugs" in my app that were ferreted out by the POSE
gremlins. The reason that I put "bugs" in quotes is that it's doubtful that
any user would ever have run into these, but I wanted my product to at least
qualify for the "Designed for Palm" status. Basically, this is what was
happening:

I had a form with a field on it that was non-editable and was used for
displaying status info. I was using FldSetTextPtr to change this field. The
gremlins were causing one of those "read directly from memory mgr.
structures" errors, and it took a lot of digging to figure out why. The
problem was that a gremlin was actually *selecting* the text in this field.
While it was selected, an event occurred that caused my app to make another
FldSetTextPtr call, but with a text string that was shorter than the
previously displayed text. FldSetTextPtr does not cause the selection limits
to be reset, so this resulted in a selection range that exceeded the length
of the current text string, causing a reference to an invalid memory
location in the field drawing routine. I fixed this with a call to
FldSetSelection(fld,0,0) before changing the text pointer. Using the debug
ROMs, I was getting an "invalid insertion point" error for a similar reason,
so I now also call FldSetInsertionPoint(fld,0) before changing the field.

  Doug Gordon
  GHCS Software

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to