David,
I posted the stuff below several weeks ago when I was working on my
first preferences file. I found the greatest obstacle was not
figuring out a scheme to code and decode preferences, but figuring
out REALbasic's method for writing and accessing the files.
Also, there were a number of useful tips posted in mid December,
2005, Getting Started list.
Posted by me on 12/16/05:
----------
APP_PREFS is a string constant that will be the prefs filename.
ON CLOSING:
dim file as FolderItem
dim filecontent as string
dim filestream as TextOutputStream
Dim f As new FolderItem
f=PreferencesFolder
//build filecontent string here
if f<> nil then
file=f.Child(APP_PREFS)
fileStream=file.CreatetextFile
fileStream.write filecontent
filestream.close
end if' nil
Else
MsgBox "The prefs folder does not exist."
End if
----------------------
ON OPENING:
dim file as FolderItem
dim filecontent, path as string
dim filestream as TextInputStream
Dim f As new FolderItem
f=PreferencesFolder
path=f.AbsolutePath
file=GetFolderItem(path+APP_PREFS)
if file.exists then
filestream=file.openastextFile
filecontent=filestream.readall()
filestream.close
//decode filecontent string here
End if
Exception
MsgBox "not all Preferences were read"
On Jan 20, 2006, at 8:52 PM, Brian Heibert wrote:
Where can I find a example of saving and loading preferences?
thx,
Brian
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>