Microsoft KB Archive/112185: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - ">" to ">")
 
(2 intermediate revisions by the same user not shown)
Line 31: Line 31:


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


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

Latest revision as of 18:11, 20 July 2020

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

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

Last Reviewed: May 18, 1997
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.