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

Saving textarea and pasting code
http://forums.realsoftware.com/viewtopic.php?f=10&t=47688
Page 1 of 1

Author:  lacobo [ Wed Apr 24, 2013 7:20 am ]
Post subject:  Saving textarea and pasting code

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

Author:  Ballyanthony [ Wed Apr 24, 2013 7:46 am ]
Post subject:  Re: Saving textarea and pasting code

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

Author:  lacobo [ Wed Apr 24, 2013 8:34 am ]
Post subject:  Re: Saving textarea and pasting code

Thanks. I solved it before reading you post :)
I found out that puting the code in the right sequence also helped a lot.

Bert.

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