New topic: Changing to Word Wrap: Progress Report
<http://forums.realsoftware.com/viewtopic.php?t=46552> Page 1 of 1 [ 9 posts ] Previous topic | Next topic Author Message barrytraver Post subject: Changing to Word Wrap: Progress ReportPosted: Sun Jan 13, 2013 3:51 pm Joined: Fri Sep 30, 2005 1:53 pm Posts: 778 Location: Philadelphia, PA 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 Top ktekinay Post subject: Re: Changing to Word Wrap: Progress ReportPosted: Sun Jan 13, 2013 5:32 pm Joined: Mon Feb 05, 2007 5:21 pm Posts: 354 Location: New York, NY 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. _________________ Kem Tekinay MacTechnologies Consulting http://www.mactechnologies.com/ Need to develop, test, and refine regular expressions? Try RegExRX. Top barrytraver Post subject: Re: Changing to Word Wrap: Progress ReportPosted: Mon Jan 14, 2013 1:13 am Joined: Fri Sep 30, 2005 1:53 pm Posts: 778 Location: Philadelphia, PA 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. Top ktekinay Post subject: Re: Changing to Word Wrap: Progress ReportPosted: Mon Jan 14, 2013 3:45 am Joined: Mon Feb 05, 2007 5:21 pm Posts: 354 Location: New York, NY Try this: http://www.mactechnologies.com/index.ph ... s#m_string _________________ Kem Tekinay MacTechnologies Consulting http://www.mactechnologies.com/ Need to develop, test, and refine regular expressions? Try RegExRX. Top barrytraver Post subject: Re: Changing to Word Wrap: Progress ReportPosted: Mon Jan 14, 2013 3:53 am Joined: Fri Sep 30, 2005 1:53 pm Posts: 778 Location: Philadelphia, PA 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 Top barrytraver Post subject: Re: Changing to Word Wrap: Progress ReportPosted: Mon Jan 14, 2013 4:41 am Joined: Fri Sep 30, 2005 1:53 pm Posts: 778 Location: Philadelphia, PA 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 Top shaosean Post subject: Re: Changing to Word Wrap: Progress ReportPosted: Mon Jan 14, 2013 6:44 am Joined: Mon Aug 15, 2011 10:25 pm Posts: 251 barrytraver wrote:dim enc as new SHA512MBS." Monkeybread plugin is required.. _________________ Real Studio 2012r1.1 | MacBook Pro i5, 10.6.8 | Windows 7 Top ktekinay Post subject: Re: Changing to Word Wrap: Progress ReportPosted: Mon Jan 14, 2013 9:45 am Joined: Mon Feb 05, 2007 5:21 pm Posts: 354 Location: New York, NY 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. _________________ Kem Tekinay MacTechnologies Consulting http://www.mactechnologies.com/ Need to develop, test, and refine regular expressions? Try RegExRX. Top NaNdummy Post subject: Re: Changing to Word Wrap: Progress ReportPosted: Mon Jan 14, 2013 10:56 am Joined: Thu Dec 01, 2011 2:13 pm Posts: 281 If you guys want some other encryptions: http://realstudiodevspot.com/download.php?view.34 _________________ Mac OS X 10.3-10.8 Windows 2000 (I know it sucks) Windows Server 2007 You want a bunch of new classes and web styles? realstudiodevspot.com (search there for Web Styles Plugin) Folderitem is too hard? File Bin Class I hate cows. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 9 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
