Mike,
At 10:57pm -0800 99-11-08, Palm Developers Forum List wrote:
>Date: 8 Nov 1999 13:30:20 -0800
>From: "Michael S. Davis" <[EMAIL PROTECTED]>
>Subject: Re: FldSetFont Question
>
>On Mon, 8 Nov 1999, Holger Klawitter wrote:
> > > void AdjustFieldFont(Word fldID, int width) {
> > > FormPtr form;
> > > FieldPtr fldP;
> > >
> > > form = FrmGetActiveForm();
> > > fldP = FrmGetObjectPtr(form, FrmGetObjectIndex(form, fldID));
> > > if(FldGetTextLength(fldP)>width) {
> > > FldSetFont(fldP, stdFont);
> > > }
> > > else {
> > > FldSetFont(fldP, largeFont);
> > > }
> > > }
> >
> > > What can cause the error: "app has just read from memory location
> > > zero, NULL" when changing font size. Both fields have characters
> > > inserted from global arrays of characters.
> >
> > Normally this error occurs when the text handle is not properly
> > set. You might want to check with FldGetTextHandle before getting
> > the text length. The reason for one field having a handle and the
> > other not might be that the first one had the focus.
>
>This function is called each time I insert a character. So,
>FldGetTextLength() is executed each time I insert a character,
>it is only when the FldSetFont() is executed that I get the error.
>
>FldSetFont() is what is generating the error and it only happens,
>if the field has single line attribute set to TRUE. If I change
>it to FALSE, it works without error.
There was a bug in FldSetFont on older ROMs (pre 3.5, I believe)
where it would attempt to access information using the
FieldType.lines line starts ptr - which is NULL for a single-line
field. Poser now catches reads from NULL, and thus you get the
warning.
-- Ken
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200 (direct) +1 408-261-7550 (main)