New topic: Saving textarea and pasting code
<http://forums.realsoftware.com/viewtopic.php?t=47688> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message lacobo Post subject: Saving textarea and pasting codePosted: Wed Apr 24, 2013 7:20 am Joined: Tue Dec 11, 2012 12:49 pm Posts: 2 It must be really simple, but I can't find a solution for my problem. I am creating a CSV editor for simple things as replacing ; to , and removing ". That all works fine. But now I want to save the text area. How do I add a sugested name and fix it to the standard extension "csv"? This doesn't work: Dim f As FolderItem Dim dlg As SaveAsDialog //create a new SaveAsDialog 'dlg.SuggestedFileName = window1.Title dlg.filter = "TextTypes.csv" dlg = New SaveAsDialog //Run it 'f = new folderitem (window1.title) f = dlg.ShowModal //check to see if the user clicked cancel If f <> Nil Then //save the TextArea Call TextArea1.Save(f, false) End If And another thing: If I copy some code from the internet or from the help function, realstudio puts everything in one line, instead of the separate lines of code. How can I fix this? Thanks, Bert Top Ballyanthony Post subject: Re: Saving textarea and pasting codePosted: Wed Apr 24, 2013 7:46 am Joined: Fri Apr 19, 2013 2:08 am Posts: 5 I believe the Filter is used to grey out some of the files in the SaveAsDialog and not for the extension. Also, you are setting the filter before instantiating with "New" and you should use FilterTypes instead of assigning a string. To get around the "csv" file type issue, you should introduce SuggestedFilename, so here is your code with 1 or 2 minor changes: Dim f As FolderItem Dim dlg As new SaveAsDialog //create a new SaveAsDialog 'dlg.SuggestedFileName = window1.Title dlg = New SaveAsDialog 'dlg.filter = "TextTypes.csv" dlg.SuggestedFileName="Untitled.csv" //Run it 'f = new folderitem (window1.title) f = dlg.ShowModal //check to see if the user clicked cancel If f <> Nil Then //save the TextArea Call TextArea1.Save(f, false) End If Top lacobo Post subject: Re: Saving textarea and pasting codePosted: Wed Apr 24, 2013 8:34 am Joined: Tue Dec 11, 2012 12:49 pm Posts: 2 Thanks. I solved it before reading you post I found out that puting the code in the right sequence also helped a lot. Bert. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 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]
