Real Software Forums
http://forums.realsoftware.com/

Changing to Word Wrap: Progress Report
http://forums.realsoftware.com/viewtopic.php?f=21&t=46552
Page 1 of 1

Author:  barrytraver [ Sun Jan 13, 2013 3:51 pm ]
Post subject:  Changing to Word Wrap: Progress Report

Somewhere earlier (I'm not sure where) I asked for RealBASIC code to modify plain text WITHOUT WORD WRAP to plain text WITH WORD WRAP. This post is a "progress report" on what I've written myself thus far.

It's not perfect and it has some limitations (some of which can be solved with more complex code, some not), but -- if you willing to modify the text by hand so that there's a BLANK LINE at the beginning (and/or end) of each PARAGRAPH -- the following code may be helpful:

TextArea1.Text = ReplaceAll ( TextArea0.Text, Chr (13 ) + Chr (13 ), "WXYZED" )

TextArea1.Text = ReplaceAll ( TextArea1.Text, "- " + Chr (13 ), "" )

TextArea1.Text = ReplaceAll ( TextArea1.Text, Chr (13 ), "" )

TextArea1.Text = ReplaceAll ( TextArea1.Text, "WXYZED", Chr (13 ) + Chr (13 ) )

The "WXYZED," can, of course, be any nonsense text unlikely to appear in the text you are working with. (If you are working with Linux or a MAC, you will probably have to modify the code accordingly. I'm assumed a Windows editfield.)

I find even this inadequate code to be useful. (I actually start with RTF files rather than plain texts, but that's easily taken care of by copying the text to a control that accepts only plain text.) I hope some other people may find it to be useful as well.

Barry Traver

Author:  ktekinay [ Sun Jan 13, 2013 5:32 pm ]
Post subject:  Re: Changing to Word Wrap: Progress Report

Are you trying to do a hard wrap of text? If so, check out both StringUtils (web site not handy) or my M_String module, available at my web site, both of which contain code for this.

Author:  barrytraver [ Mon Jan 14, 2013 1:13 am ]
Post subject:  Re: Changing to Word Wrap: Progress Report

Ken,

Thanks for the suggestions. I should have mentioned, however, that I'm working with Windows (whereas both your site and Joe Strout's site are Mac-oriented).

For example, Windows 7 doesn't seem to know what to do with the .sit.hqx files on Joe Strout's site (it doesn't even seem to want to unpack properly the .zip files there <sigh>) and I wasn't sure where to find the relevant files on your site.

Any advice?

Barry Traver

P.S. I don't think there is anything Mac-specific (or Linux-specific, for that matter) with the code I posted. As far as I know, it should work with all three platforms.

Author:  ktekinay [ Mon Jan 14, 2013 3:45 am ]
Post subject:  Re: Changing to Word Wrap: Progress Report

Try this:

http://www.mactechnologies.com/index.ph ... s#m_string

Author:  barrytraver [ Mon Jan 14, 2013 3:53 am ]
Post subject:  Re: Changing to Word Wrap: Progress Report

Posted earlier in a different thread by pixe656:
_____

I am not sure I am not sure I am considering all the intricacies here but, couldn't you use a different separator for paragraphs (insert it when enter is pressed), like a second CR/EndOfLine for example?

Then, before saving, replace the double CRs by a keyword that you consider "impossible" to have a text, remove all remaining CRs, and finally put back the single CRs where you had two of them initially, by replacing your keyword.

Wouldn't that work?

Pixe
_____

Posted now by me:

pixe656 is a couple of months ahead of me. The question asked is ,"Wouldn't that work"? (See above.) Yes, it definitely would work, and it's the method I described earlier in this thread, but pixe656 came up with the method first (including (1) the two EndOfLines as a separator, which is equivalent to inserting a blank line between paragraphs, and (2) using an "impossible" keyword, where I used "WXYZED").

I apologize for not giving pixe656 credit earlier, but although I had forgotten the note posted in November 2012, my subconscious apparently remembered enough of the contents to lead me to that same approach.

Since there is not already anything in the original text I am working with to definitively set off paragraphs, something has to be added for that purpose, and inserting blank lines or two EndOfLines is the easiest way to do that.

Anyway, pize656 came up with the idea first.

Barry Traver

Author:  barrytraver [ Mon Jan 14, 2013 4:41 am ]
Post subject:  Re: Changing to Word Wrap: Progress Report

Ken,

Thanks for the URL. I'm not there, but I'm getting closer. I successfully downloaded and unpacked the files. I still have some problems, however.

When I load in M_STRING HARNESS.rbp, I get this message:

"This project was saved with a newer version of Real Studio (version 2012.02) Real Studio will convert your project to work with this version (version 2012.012). This could result in data loss should you choose to save your project."

When I run M_STRING HARNESS.rbp, I get this message:

"There is no class with this name:
dim enc as new SHA512MBS."

etc.

Any advice on this? (I think I'm almost there....) Thanks.

Barry Traver

Author:  shaosean [ Mon Jan 14, 2013 6:44 am ]
Post subject:  Re: Changing to Word Wrap: Progress Report

barrytraver wrote:
dim enc as new SHA512MBS."


Monkeybread plugin is required..

Author:  ktekinay [ Mon Jan 14, 2013 9:45 am ]
Post subject:  Re: Changing to Word Wrap: Progress Report

There are two constants that you can set to false to tell it not to use the plugins. With the latest version of Real Studio, the plugins are not required at all.

Author:  NaNdummy [ Mon Jan 14, 2013 10:56 am ]
Post subject:  Re: Changing to Word Wrap: Progress Report

If you guys want some other encryptions: http://realstudiodevspot.com/download.php?view.34

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/