[Tutor] Text editor

Sheila King sheila@thinkspot.net
Sat, 20 Jan 2001 12:42:23 -0800

On Sat, 20 Jan 2001 09:25:15 -0800, "Matthias Hager" <martok@mattsmail.com>
wrote about [Tutor] Text editor:

:I'm trying to create a simple text editor. From my knowledge, I have a save as command on the file menu. But I need a save command, that will save without having to open the dialog box, and make them confirm it and everything. I have an idea, that I cou
ld just use the open() command, and write it to the file that they have open. But how do I get the name of the file they have open for this function? And what code do I use to write what they have typed in the text bok to that file?
:One more thing, how could I check to see if they have made any changes to an open file in that editor?

I would think that, in order to use the "Save" command, the user would already
have had to specify a file name, either to:
(1) open an already existing file in the first place, or
(2) to save the file the first time (using SaveAs).

Somehow the user has already indicated the name of the file by this point. So,
you should have that saved in some name, like


or workingFile

or something like that.

The file shouldn't be open at the time that the user is typing and just before
they save. You should be holding the changes in some list or temp file or
something like that. Then when they "save" you open the currentFile and write
the new changes on to it. And close it.

At least, this is how I would approach it?

Sheila King