Practical lesson
In this practical lesson do one or several of three small projects. 1) “Colour picture”: try the fades RGB(0, i, 255 - i) and RGB(i, i, 0), write down the colours of the left edge, the middle and the right edge in advance and compare them with the picture. 2) “Loading bar”: Interval = 100, global w: Integer; in the Timer w := w + 5; Rectangle(10, 10, 10 + w, 30); when w reaches 200 stop the Timer and show ShowMessage('Tayyor'); the bar fills in 200/5 = 40 steps, 40·100 ms = 4 s. 3) “A car”: a small shape moves from left to right with the step dx = 6 and stops when it reaches the right edge. Before starting write a project plan in your notebook: objects, properties, events and formulas. When showing applications to others avoid fast flashing colours on the screen, and share an application only as a trusted file that you made yourself: do not open unknown .exe files.
For a long process there is a loading bar on screen, and the program lengthens it by the same step each moment. The user sees how much waiting is left and waits more calmly. A programmer who knows the step and the time interval can work out the whole waiting time in advance.
App and website developers, game makers and designers show the waiting process with a loading bar.
Draw a strip of 10 boxes on paper, colour one box every 2 seconds, and work out in advance how long it will take to fill all of them.
| Step | w | Time |
|---|---|---|
| 1 | 5 | 100 ms |
| 10 | 50 | 1 s |
| 40 | 200 | 4 s |
“The project demo”: each student shows the plan of the chosen project, the calculated expected result and the application in 2 minutes.