New topic: TextArea Control in Windows inserting extra linebreaks
<http://forums.realsoftware.com/viewtopic.php?t=47768> Page 1 of 1 [ 6 posts ] Previous topic | Next topic Author Message bobjtls Post subject: TextArea Control in Windows inserting extra linebreaksPosted: Thu May 02, 2013 4:33 pm Joined: Wed Nov 08, 2006 6:25 pm Posts: 41 Location: Sydney, Australia I am having a problem using RS2012r2.1 and win8pro and textarea control. I have a textarea containing many lines of transcript read from a text file. The read method replaces line endings depending on a targetMac/targetwin32 IF statement. On Mac, everything is peachy! On Win8pro, the text area shows lines of text with multiple linebreaks between them. for example, line 1 line 2 line 3 Inspecting the contents using the debugger's binary facility shows extra 0D characters. Using charonn0's code (from a related post on this list viewtopic.php?f=1&t=46589) TextArea1.Text = ReplaceAll(sh.Result, Chr(&h0D) + Chr(&h0D), Chr(&h0D)).Trim I can get the lines to closeup successfully to: line 1 line 2 line 3 However, the moment I do something like if Mid(transcriptionText.text,tagEnd+1,1) <> App.CRLF then // add a CRLF if missing after tag transcriptionText.SelStart = tagEnd transcriptionText.SelLength = 0 transcriptionText.SelText = App.CRLF refresh end if using the debugger shows that after performing the first line of the IF clause, transcriptionText.SelStart = tagEnd, the extra blank lines return around each paragraph of text. If I insert charonn0's code as below, if Mid(transcriptionText.text,tagEnd+1,1) <> App.CRLF then // add a CRLF if missing after tag transcriptionText.SelStart = tagEnd transcriptionText.SelLength = 0 transcriptionText.SelText = App.CRLF transcriptionText.text = Win7Win8LineEndings(transcriptionText.text) //charonn0's line of code wrapped in a while...wend statement refresh end if after the refresh, blank lines have gone again. However, removing the blank lines also removes colour information I have added, so although it solves one problem, it causes another. This looks to me like an issue with RS, textareas and win8 cause it occurs the moment the program performs the line of code transcriptionText.SelStart = tagEnd Has anybody else found this? Interestingly enough, if running on win8 and I do not replacelineendings to windows on opening the file and reading its contents and leave it as a Mac data file, things seem to work OK with no additional linebreaks, etc. So maybe the problem is with replacelineendings? bobj _________________ bobj ----------------------------------- Dr Bob Jansen Turtle Lane Studios Pty Ltd PO Box 26, Erskineville NSW 2043, Australia Ph: +61-414 297 448 Skype: bobjtls http://www.turtlelane.com.au Top DaveS Post subject: Re: TextArea Control in Windows inserting extra linebreaksPosted: Thu May 02, 2013 4:42 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 4823 Location: San Diego, CA I think that Textarea assumes 0xOD only for Linefeed.. and doesn't honor the OS setting (which is 0x0D/OxOA for windows, and only 0x0D for OSX) so the extra 0x0A is probably what is messing you up... try replacinging the lineendings with ENDOFLINE.UNIX and see what happens _________________ Dave Sisemore iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top bobjtls Post subject: Re: TextArea Control in Windows inserting extra linebreaksPosted: Thu May 02, 2013 11:52 pm Joined: Wed Nov 08, 2006 6:25 pm Posts: 41 Location: Sydney, Australia Dave thanks for your suggestion. I have spent all day playing with that. If I set lineendings to EndofLine.Unix, then the display at least displays readable text but all lines are without intervening linebreaks where required. For example. on a Mac, I seee <TLStimecode timecode="0.5" speaker="Caroline Evans" /> t's recording now. <TLStimecode timecode="2" /> So, um, we're back again on Friday to finish the interview. <TLStimecode timecode="8" /> It must be the twenty-fourth On windows I see <TLStimecode timecode="0.5" speaker="Caroline Evans" /> t's recording now. <TLStimecode timecode="2" /> So, um, we're back again on Friday to finish the interview. <TLStimecode timecode="8" /> It must be the twenty-fourth Then if I subsequently do anything to the textarea contents, even setting SelStart property, the display returns to <TLStimecode timecode="0.5" speaker="Caroline Evans" /> t's recording now. <TLStimecode timecode="2" /> So, um, we're back again on Friday to finish the interview. <TLStimecode timecode="8" /> It must be the twenty-fourth This is causing me great problems as the windows version of the app is not as pretty as the Mac but also does not function as efficiently (I now need users to close the window and reopen it to run a function twice and even then I can not guarantee its success). This never used to be a problem for earlier versions of RealStudio and XP Pro. I have searched the web and found some useful pointers to the fact that textareas muck about with content, the issue of superfluous 0x0D bytes and that textareas should not be used for storage. However, altering that in my code now completely destabalises the app which I can't afford right now. As far as I can see, as a programmer, I expect that textareas should adhere to lineendings of the platform the app is running on. But they don't! bobj _________________ bobj ----------------------------------- Dr Bob Jansen Turtle Lane Studios Pty Ltd PO Box 26, Erskineville NSW 2043, Australia Ph: +61-414 297 448 Skype: bobjtls http://www.turtlelane.com.au Top DaveS Post subject: Re: TextArea Control in Windows inserting extra linebreaksPosted: Thu May 02, 2013 11:58 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 4823 Location: San Diego, CA s=replaceall(s,chrb(10),chrB(13)) where s=your text _________________ Dave Sisemore iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top shaosean Post subject: Re: TextArea Control in Windows inserting extra linebreaksPosted: Fri May 03, 2013 1:05 am Joined: Mon Aug 15, 2011 10:25 pm Posts: 281 Take a look at the ReplaceLineEndings function to see if that will help you.. _________________ Real Studio 2012r1.1 | MacBook Pro i5, 10.6.8 | Windows 7 Top bobjtls Post subject: Re: TextArea Control in Windows inserting extra linebreaksPosted: Fri May 03, 2013 1:20 am Joined: Wed Nov 08, 2006 6:25 pm Posts: 41 Location: Sydney, Australia After many hours work and taking the time to understand another posting correctly, http://forums.realsoftware.com/viewtopic.php?f=6&t=36718, I have got things working correctly on both Mac and Win. The bit I was missing, as described in the posting, was that a textarea uses EndofLine.Macintosh as its linebreak irrespective of what OS you are running on. So, changing my app to ignore OS dependency and standardise on EndofLine.Macintosh for both internal working and external filesave has fixed the problem. The two points that needed to enter my consciousness were: 1. the standardisation on internal lineending of a textarea as EndofLine.Macintosh; and 2. the Delimiter property of a TextOutputStream. I now set that to EndofLine.Macintosh as well, irrespective of OS. So, all in all, two days of confusion resolved by a simple understanding of the problem. Thanks to all who provided feedback, the community is greatly appreciated. bobj _________________ bobj ----------------------------------- Dr Bob Jansen Turtle Lane Studios Pty Ltd PO Box 26, Erskineville NSW 2043, Australia Ph: +61-414 297 448 Skype: bobjtls http://www.turtlelane.com.au Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 6 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]
