I’m trying to copy text from a text area into the clipboard.
The problem is that the text is always copied without the end of line. I tried multiple combinations with chr(13) and or EndofLine but all text is copied into a single line.
edit:
I just noticed that If I paste it to Word the carriage returns are fine, but if I paste it to a txt file it’s all on a single line.
so it might be not relateed to Xojo ???
Here is the solution. TextArea Chr(13) internal line break is not Windows line ending which is chr(13)+chr(10). That is the reason why it did not work.
Dim c As New Clipboard
c.SetText(ReplaceLineEndings(me.text,EndOfLine.Windows))
c.Close
[quote=191387:@Peter Job]Been that way a long time, and a bug - it should work without fiddles by platform.
That’s Xojo for you - if you are not a Maccy-chap you’re a second-class citizen, relegated to a sub-forum.[/quote]
Come on Peter. I know you like a good fight, but this is irrelevant. Most people who have Macs post in OS X. It is simply more convenient to reply when questions are in a platform channel that having to ask the ever repeated question : “Mac or Windows ?”.
… And I have never been the last one to fight for platform neutrality. Platform flames are more than idiotic, and go nowhere.
I checked in Feedback, this has not been reported before. So I did :
39558 - EndOfLine not copied to ClipBoard in Windows
OS: Windows 8/8.1/10
Xojo: Xojo 2015r2.2
Steps: When Clipboard is used on Windows to copy the content of a TextArea or portions of it that contain line breaks, thse are not copied, and the result pastes in Windows application without returns.
It seems to come from the fact that internally TextArea uses Chr(13) as line ending, when Windows Expects CR+LF.
This works around the issue, but it would be nice if it worked without
Dim c As New Clipboard
c.SetText(ReplaceLineEndings(me.text,EndOfLine.Windows))
c.Close