Question 1
This question is based on Block III – Unit 1 (Graphical User Interfaces) and Block III – Unit 2 (Designing Interfaces). It is intended to test your ability to work with Boralnd’s IDE to develop a simple application and make use of the IDE’s help system.
The question is divided into 2 parts, where in the first part you are asked to explore a new component of the VCL library and in the second part you are asked to develop an application that uses the new component.
Note: This question requires the resources that are available in the file MT262B_Spring_2010_TMA_Tools.zip
a. The component that you are asked to explore is the TShape component and is located under the Additional tab on the component palette.
i. If you were to use the TShape to represent a red circle on the form whose center is (200, 50) and radius 25 pixels, what are the properties that need to be set in the “Object Inspector” and to what values.
ii. Using the pointer declaration that you learnt in BlockIII – Unit 2, write down the statements that declare a pointer variable with identifier to a TShape with identifier “TempShape” and use it to create a TShape object at runtime.
b. Supplied in the Tools file for this TMA is a sample of a program where you need to develop a similar one. The following stages should help you develop the application:
i. Start a new application and add to the header file an include statement for the file Cleaner.h. Add to the project using the Project|Add to Project menu the file Cleaner.lib and save your files.
ii. Add components to the form and change the properties according to the following table, where you need to set their properties to reasonable values to have an application that looks and feels similar to “ShapesGP.exe”.

iii. In order not to let the user create so many circles or create circles outside the (DrawArea) you have to implement the following:
- Set the height and width of (DrawArea) to 345 each.
- Add code to the OnChange event of (InputBox) to check the value entered by the user and if it was > 15 then it should be automatically changed to 15.
- Add code to the OnChange events of (DiameterBox) to check the value entered by the user and if it was > 20 then it should be automatically changed to 20.
iv. Write the code for the GenerateButton OnClick event handler that takes the input provided in the edit boxes and generate shapes accordingly (You can check the requirements by testing the executable file available in the tools file). The declaration and creation of the shapes should be similar to Computer Activity 5.4 of Block III – Unit 2. However, to add an instance of the component (TempShape) as created in Part a, ii to the Panel (DrawArea), you have to use the following statement.
DrawArea->InsertControl(TempShape);
v. Write the code for the ResetButton OnClick event handler that resets all the components to their initial value. In order to remove the components from the Panel (DrawArea), you can simply call the function available in the library Cleaner.lib by using the following statement:
PanelCleaner(DrawArea);
وهذا الملفالمرفق موجود فيه الاسئله الثلاثه مع الملفات المطلوبه لكل سؤال