Practical lesson
In the practical lesson several small applications are created one after another. Each time open a new folder, start with File – New – Application, set the properties in the Object Inspector, test with F9 and save with File – Save All. The first application: Width = 500, Height = 350, Caption = 'Ilova 1', Color = clYellow, Left = 200, Top = 100. The second application opens near the middle of the screen: the window width is subtracted from the screen width and the result is divided by two, which gives the Left value. When testing, check both the size and the position of the window by eye and compare the result with the expected numbers. After the work close everything with File – Close All.
A pupil writing a small program changed only one property at a time and ran it to see. When the window suddenly looked odd, the pupil knew at once that the last change had caused it. Testing everything only at the end would have made finding the cause much harder.
Programmers, mechanics and electricians split complex work into small steps and test each one separately.
In your next multi-step job, such as drawing a picture, stop and check after each step, not just at the end.
| Quantity | Screen | Window | Start point |
|---|---|---|---|
| width | 1920 | 600 | Left = (1920–600)/2 = 660 |
| height | 1080 | 400 | Top = (1080–400)/2 = 340 |
“The window in the middle”: a pair chooses the window size, calculates Left and Top, tests the application and shows that the calculation matches the position on the screen.