realbasic-nug
[Top] [All Lists]

Re: I was wrong about the non-encoding troubles...

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: I was wrong about the non-encoding troubles...
From: Eric Hoaglin <hoaglin at students dot sonoma dot edu>
Date: Sun, 30 Mar 2003 15:30:13 -0800
Hi,
aren't HTML files suppose to be saved as plain text files?
Sorry I don't have a fix, but I do see a few places you could add a line of code.

Hi all,

here's a small snippet I used to save text from EditField and get it back.


Until I type some comments - using ASCII > 127 characters - in my html
files I wasn't able to see the trouble.


Basically, what must I change there ?
(of course, I want the styles I put in the text)


Emile



a. Read a text file
----------------

// Open the text file in an EditField
//
Dim f As FolderItem

// Ask the user to choose a text file
f = GetOpenFolderItem("application/text")
If f = Nil Then
f.close//So you don't get an error later
Return
End If

// Open the text file and put its contents into the EditField
f.OpenStyledEditField wMain.EFSource
f.close//You should add this here
b. Write a text file
-----------------

// Save the EditField in a text file
//
Dim f As FolderItem

// Ask the user to choose a destination text file
f = GetSaveFolderItem("application/text","Default.html")
If f = Nil Then
f.close//same here
Return
End If

// Open the text file and put its contents into the EditField
f.SaveStyledEditField wMain.EFSource
f.close // you might want to add this too

PS
Congradulations on coming back from the "Dark Side" ;-)
<Prev in Thread] Current Thread [Next in Thread>