This "tutorial" is mostly in the sourcecode that is supplied with it.
It was created 25 Jan 2019... and reflects many years of teaching programming, and of learning to present material on the web. And it is simple enough that it doesn't get into the tangles that, head hanging with shame, I have to admit exist in some of my free, oh by the way, offerings.
Fetch the .zip file, load it into your Lazarus IDE, and dig around in it, reading the rems.
I hope that you will find your way around relatively easily, and, while investigating the code, find useful tricks. More on what is there in a moment. First "the beef"...
I have posted a zip file with the sourcecode, and a compiled .exe... large swathes of that can be ignored, just used, if your main interest is playing with encrypting/ decrypting text.
The code can be used on two levels... even three!
The "third" way is to use it, as it is supplied, to encrypt text. A compiled .exe file is included, to make this easy for you. (And to let you "play" a bit with the "finished" app, to see what it's features are before you delve into the code.)
The as-supplied encryption might give a ten year old 15 minutes pause... 2 minutes, if he/she had a eureka moment.
But! The first way to use the code is to ignore almost everything in it, and merely revise the sEncrypt and sDecrypt functions, which you will find at the bottom of the code. Back up the code as supplied before you tinker with it! Start slowly. Try something simple. (Walk before you run.)
The remaining way to use the code is as a boilerplate, or at least guide, for doing certain general things in your own work.
Inside the code, you will see an example of using an ini file to "remember" the dimensions and position of the app's window between uses.
Look at how the constants sPrgmName and sVers are used. I comment that practice to you in all Lazarus work, for keeping track of what you are doing, and what version each of your projects (and each copy of each!) is in.
You'll see how to load .txt files to TMemo objects, and to save the contents of memos to text files.
Look at how the "unnecessary" constants kPlain and kEncry helped make the code in LoadMemo(bWhich:byte); and SaveMemo(bWhich:byte); easier to follow. (And, oh by the way, note how what might have taken four procedures was reduced to only two procedures by making the procedure more generally useful.
There's code to learn from that shows you how to work through the contents of a memo character by character.
Code that turns characters into numbers, and numbers into characters.
Test on Tuesday!
Feedback... or just a "that was useful"... always welcome. Maybe this could be a starting point for an assignment to a class doing Lazarus programming? What ideas did students come up with?
Search across all my sites with the Google search...
|
Page WILL BE tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes. There were two "unknown attributes" in Google+ button code. Sigh.
....... P a g e . . . E n d s .....