Our Euro Currency Convertor still doesn't do anything useful. In this lesson, we'll add some real code to the event handlers.
In lesson 3 we've put some temporary code in the event handler of EuroButton. But what should this event handler really do?
In this version of EuroCC, we'll replace the Buttons with RadioButtons.
We'll also introduce subroutines, which constitute the power of every real programming language.
To make decisions, a program has to determine wether a condition is TRUE or FALSE. This is done in a conditional statement, where the program flow splits up in two or more "branches".
In lesson 6, we talk about the IF statement.
In the final version of EuroCC we add some whistles and bells. An extra radiogroup allows setting the decimal fraction to 2 or to 4 digits. And we 'll handle the errors, in case some invalid value is entered.
In this lesson, we introduce the Case instruction, that replaces a number of nested if...then...else... statements.
By making our EuroCC program look at Windows' decimal separator, we "internationalize" it, so the user won't get an error in typing the wrong decimal separator. If necessary, a comma will be converted to a point, and vice versa.
And last but not least, we add a menu. Kind of kinky, adding the menu right at the end ;-)
Let's make some exercices. In lesson 9, you make a general Units Convertor, based on the "EuroCC" currency convertor. This application should convert lenght units (cm, meter, inch,...), volumes (liter, gallon,...) or whatever you want it to convert.
We give you a template project in file unicoen1.zip, where you have to fill in most of the coding. Afterwards, you can compare with the solution contained in unicoen2.zip.
Next, we'll discuss some ways to make the source code more compact and "structured". The source code for this part of the lesson is available as unicoen3.zip
In lesson 10 we create an extended version of the Units Convertor, using a TabControl.
You can download all of the lessons and their associated source code files, if you are a member of the DelphiLand Club.
Your membership allows you to download all of the lessons of this tutorial, plus the lessons of new tutorials, plus the mini-tutorials, function library, and so on...!
© Copyright 2000
Studiebureau Festraets