2.5. Création du Premier Objet
2.5.1. Creating Object
It's time to create the first object - a table for storing and displaying information about users that will use the system. For convenience we divide the task into simpler steps:
•adding the object;
•grid design to display data from database;
•form design to input / output / change / delete data to / from the database.
To add an object:
2.5.1.1. Open the context menu clicking the right mouse button on the folder 1400 User;
2.5.1.2. Select New Object > Table;
2.5.1.3. In the window Properties in the field Object Code type in 1401;
2.5.1.4. In the field Object Name type in User;
2.5.1.5. Press Enter.
2.5.2. Grid Design
To design grid:
2.5.2.1. Move the mouse pointer to the object 1401 User in the folder 1400 User;
2.5.2.2. Open an item to change by double-clicking the left mouse button;
Note: if you want to study grid design process in detail, follow the steps 2.5.2.3 - 2.5.2.11. If you already know how to do this, skip the steps 2.5.2.3 - 2.5.2.11 and go to the step 2.5.2.12.
2.5.2.3. In the field Data Source specify the object - vw_users;
2.5.2.4. In system fields Record ID (a unique record ID), Date & Time (Created) (date and time when record was created), Date & Time (Updated) (date and time when record was updated), Date & Time (Closed) (date and time when record was closed), User ID (ID of the user who created the record), select accordingly fields user_id, dttmcr, dttmup, dttmcl, userid;
2.5.2.5. Open the context menu by right-clicking in the empty space of the object, choose Add a column and select columns user_id, user_fullname, user_login, user_password;
2.5.2.6. Select each column by clicking the left mouse button on any line of the table, specify in the field Caption the displayed name of the column - ID, Fullname, Login, Password accordingly;
2.5.2.7. Move the mouse pointer over the border between the headings of the first and the second column;
2.5.2.8. Click the left mouse button and, without releasing it, change the width of the first column;
2.5.2.9. In the same way set the required width of the other columns;
2.5.2.10. Select the last column and in the field Auto Size specify the value 1-Yes - column size will vary depending on the free space of the screen;
Note: you can use auto size for any one or more columns.
2.5.2.11. In the fields Allow Additions, Allow Editions, Allow Deletions select 1-Yes;
Note: the action Delete in ProjectDB program does not delete a record, but updates it's field Date & Time (Closed) with current time, after which the record is hidden. In such a way data is protected from accidental deleting. To display the record again dttmcl field in database table for this record should be updated with null value.
Deleting of records is possible if the field Date & Time (Closed) is set unspecified.
Thus there are two options for deleting:
- closing the record (if the field Date & Time (Closed) is specified);
- deleting the record (if specified field is blank).
Note: if you followed the steps 2.5.2.3 - 2.5.2.11, skip steps 2.5.2.12 - 2.5.2.17 and go to step 2.5.2.18.
2.5.2.12. Download the file archive containing the settings of objects;
2.5.2.13. Extract the files from the downloaded archive;
2.5.2.14. Open the context menu by right-clicking in the data area;
2.5.2.15. Select Import settings from the file;
2.5.2.16. In the appeared window specify the path to the file 1401_Table;
2.5.2.17. Click the Open button;
All table settings will be imported.
2.5.2.18. Save changes by selecting Menu > Save or by clicking the appropriate button in the toolbar.
2.5.3. Form Design
To change the form to input / output / change / delete a record to / from the database:
2.5.3.1. Go to Form Design by selecting View > Form Design, or by pressing the appropriate button in the toolbar;
Note: if you want to study form design process in detail, follow the steps 2.5.3.2 - 2.5.3.33. If you already know how to do this, skip the steps 2.5.3.2 - 2.5.3.33 and go to the step 2.5.3.34.
2.5.3.2. In the field Data Source choose database object - t_users;
2.5.3.3. In system fields Record ID, Date & Time (Created), Date & Time (Updated), Date & Time (Closed), User ID choose fields from the table - user_id, dttmcr, dttmup, dttmcl, userid;
2.5.3.4. Click the left mouse button on the Field button on the toolbar;
2.5.3.5. Move the mouse pointer to the data area;
2.5.3.6. Press the left mouse button and, without releasing it, outline the size of the field;
2.5.3.7. In the field Control Source select user_id;
2.5.3.8. Because user ID is automatically specified in the database, access to the field should be closed. Specify the value 0-No in the field Enabled;
2.5.3.9. In the field Back Color choose a background color;
2.5.3.10. Likewise add five more fields, each subsequent lower than the previous;
2.5.3.11. In the field Control Source for each of the added fields, choose accordingly user_name, user_surname, user_login, user_password, user_signature;
2.5.3.12. Click the left button of the mouse on the Label button on the toolbar;
2.5.3.13. Move the mouse pointer to the data area;
2.5.3.14. Press the left mouse button and, without releasing it, outline the size of label so that the label is left to the field user_id;
2.5.3.15. In the field Caption type in ID;
2.5.3.16. Likewise add five labels (one label per each field);
2.5.3.17. In the field Caption for each of the added labels specify accordingly First Name, Last Name, Login, Password, Signature;
2.5.3.18. Select Edit > Select All;
2.5.3.19. In the field Height specify the height of the elements - 0,6; press Enter;
2.5.3.20. Select all the labels by clicking the left mouse button and, without releasing it, outlining the area on the screen with the mouse pointer;
2.5.3.21. In the field Width specify the width of the labels - 3; press Enter;
2.5.3.22. Select all fields;
2.5.3.23. In the field Width specify the width of the field - 6; press Enter;
2.5.3.24. Select Edit > Select All;
2.5.3.25. Select Arrange > Align > Top;
2.5.3.26. Select Arrange > Align > Left;
2.5.3.27. Move the mouse pointer over the elements, press the left mouse button and, without releasing it, move all the elements in the upper left corner;
2.5.3.28. Move the mouse pointer to the lower right corner of the data area, press the left mouse button and, without releasing it, reduce the size of the data area to a minimum;
Note: if the border of the data area touches the border of the field, the field will be automatically resized depending on the screen size;
2.5.3.29. Select the field user_signature - this field will occupy the remaining space of the form and store multiple text lines, so scrolling of the text vertically should be allowed, specifying value 2-Vertical in the field Scroll Bars;
2.5.3.30. Open the context menu by right-clicking in the data area;
2.5.3.31. Select the menu item Tab Order;
2.5.3.32. Click the Auto button;
2.5.3.33. Click OK;
Note: if you followed the steps 2.5.3.2 - 2.5.3.33, skip steps 2.5.3.34 - 2.5.3.39 and go to the step 2.5.3.40.
2.5.3.34. Download the file archive containing the settings of objects;
2.5.3.35. Extract the files from the downloaded archive;
2.5.3.36. Open the context menu by right-clicking in the data area;
2.5.3.37. Select the menu item Import settings from file;
2.5.3.38. In the appeared window, specify the path to the file 1401_Form;
2.5.3.39. Click the Open button;
All settings of the form will be imported.
2.5.3.40. Save changes by clicking Menu > Save or by pressing the appropriate button in the toolbar;
2.5.3.41. Close the object by clicking the appropriate button.
2.5.4. Result
•folders to store configuration objects are created;
•first object 1401 Users is created.
2.5.5. Next