Issue: 13.5 (September/October 2015)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 16,253
Starting Page Number: 49
Article Number: 13506
project13506.zip Updated: 2015-09-01 11:14:17
Related Link(s): None
Excerpt of article text...
In the previous issue (
xDev13.4), a reader asked about the proper way to save files, especially re-saves without a dialog box. This is such a basic thing for any document-based application, but the methods are often overlooked, so I thought it would be a good topic to address in this column.
A Folderitem Refresher
Before we start explaining the technique, let's take a quick look at basic file usage just so that we understand the tools we're working with.
The first and most confusing thing that beginning Xojo users encounter is the concept of the
folderitemand how that relates to files. A
folderitemis a Xojo construct that represents a pointer to a file. It is
notthe file itself. It is only an internal representation of the file.
That's why a
folderitemcan point to a file that doesn't actually exist. (You can check to see if a file exists with the folderitem's
.existsmethod, which returns
false.) You might wonder why you need the ability to refer to non-existant files and the answer is simple: without it, there'd be no way to
create a new file!
folderitem, by itself, cannot actually see the contents of the file, you have to use other Xojo objects, such as a
TextOutputStreamto read and write the contents of the file.
...End of Excerpt. Please purchase the magazine to read the full article.