PRB: Text in Edit Region Is Double Spaced After a READ

ID: Q112185

The information in this article applies to:

SYMPTOMS

Text in an edit region appears double-spaced after changes are made to the text during a READ.

CAUSE

When changes are made to the text in the edit region, FoxPro for Macintosh adds a CHR(13)--a carriage return--immediately following any CHR(10)--a linefeed--within the text.

RESOLUTION

Use the edit region's VALID clause to remove the CHR(13) characters from the text. For example, the following statement uses the STRTRAN() function to remove all CHR(13) characters from the text memory variable called m.notes:

   m.notes=STRTRAN(m.notes,CHR(13))

MORE INFORMATION

Steps to Reproduce Behavior

To illustrate the problem of FoxPro adding CHR(13) characters in text, run the following program, which counts the number of CHR(13) characters in the edit region's VALID clause.

   CLEAR
   m.notes="Line1"+CHR(10)+"Line2"+CHR(10)+"Line3"+CHR(10)+"Line4"
   WAIT WINDOW "There are "+cntchr13(m.notes)+ ;
               " CHR(13) characters in    m.notes"
   @2,2 edit m.notes size 10,25 scroll
   READ
   WAIT WINDOW "There are "+cntchr13(m.notes)+ ;
               " CHR(13) characters in m.notes"

   FUNCTION cntchr13
   PARAMETER teststring
   chrcount=0
   DO WHILE AT(CHR(13),teststring)<>0
     chrcount=chrcount+1
     teststring=STRTRAN(teststring,CHR(13),"",1,1)
   ENDDO
   RETURN ALLTRIM(STR(chrcount))

When the above program is executed, if a change is made in the edit region, the wait window following the READ command will return a number greater than zero. If no changes are made (for example, the TAB key is pressed), no CHR(13) characters will be shown in the wait windows.

Additional query words: CR LF line feed modify alter modified

Keywords          : kbcode kbMAC kbVFp 
Version           : 2.5b 3.0b
Platform          : MACINTOSH
Issue type        : kbprb

Last Reviewed: May 18, 1997