5. The possibility of data exchange between additions. Additions can exchange data through the buffer of exchange, the DDE (Dynamic Data Exchange) and OLE mechanisms (Object Linking and Embedding is communication and introduction of objects).
6. Event-guided programming. In the basis of the work of the programs under the management of Windows the principle of management by events is put. It means that the system itself and additions after the start directed on the implementation expect the actions of the user and react on them by the beforehand set appearance. Arbitrary action of the user (the pressure of the key on a keyboard, clicking by the mouse, moving of mouse button) is named an event. An event is perceived by the program and is transformed into the message - the record, which contains necessary information about an event (for example, which key is pressed, where the clicking by the mouse button took place). Not only the user but also the operating system itself, and also other additions can be the source of events. Each addition contains the cycle of working on messages, which chooses the messages from the turn and through the operating system causes the program intended for working on this event. Thus, the Windows additions consist of the main program, which contains actions as to initialization and completion of the addition and the cycle of the working on messages, and the set of the programs which work over concrete events.
The Delphi Interface
The system of visual object-oriented programming Delphi is intended for working out the additions of the operating system Windows. The VCL (Visual Component Library) library, which contains components for construction of interface of additions, and also structures for saving and working of information is included into Delphi.
The interface of the Delphi programming environment consists of several windows. The main window which contains menus and tool bars is located above. The panel which contains the library of components is called the palette of components. It consists of a few insets on which components are grouped according to their functional sign. The window of inspector of objects is disposed on the left. In its overhead part there is a list, that opens up and contains the list of components which are in the complement of application. For a select object its properties (Properties) and events (Events) which he can react on are represented on two insets. With the help of the inspector of objects properties and procedures of objects, that work over events related to this object are set. Basic part of the screen is occupied by the purveyance of form, that is the window of a future application. A form is intended for placing components. Under the form there is the window of editor of code in which the program text is written.
The creation of the program in Delphi
The process of creation of the Windows addition by Delphi consists of two basic stages: visual planning, that is the creation of outside type of application, and determination of its conduct by writing the procedures of working over events.
The visual planning consists in placing component on a form and determination of their properties with the help of the inspector of objects. The simplest method of placing the component is a double clicking by the mouse button on the proper sign on the palette of components, here the component takes place in the center of the form. Then it is possible to change its place and size by a mouse. The inspector of objects represents the properties of presently chosen components. Grant of values to properties of the component or their change is carried out in the inspector of objects by the choice from the list of possible values or by taking out of the necessary meaning from the keyboard. If next to the property there is a sign +, it means that this property is an object which contains other properties, for access to them it is needed to click on a sign +.
For determination of the conduct of the program the events, which are on the inset of the Events inspector of objects are used. The template of procedure for working over the event is caused by the double clicking on the field, located on the left from the title of the proper event. For each component the set of events which it can react on is certain. The following events are used more often:
OnActivate - at getting the object of focus of input;
OnClick, OnDblClic - at the single and double clicking by the mouse button;
OnClose - at closing the form;
OnCreate - at creation the form;
OnKeyDown, OnKeyUp - at pressure and setting of the keys free;
OnKeyPress - at pressure of the aplhabet-numeral key;
OnMouseDown, OnMouseUp - at pressure and setting of the mouse button free;
OnMouseMove - at moving the mouse;
OnPaint - at redrawing the form;
OnShow - comes each time when the property of the Visible object gets the True meaning.
Components of the NeoLog program
At the creating of the Neolog program the following components were used:
MainMenu - for the creating of the main menu of the program, with the help of which the choice of various actions is carried out;
DataSource, Table - for providing of communication with the files of database;
Label - for the reflection of comments on a form;
DBGrid - for the reflection and editing of records of database in a tabular form;
DBMemo - for introduction, reflection and editing meanings of the fields of database, which have the Memo type;
DBNavigator is implementation of actions above the records of database;
DBEdit - for introduction, reflection and editing the meaning of the fields of database, which have the letter type;
DBLookupComboBox - for introduction data information to the field of database by the choice from present variants and reflection of meanings of the fields of database;
StatusBar - for the reflection of common amount of records in a database and number of current record;
Panel - for the groupment of objects with the purpose of simplification of their management;
Edit - for introduction of the sought data;
Button - for the call of event connected with the working over the database;
GroupBox - for the groupment of objects under the name and creation of comfortable interface;
Memo - for the reflection and text editing;
SaveDialog - for organization of dialog of saving the text in a file;
OpenDialog - for organization of reading the text from a file.
Procedures were also written on working over the events that arose at the choice of commands from the main menu and clicking by the mouse button on the Button components.
Use of databases in Delphi
Four files of database are used in the NeoLog program. The structure of all files of database is created by the Database Desktop program which is in the system of the Delphi programming and is started by the Delphi (Tolls/Database Desktop) menu directly, or by the Windows menu