Click here if you want to know more about the source and format of these pages.
This page is "browser friendly". Make your browser window as wide as you want it. The text will flow nicely for you. It is easier to read in a narrow window. With most browsers, pressing plus, minus or zero while the control key (ctrl) is held down will change the texts size. (Enlarge, reduce, restore to default, respectively.) (This is more fully explained, and there's another tip, at my Power Browsing page.)
You will, I hope, find that this page has information for you if you want to write a Delphi program to massage the contents of a file.
The tutorial is more concise than most of those in this collection.
There is some "bonus information" in the sourcecode for you, if you read through it.
The full Delphi source is available online for download. A compiled version of the application is included in the zip file. There's even a small file of data ('ToBeMassaged.txt') you can use to test the application.
Linux? Mac? There is a Lazarus source code zip for you, too, containing the Lazarus equivalents of what the Delphi programmers get (see previous paragraph). (See bottom of page for note about Delphi- to- Lazarus conversion.)
Users of the application will see...
As presented, the application does not do anything very useful... but it is a shell you can adapt for whatever file massaging tasks you need an application for.
Notice that the "Do It" button is grayed out. It is enabled as soon as users specify the source file and destination file they want to use. When both have been specified, the user can the "Do it" button, which will cause...
Modern computers can manipulate stunningly large memos, and this "crude" approach makes the programming easy.
The Delphi OpenDialog and SaveDialog are used... but I must confess that few of the ins and outs of using those are addressed. Consider this tutorial a fleeting introduction to those two useful components.
No check is included of whether the destination file is already present on the disk. If it is, it will be overwritten.
This is one of a number of tutorials I have written with functionally similar applications. By which I mean that what they do for the user is similar. I have taken at least two very different approaches to accomplishing the task. What is "under the hood" is different in the different tutorials.
This tutorial was written 24 July 11 using Delphi 4, and if (when you adapt it) it meets your file massaging needs, is probably the best of the different attempts to show you a way to do that to date, by quite a margin. Apart from anything else, this is a very concise "tutorial".
Be sure to read through the source code. There is help for you there, to make up for the lack of it here!
The application does nothing to the source file other than reading it. The difference between the source file and the destination file is as follows... but before I tell you what "massaging" is done, remember that the point of this application is to give you a skeleton for your own needs. When you read the source code, note how the "massaging" part has been isolated in the code, to make tinkering with it easy.
In what I am about to say, everything is case sensitive.
Every 'n' in the source file is changed to an 'X'.
Every 'a' in the source file is missing from the destination file.
Lazarus: a free, open source, Delphi- like compiler. And the really great thing is that the same source code is supposed to compile for Windows, Linux, or Mac!
I wasted dollars and hours trying to use Kylix, which seems to be dead. I read about Lazarus for many years... but, "so many projects, so little time".
Finally, on 26 July 2011, I tried Lazarus.
Now, I have to admit that I am writing this on 2 August, 2011... but so far Lazarus has been wonderful. It actually has (so far) failed to disappoint me.
I've started a page of Lazarus tutorials for you.
But the best news of all so far? I took one of my existing Delphi programs, the one that the page you are reading now is about, and it took me- a Lazarus novice- only about 20 minutes to have a Lazarus version of the program running!
I merely went into Lazarus, and then....
"It" being an application with memos, file opening and saving dialogs... not entirely trivial! I didn't have to "tweak" the code, just copy what was in the Delphi application into the Lazarus shell.
If you visit 1&1's site from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service. They offer things for the beginner and the corporation.
Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org
....... P a g e . . . E n d s .....