Lessons 37–38 · 2 lessons · N. I. Taylaqov (general editor), A. B. Akhmedov, M. D. Pardayeva, A. A. Abdug‘aniyev, U. M. Mirsanov. Informatics and Information Technologies, Grade 10, 1st edition. “Extremum-Press”, Tashkent, 2017
38
Practical lesson
Textbook: pp. 89–90
GoalBuilds a first application independently: sets size, position, title and colour, runs and tests it and saves it in the right folder.
New words
Save As: saving under a new name or in a new place · Save AsClose All: closing all files of the project · Close Alltesting: running the application to see the result · tekshirishcolour name: a constant such as clYellow · rang nomi
Explanation
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.
Worked examples
If the screen is 1920 pixels wide and the window is 600 pixels wide, to centre it horizontally Left = (1920-600)/2 = 660. If the height is 1080 and the window is 400, Top = (1080-400)/2 = 340.
A third application: Width = 300, Height = 300 (a square), Caption = 'Kvadrat', Color = clAqua. For the window to be square, Width and Height must be equal; its area is 300·300 = 90 000 square pixels.
Class activity
“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.
Practice
1
Which two properties must be equal for the window to be a square?
Width va Height
2
The screen is 1600 pixels wide and the window 400. What is Left for centring?
600
3
Which command closes all files of the application?
File – Close All
4
Why is it useful to save the application before testing it?
If something goes wrong during testing and the environment stops, the work is not lost.