Lessons 43–44 · 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
44
Practical lesson
Textbook: p. 98
GoalCreates applications in which size, font and colour are controlled with Labels and buttons, and checks the result by calculation.
New words
Font.Size: the size of the text · Font.SizeFont.Color: the colour of the text · Font.ColorLeft and Top: the position of an object · Left va Topinitial value: the value an object has before any action · boshlang‘ich qiymat
Explanation
In the practical lesson the “Font workshop” application is created: five Labels on the window with Font.Size values 10, 14, 18, 22 and 26, and one button. When the button is pressed each text grows by 3, and the last Label shows the text sizes. Change the colour of each Label with Font.Color in the Object Inspector and arrange them in a row by increasing Left. Then a second button returns the texts to the starting size. Before running the application each time, calculate the expected numbers by hand. Colour and font make an application attractive, but a text that is too small or the same colour as the background is hard to read: make sure it is easy to read.
Worked examples
The starting sizes are 10, 14, 18, 22, 26. After one click: 13, 17, 21, 25, 29; their sum is 13+17+21+25+29 = 105. After three clicks each has grown by 9: 19, 23, 27, 31, 35.
Placing the Labels: the first has Left = 20 and each next is 60 pixels further right. The fifth has Left = 20+4·60 = 260. If the window width is 300, the fifth text will not fit and will be cut off: the window must be widened or the gap reduced.
Class activity
“The readability test”: a group looks at the application from the back row of the class, judges which size and colour are easy to read and writes 3 recommendations.
Practice
1
What is Left for the fifth Label (first 20, step 60)?
260
2
If the sizes are 10, 14, 18, what is the sum after one +3?
51
3
What can be done to return the text to its starting size?
Write the starting value into each Font.Size again: Label1.Font.Size := 10; and so on.
4
Why should the text colour not be close to the background colour?
The text becomes hard to see and the user cannot read it.