Microsoft KB Archive/268478

= PRB: _CLIPTEXT Loses Line Feeds (ASCII 10) =

Article ID: 268478

Article Last Modified on 8/9/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q268478



SYMPTOMS
When accessing information that is pasted to the Windows Clipboard through the _CLIPTEXT system variable, line feed (ASCII 10) characters are removed. Also, when assigning a value to the _CLIPTEXT system variable, line feed characters converted to carriage return (ASCII 13) characters.



CAUSE
Visual FoxPro is expecting carriage returns (ASCII 13) to be used for end-of-row or end-of-line terminators and, therefore, replaces lines feeds (ASCII 10) with carriage returns (ASCII 13) when assigning a value to the _CLIPTEXT system variable.

NOTE: No other ASCII characters are affected in this manner.



RESOLUTION
When access to the original text pasted in the Clipboard is required and the loss of line feeds causes problems, you may retrieve the same information through the FoxTools Library GETCLIPDAT function, as follows: Local lcClipText Set Library To (Home+&quot;FoxTools.Fll&quot;) If OpenClip(0) lcClipText = GetClipDat(1) CloseClip Else lcClipText = Space(0) Endif



Steps to Reproduce Behavior
  Create a program file called MAKE_IT.prg, paste the following code into the program, and then run the program: lnHandle = FCreate(&quot;Test.txt&quot;,0) =FWrite(lnHandle,&quot;Line 1&quot; + CHR(9) + &quot;2&quot; + CHR(9) + &quot;3&quot; + CHR(9) + &quot;4&quot; + CHR(10)) =FWrite(lnHandle,&quot;Line 2&quot; + CHR(9) + &quot;6&quot; + CHR(9) + &quot;7&quot; + CHR(9) + &quot;8&quot; + CHR(10)) =FWrite(lnHandle,&quot;Line 3&quot; + CHR(9) + &quot;10&quot; + CHR(9) + &quot;11&quot; + CHR(9) + &quot;12&quot; + CHR(10)) =FFlush(lnHandle) =FClose(lnHandle)   Create a program file called TEST_IT.prg, paste the following code into the program, and then save the program.

NOTE: Do not run this program until the next step has been completed. Set Library To (Home+&quot;FoxTools.Fll&quot;) If OpenClip(0) y = GetClipDat(1) ? &quot;From GetClipDat: &quot;, y   ? &quot;From _ClipText: &quot;, _ClipText ? &quot;GetClipDat = _ClipText: &quot;, (y=_ClipText) CloseClip Endif Set Library To                    Open file named TEST.txt (created by the program in step 1) in Notepad, select all of the text, and then copy it to the Clipboard.  In the Command window, enter the following command: DO TEST_IT.prg  Observe the output from the second program:  Data From GetClipDat - observe that a new line is started after the 4 and the 8.

</li> Data From _ClipText - observe that '4Line 2' and '8Line 3' run together.

</li> GetClipDat = _ClipText returns .F. (false), indicating that the values from GetClipDat and _ClipText are not the same.</li></ul> </li></ol>

<div class="references_section">