Form and data module named
1. Name Standard of Form Type: The name of the form type should express the use of the form, and to add T prefix, follow the descriptive name, and finally Form.
For example: Student Form Type Name is: TSTudentform = Class (TFORM)
The type name of the user login form is: tuserenTryform = Class (TFORM)
2. Naming standard of the form instance: The name of the form instance is the same as the corresponding type name, but there is no prefix T.
E.g:
VAR
Student Form: TSTudentForm
UseERENTRYFORM: TUSERENTRYFORM
3. Automatically created form: Unless specifically reasons, only the main form is automatically generated. All other forms must be removed from the auto-generated list of the Project Options dialog.
4. Mode form instantiation function: All form units should contain instantiation functions, used to create, set, mode displays, and release forms. This function will return the pattern result returned by the form. Parameters passing to this function follow the rules of the parameters. It is necessary to encapsulate this, which is for the reuse and maintenance of the code. The variable of the form should be removed from the unit, and the form is defined as a local variable in the form (note, the form is required to remove the form from the Auto-generated list of the ProjectOptions dialog. Take the previous content).
For example, the following unit file demonstrates the instantiation function of getStudent.
UNIT STUDENTFRM;
Interface
Uses
Windows, Messages, Sysutils, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls
Type
TSTUDENTFORM = Class (TFORM)
Tedit;
Editname: Tedit;
Private
{Private Declarations}
public
{Public declarations}
END;
Function getStudent (var): string; var astudentid: integer: Word;
IMPLEMENTATION
{$ R * .dfm}
Function getStudent (var): string; var astudentid: integer: Word;
VAR
Studentform: TSTUDENTFORM;
Begin
Studentform: = TSTUDENTFORM.CREATE (APPLIC);
Try
StudentForm.caption: = 'getting student';
Result: = studentform.ShowModal;
If Result = MROK THEN
Begin
ASTUDENTNAME: = studentform. Editname.Text;
ASTUDENTID: = strt (studentform.editid.text);
END;
Finally
STUDENTFORM.FREE;
END;
END;
End.
5 Naming standard of the data module: Data Module Type Name should express its use, and to add a prefix T, follow the descriptive name, and finally DataModule.
For example: The type name of the Student data module is TSTudentDM = Class (TDataModule)
6 Naming standard for data module instance: The name of the data module instance should be the same as the corresponding type name, but there is no prefix T.
E.g:
VAR