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

Last reviewed: May 16, 1997
Article ID: Q112185
The information in this article applies to:
  • Microsoft FoxPro for Macintosh, version 2.5b
  • Microsoft Visual FoxPro for Macintosh, version 3.0b

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 : FoxMac kbcode VFoxMac
Version : 2.5b 3.0b
Platform : MACINTOSH
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.