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.

Mike


> 
> Hope this helps,
>       Holger Klawitter
> --
> Holger Klawitter                                     +49 (0)251 484 0637
> [EMAIL PROTECTED]                             http://www.klawitter.de/
> 
> 
> 

----------------------------------------------------
Shoot-to-Win

Protect the 2nd Amendment
----------------------------------------------------

Reply via email to