The choice of the delphi programming environment. Development environment and programming language Delphi, its graphical tools. Other IDE Tools


The practical work report contains 23 pages, 2 figures, 7 tables, 9 appendices and 3 sources.

Object of research - Development environment and programming language Delphi, its graphical tools.

The aim of this work is to study the Delphi programming language, use the syntactic and graphical tools of Delphi, compare the development environments and syntax of the C ++ and Delphi programming languages. For comparison, the programming environments Microsoft Visual C ++ and Delphi 7 are used. The comparison is carried out through the implementation of the solution of nine specific problems in Delphi.

DELPHI 7, OBJECT-ORIENTED PROGRAMMING, MICROSOFT VISUAL C ++, DEVELOPMENT ENVIRONMENT, C ++ AND DELPHI COMPARISON

Introduction

1. Comparison of languages ​​with / with ++ and pascal / Delphi

1.1 Simple data types

1.2 Structural data types

1.2.1 String variables

1.2.2 Arrays

1.2.3 Sets

1.2.4 Files

1.2.5 Classes

1.3 Pointers

2. Comparison of development environments

2.1 Borland Delphi 7

2.2 Microsoft Visual C ++

Conclusion

List of links

Appendix A

Appendix B

Appendix B

Appendix D

Appendix D

Appendix E

Appendix G

Appendix H

Appendix I

INTRODUCTION

At the moment, a significant part of the software is implemented using object-oriented programming methods. Now this area of ​​programming is in great demand. Therefore, mastering this programming style is very relevant.

To study this programming style, the Delphi 7 language was chosen, with the help of which the methodology of object-oriented design of programs for formalization and problem solving, technological methods for the development of object-oriented programs was studied.

The reason for choosing this programming language also lies in its graphical means.

Delphi is a programming development tool that takes place within Microsoft Windows applications. Delphi is an up-to-date and easy-to-use program that is needed to generate stand-alone GUI programs or 32-bit console applications - programs that exist outside of the GUI, instead, according to the so-called "DOS box".
Delphi is the first programming language that breaks the barrier between complex and lightweight applications and low-level bit-based programming.

1.C / C ++ AND PASCAL / DELPHI LANGUAGES COMPARISON

1.1 Simple data types

The type defines the set of values ​​that program elements can take, and the set of operations allowed on these values.

Data types can be divided into the following groups:

Structural;

Pointers;

Procedural (Delphi only)

Simple types do not contain other types, and the data of these types can simultaneously contain one value. The simple ones include the following types:

Integer;

Literal (Symbolic);

Logical (Boolean);

Real.

In table 1.1 you can see a comparison of the most common simple types in the C ++ and Delphi programming languages.

Table 1.1 - Comparison of simple data types in C ++ and Delphi

For each type of data, there are separate functions that make it easier to work with them. Table 1.2 lists some functions for variables with simple data types in C ++ and Delphi syntax.

Table 1.2 - Functions for simple data types in C ++ and Delphi

Differences can be seen not only in the data types themselves, but also in working with variables. To create a variable in C ++, you need to write the type variable name. In Delphi, the creation of a variable looks like this: variable name, colon, type name. Moreover, in C ++ a variable can be declared anywhere in the program, while in Delphi only in the var section. For assignment in C ++ the sign = is used, in Delphi -: =. The assignment operation in both programming languages ​​takes what is to the right of the sign and places it in the variable to the left of the assignment sign.

Let's consider the basic operations for working with variables of simple data types. Table 1.3 compares them in C ++ and Delphi.

Table 1.3 - Basic operations

Operation

Addition

Subtraction

Multiplication

Division (integer, simple)

/ (depends on data type)

Remainder of the division

Assignment

Equality check

Compound addition

Absent

Compound subtraction

Absent

Compound multiplication

Absent

Compound division

Absent

Composite remainder definition

Absent

Increment

Decrement

Logical NOT

Greater than or equal

Less than or equal

Logical OR

Logical AND

Logical exclusive OR

Pointer

Structure pointer

Determining the size in bytes

Bitwise NOT

Bitwise AND

Bitwise OR

Bitwise exclusive OR

Bit shift left

Bitwise shift to the right

When comparing operators, you can notice a clear flaw in Delphi, which manifests itself in the absence of compound operations (> =,<=, +=, -=, *=, /=, %=).

1.2 Structural data types

Now let's move on to comparing structural data types. Structural types are based on one or more other types, including structural ones. Structural types include:

Sets;

1.2.1 String variables

Delphi provides a string type that represents a string with a maximum length of about 2 characters. String characters are encoded in ANSI code. Since strings are actually arrays of characters, to refer to a single character in a string, you can specify the name of the string variable and the number (position) of this character in square brackets, for example, strName [i].

There are 2 types of strings in C ++: an array of variables of type char and a special class string. Unlike char, string is a class. This explains the need to include the header file and the presence of many functions for working with a variable of type String. A line element can also be accessed through its line number, indicated in square brackets. For example, strName [i].

1.2.2 Arrays

The arrays in the compared languages ​​are similar. The elements of an array can be data of various types, including structured data. Each element of an array is uniquely identified by the name of the array and the index (the number of this element in the array) or indices if the array is multidimensional. To refer to an individual element of an array, the name of this array and the number (s) of the element, enclosed in square brackets, are indicated. However, in Delphi, the description of an array is made in the section describing data types, while in C ++ - at any point in the program.

1.2.3 Sets

“Set” data types are similar to enumerated and interval data types, however, variables of multiple types can have several values ​​from the described enumeration at each time the program is running, and each value cannot be present in the set twice at the same time. The description of a multiple type variable in Delphi is as follows:

<Переменная>: Set Of<Тип>;

set<Тип> <Переменная>;

In C ++, a Set is an associative STL container that stores a sorted collection of unique objects. The set container contains many elements. Strictly speaking, set provides the following functionality:

1. Add an element to the set under consideration, while excluding the possibility of duplicates;

2. Remove an element from the set;

3. Find out the number of (different) items in the container;

4. Check if some element is present in the container.

1.2.4 Files

A file is a way of storing information on a physical device. There are no file operators in C ++. All necessary actions are performed using the functions included in the standard library. Working with files in C ++ and Delphi is similar, and consists of three steps:

The file opens. This means that the program "captures" the file specified by the name, informs Windows that it will work with it further. This step is necessary to avoid conflicts when several programs simultaneously want to write information to the same file. True, reading data from a file is obviously permissible by many programs at the same time, therefore, in the operation of opening a file, it is usually specified that the file is opened "for reading" (reading information that does not change) or "for writing" (data in the file is modified).

The operation of opening a file returns a certain identifier (as a rule, an integer), which identifies in the program the required open file in the future. This identifier is stored in a variable; usually such a variable is called a file variable.

The file is being processed. Data is either read from it or written to it.

The file is closed. After this operation, it is again available to other programs for processing.

Table 1.4 shows a comparison of working with files in C ++ and in Delphi.

Table 1.4 - Comparison of working with files in C ++ and in Delphi

Action

File declaration

FILE * identifier;

var identifier: File;

Opening a file for writing

fopen (physical file name, “w”)

fopen (f, “w”);

AssignFile (logical file name, file name);
ReWrite (logical file name);

AssignFile (myFile, "Test.txt");
ReWrite (myFile);

Write to file

fwrite (address of the value to be written, the size of one instance, the number of values ​​to be written, the name of the logical file);

fwrite (& dat, sizeof (int), 1, f);

WriteLn (logical file name, text);

WriteLn (myFile, "Hello World");

Closing the file

fclose (logical file name);

CloseFile (logical file name);

CloseFile (myFile);

Opening a file for reading

fopen (physical file name, “r”)

Reading from a file

fread (address of a value, size of one instance, number of read values, name of a logical file);

fread (& dat, sizeof (int), 1, f);

ReadLn (logical file name, variable to read);

ReadLn (myFile, text);

End of file check

Opening a text file to add entries to the file (appends to the end of the file)

fopen (physical file name, “a”)

Append (logical file name);

1.2.5 Classes

The C ++ class mechanism allows users to define their own data types. For this reason, they are often referred to as custom types. A class can provide additional functionality to an already existing type.

A C ++ class definition consists of two parts: a header, which includes the class keyword followed by the class name, and a body, enclosed in curly braces. After such a definition, there should be a semicolon:

class ClassA (/ * ... * /);

Inside the body, member data and member functions are declared and the access levels to them are specified. Thus, the body of a class defines a list of its members. Each definition introduces a new data type. Even if two classes have the same member lists, they are still considered to be different types. Once the class type has been defined, it can be referenced in two ways:

1. write the keyword class, and after it - the name of the class;

2. specify only the class name.

Both ways of referring to a class type are equivalent. The first is borrowed from the C language and remains the correct method for specifying the class type, and the second was introduced in C ++ to simplify declarations.

The member functions of a class are declared in its body. This declaration looks exactly like a function declaration in the scope of the namespace.

Member functions differ from regular functions as follows:

1. The member function is declared in the scope of its class, therefore, its name is not visible outside this scope. A member function can be accessed using one of the member access operators, the period (.) Or the arrow (->):

ptrScreen-> home ();

myScreen.home ();

2. Member functions have the right to access both public and private members of the class, while ordinary functions can only access public ones. Of course, member functions of one class usually do not have access to the member data of another class.

In Delphi, class descriptions are divided into two parts - interface ("header") and descriptive. The interface part contains the class header, which contains the name of the class that identifies it in the program, as well as descriptions of properties and method headers. The descriptive part contains the program code (implementation) of the methods, the titles of which are indicated in the interface part of the class description. The interface part of the class description is located in the sections describing the data types of modules and the main parts of the programs. It looks like this:

<Имя класса>= class (Description Title)

<Имя свойства 1>: <Тип свойства 1>; (Property Description 1)

<Имя свойства М>: <Тип свойства N>; (Property Description N)

<Заголовок метода 1>; (Method Description 1)

<Заголовок метода М>; (Description of method M)

The descriptive part of the class is in the section describing local routines. Methods declared in the interface part are implemented according to the usual rules for describing procedures and functions. To link subroutines with the class whose methods they are, the class name is indicated before the name of the subroutine itself:

Procedure<Имя класса>.<Имя метода>(<Список параметров>);

or for function methods:

Function<Имя класса>.<Имя метода>(<Список параметров>):

<Тип значения>;

The difference between methods and ordinary procedures and functions is that they can refer to class properties by name without specifying objects. At the stage of program execution, such calls will be redirected to the properties of the objects from which the corresponding methods are called.

Table 1.5 shows a comparison of object-oriented programming paradigms in the programming languages ​​C ++ and Delphi by examples.

Table 1.5 - Comparison of OOP paradigms in C ++ and Delphi

Paradigm name

Encapsulation

int a, b; // data of the open interface

int ReturnSomething (); // public interface method

int Aa, Ab; // hidden data

void DoSomething (); // hidden method

TMyClass = class

FMyField: Integer;

procedure SetMyField (const Value: Integer);

function GetMyField: Integer;

property MyField: Integer read GetMyField write SetMyField;

Inheritance

class A (// base class

class B: public A (// public inheritance

class C: protected A (// protected inheritance

class Z: private A (// private inheritance

TAncestor = class

// Virtual procedure

procedure VirtualProcedure; virtual; abstract;

procedure StaticProcedure;

Heir:

TDescendant = class (TAncestor)

// Overlay virtual procedure

procedure VirtualProcedure; override;

procedure StaticProcedure;

Polymorphism

// Overloaded function

virtual void f ()

std :: cout<< "A::f";

class B: public A

// Overloaded function

std :: cout<< "B::f";

// base class

constructor Create (name: string);

function f: string; virtual;

// derived from base

constructor Create (name: string; gr: integer);

// Overloaded function

function f: string; override;

// derived from base

constructor Create (name: string; dep: string);

// Overloaded function

function f: string; override;

A detailed description of the concept of encapsulation is related to the concept of the scope of an identifier. The scope of an identifier (name of a variable, procedure, function, or data type) is a part of the program code in which this identifier can be accessed. The scope of a component identifier declared in a class description extends from its declaration to the end of the class definition, and also extends to all descendants of this class and to all class method implementations. The scope of a component identifier depends on the visibility attribute of the section in which the identifier is declared.

Table 1.6 lists the visibility attributes in Delphi and C ++.

Table 1.6 - Visibility attributes

Visibility attribute

Private - access is open to the class itself (i.e. to the member functions of this class)

Protected - access is open to classes derived from this

Public access is open to anyone who sees the definition of this class

Published - The fields, properties, and methods described in this section are called published. Their scope is equivalent to the scope of public descriptions. The difference is that information about them, with the exception of a number of types, for example real, is placed in the object inspector at the design stage of the program. Descriptions located immediately after the class header, when the compiler directive ($ M +) is enabled, are accepted by default as published.

1.3 Pointers

A pointer is a variable whose value range consists of memory addresses and a special value - address zero. The value of address zero is not a real address and is only used to indicate that the pointer cannot currently be used to access any memory location.

Pointers are used in two different areas. First, they allow you to take advantage of some of the benefits of indirect addressing, which is widely used in assembly language programming. Second, pointers offer a dynamic memory management technique: they can be used to access a dynamically allocated region of memory, commonly referred to as the heap, or heap.

Variables allocated on the heap are called dynamic. They often do not contain associated identifiers and can only be referenced through pointers and links.

Both C ++ and Delphi contain two basic operations on pointers: assignment and dereferencing. The first of these operations assigns an address to the pointer. The second is used to refer to the value in memory pointed to by the pointer.

When declaring a variable of type pointer in C ++, you must define the type of the data object, the address of which will contain the variable, and the name of the pointer, preceded by an asterisk (or a group of asterisks). Pointer declaration format:

type-specifier [modifier] * specifier.

The type-specifier specifies the type of the object and can be of any basic type, structure type, mixture (this will be discussed below). By specifying the keyword void instead of the type specifier, it is possible in a peculiar way to defer the specification of the type to which the pointer refers. A variable declared as a pointer to type void can be used to refer to an object of any type. However, in order to be able to perform arithmetic and logical operations on pointers or on the objects they point to, it is necessary to explicitly determine the type of objects during each operation. Such type definitions can be performed using a cast operation.

The keywords const, near, far, huge can be used as modifiers when declaring a pointer. The const keyword indicates that the pointer cannot be changed in the program. The size of a variable declared as a pointer depends on the architecture of the computer and on the used memory model for which the program will be compiled. Pointers to different data types do not have to be the same length.

The keywords near, far, huge can be used to modify the size of the pointer.

Below are some examples of declaring pointers in C ++.

unsigned int * a;

addres = & nomer;

(double *) addres ++;

The addres variable is declared as a pointer to an object of any type. Therefore, it can be assigned the address of any object (& is the operation of calculating the address). However, no arithmetic operation can be performed on a pointer until the type of data it points to is explicitly determined. This can be done by using a cast operation (double *) to convert addres to a pointer to double and then increment the address.

There are 2 kinds of pointers in Delphi: typed and untyped. An untyped pointer is a variable that stores the address of some memory area of ​​a certain size, and is designed to store arbitrary data. Typed references point to a location in memory where data of a particular type is stored.

Variables - untyped pointers are described with an indication of the Pointer type, and allocation and freeing of memory for them is carried out, respectively, by the GetMem and FreeMem commands. The use of untyped pointers is limited to standard functions that take such variables as parameters, as well as low-level programming.

To describe a typed reference, no special data type is provided, unlike untyped pointers of the Pointer type. Since a reference variable of this kind always points to data of a specific type, its description is built on the basis of this type. The "^" operator is used to indicate the referential nature of variables, and the description looks like this:

Var<Переменная>:^<Название типа>;

Or in the section describing data types:

Tour<Новый тип данных> =^<Тип данных>;

After the description of the pointer variable, memory is allocated for it only for storing the address, and for the data itself, which the variable points to, memory is not allocated. To initialize the variable, the New procedure is used, which differs from the analogous GetMem procedure used for working with untyped pointers, in the absence of a second parameter that determines the size of the allocated memory. This is due to the fact that a typed reference points to data of a known type; accordingly, the size of this data is also known to the compiler.

Table 1.7 shows some of the differences between the C ++ and Delphi syntax in the area of ​​pointers.

Table 1.6 - Difference between pointers in C ++ and Delphi

As we can see, there are some differences in working with pointers and addresses in C ++ and in Delphi, but the general structure of working with them is inherent in both languages.

2. DEVELOPMENT ENVIRONMENT COMPARISON

2.1 Borland Delphi 7

After loading the Delphi 7 programming environment, the main window will appear on the screen.

The upper part of the window is occupied by the menu and the toolbar. On the left side of the window are the Object TreeView and the Object Inspector. In the center is the form for the application being developed and the form for submitting the code.

Object TreeView - serves to display all objects located on the current form of the project being developed.

Object Inspector - serves to display and edit the properties of components located on the form of the developed application.

A project is a collection of files that are used by the development environment for the final generation of a program. When we create the first project with you, we will get acquainted with all the components of the project and its structure.

Now let's look at the composition of the main menu. It allows you to call all the tools you need to work with the project. The following are the purpose of the menu section and related functions:

File - contains a set of commands for working with files, allows you to create new projects, add new files to a project based on various templates, rename project files, and print them. This also includes the command to close the development environment;

Edit - here, in accordance with the name, there are commands for editing text, deleting and moving it to the clipboard, pasting text from the clipboard and canceling editing operations. Search - contains a set of commands for working with text, its search and replacement, and both can be done both in one file and in all files of the project, or in any directory and its subdirectories;

View - this name combines commands for calling a project management tool, such as object inspector, form designer, project manager, etc .;

Project - designed to add and remove project modules, save a project, add projects to a group and remove them from it, compile both individual projects and all projects in a group, load the file of the project itself into the code editor, and also call the settings dialog project properties;

Run - allows you to start a project for execution both under a debugger and without it, configure the project parameter string at startup, debug, set breakpoints, step through the code, view the values ​​of variables and change them;

Component - commands for installing new components and component packages and creating new components and component templates are concentrated here;

Database - commands for managing data bases are concentrated here;

Tools - allows you to customize the properties of the Delphi working environment and the debugger, make repository settings, add and remove additional utilities, as well as commands for launching these same utilities;

Window - allows you to switch between windows if you open any module for editing in a new window;

Help - combines commands for invoking the Delphi help system and its settings, as well as allows you to refer to the Borland Web resources for additional information.

You can manually customize the toolbar. This was done for ease of use. To do this, call a dialog box using the View-Toolbars-Customize link.

The compilation process consists of two stages. At the first stage, the program text is checked for errors, at the second, an executable program (exe file) is generated.

After entering the text of the event handling function and saving the project, you can select the Compile command from the Project menu and compile. The compilation process and result are displayed in the Compiling dialog box (FIG. B38). The compiler displays Errors, warnings, and Hints in this window. The error messages, warnings, and hints themselves are displayed at the bottom of the code editor window.

Figure 2.1 shows the main window of the Delphi 7 development environment.

Figure 2.1 - Main window of Delpi 7

2.2 Microsoft Visual C ++

The Visual Studio family of products use a single integrated development environment (IDE) that consists of several elements: the menu bar, the Standard toolbar, various docked or autohide tool windows in the left, bottom, or right pane, and the editor pane. The set of tool windows, menus, and toolbars available depends on the type of project or file in which you are developing.

Figure 1. MV C ++ Home Page

The location of tool windows and other elements of the integrated development environment can change depending on the parameters applied and the settings made by the user during the work. The settings can be changed using the Import and Export Settings Wizard. By selecting the option Reset all parameters, you can change the default programming language.

You can easily move and dock windows using the visual diamond guide, or temporarily hide windows using auto-hide. For more information, see How to Guide. Placement and fixing of windows.

The IDE can be automated and extended using the Visual Studio automation model.

Solutions and projects contain items that represent links, data connections, folders, and files that are required to build an application. A solution container can contain multiple projects, while a project container usually contains multiple items.

Solution Explorer displays the solutions, the projects they contain, and the items for those projects. In Solution Explorer, you can open files for editing, add new files to a project, and view properties for solutions, projects, and items.

Visual Studio provides a powerful set of build and debugging tools. Build configurations allow you to select components to build, exclude components that you do not want to include in a build, and determine how selected projects will be built and for which platform. Build configurations are available for both solutions and projects.

The build process begins the debugging process. Building applications allows you to detect compile-time errors. These errors can include invalid syntax, errors in reserved words, and type mismatches. These types of errors are displayed in the Output window. After the application is finished building, you can use the debugger to detect and fix problems such as logical and semantic errors encountered at runtime. In pause mode, you can view local variables and other related data using tools such as Variable Windows and Memory Window.

CONCLUSION

delphi programming class array

During the implementation of this practical work, the tools of the Delphi programming language were studied and mastered. Also, the result of this work is a comparison of the C ++ and Delphi languages. The graphic means of the language were mastered. In the course of the work, the methods of object-oriented programming and design, the enumeration method, the accumulation method were used.

Work with text and binary files of direct access, work with dynamic data structures, work with character and tag data, recursion, inheritance, encapsulation, polymorphism, work with Delphi components, such as StringGrid, Memo, Edit, RichEdit, Label, Button , GroupBox, Timer, etc.

The result of the work is nine programs written in the Delphi programming language using graphical tools and an object-oriented system.

LIST OF REFERENCES

Sukharev M. Basics of Delphi professional approach. - NIT - St. Petersburg, 2004.-596.

Stevens R. Delphi Ready Algorithms. - DMK - Moscow, 2004 - 380.

Bankel D., Fundamental algorithms and data structures in Delphi.-DS - Moscow, 2003. - 555s.

Similar documents

    Studying the general structure of the Delphi programming language: the main and additional components of the programming environment. Syntax and semantics of the Delphi programming language: the alphabet of the language, elementary constructions, variables, constants and operators.

    term paper, added 05/17/2010

    Delphi is a rapid development environment that uses the typed object-oriented language Delphi as its programming language. Software package options. Features of work, screen view after launch. Description of the structure of the program.

    term paper added on 11/25/2014

    Designing a software module in the Borland Delphi 7.0 programming environment. Schemes of algorithms for solving problems on the topics "Symbolic variables and strings", "Arrays", "Working with files", "Creating animation". Implementation of the program module, program code.

    practice report, added 04/21/2012

    Effective software development tools. Visual design and event programming technology. Designing dialog boxes and event handling functions. Verbal algorithm and procedures of the Borland Delphi 7 Studio program.

    thesis, added 05/21/2012

    Delphi as a development environment for Windows-oriented programs. Purpose and advantage of using electronic textbooks. Description of the capabilities of the Delphi 5 environment for the development of an electronic textbook. Use cases for Internet services.

    thesis, added 07/13/2011

    The subject of object-oriented programming and features of its application in Pascal, Ada, C ++ and Delphi environments. Delphi Integrated Development Environment: general description and purpose of the main menu commands. Delphi program procedures and functions.

    term paper, added 07/15/2009

    Basic techniques of working in the Delphi programming environment. Features of the technology for creating the simplest applications. Working with components of the application development environment. Input, editing, selection and output of information. Aspects of using the branching structure.

    manual, added 11/17/2011

    Features of developing applications for the operating system using the imperative, structured, object-oriented programming language Delphi. Formal start of the program. Highlighting the end of a program block. Listing and description of the program.

    term paper added on 08/04/2014

    Borland Delphi 7 as a universal development tool used in many areas of programming, functions: adding information about applicants to the database, generating reports. Consideration and characterization of the main components of Delphi.

    test, added 10/18/2012

    Software overview. Description and properties of the Delphi language. Basis for development, its purpose, requirements, stages of development. Description of the scheme of the main module, procedures, programs. Used hardware and software.

To confirm the fact of the continuity of the terminology used, Figure 1.2 shows a general view integrated development environment(IDE - Integrated Development Environment) Delphi. In this figure, all the main components of the development environment are marked: the Main Window, the Component Palette, toolbars, the Form Designer window, the Code Editor window, the Inspector window. Object Inspector, Object TreeView, and Code Explorer.

Main window

Main window think of it as the control center of the Delphi IDE. This window has all the standard functionality of the main window of any other Windows program. It consists of three parts: the main menu, toolbars, and the component palette.

Main menu

As with any Windows program, the menus are accessed to open, save, or create a new file, invoke a wizard, switch to another window, change settings, etc. Each element of the main menu can be duplicated by the corresponding button on the toolbar.

Delphi Toolbars

Toolbars provide access to various functions of the IDE's main menu with a single click on the corresponding button. Please note that for each button on the toolbar, a prompt is displayed with a description of its purpose. Apart from the component palette, the Delphi IDE has five separate toolbars: Debug, Desktop, Standard, View, and Custom. In fig. 1.2 shows the default configuration of the buttons on these panels. However, any of the buttons can be removed or added by selecting Toolsbars, Customize from the View menu. In fig. 1.3 shows the Customize dialog box for customizing toolbars. To add a new button to any toolbar, simply drag it out of this window. To remove a button, simply drag it outside the toolbar.

Toolbars Object tree Main window Form designer window

Component Palette Object Inspector Window Code Explorer

Code editor window Rice. 1.2.General view of the integrated development environment (IDE) Delphi 6

Rice. 1.4.Floating toolbars

Component palette

The Component Palette is a double-height toolbar with multiple tabs that contain all the VCL and ActiveX components installed in the IDE. The order and appearance of tabs and components can be configured by right-clicking on the object of interest or in the main menu (Component, Configure Palette).

Form constructor

When launched, the Form Designer is an empty pane ready to be turned into a Windows application window. It can be thought of as an artist's canvas for creating a graphical interface for a future application - it defines how it will look from the user's point of view. The creation process consists of selecting components from the palette and dragging them onto the form. The exact placement and sizing of components can also be done with the mouse. In addition, it is possible to control the appearance and behavior of components from the Object Inspector and Code Editor windows.

Object inspector

In the Object Inspector, you can change the properties of form components or define events to which the form itself or its components will react. Properties(properties) are data that determines how the object looks on the screen - size, color, font, etc. Developments(events) are chunks of code executed in response to some action taking place in the application. An example of an event is the arrival of a message from the mouse or the transmission of a message to a window requiring it to be redrawn. In the Object Inspector window, to switch between working with events and working with properties, the standard tab technology(notebook tab) - to switch to a particular tab, just click on its spine. The inspector displays events and properties related to the form or component that is currently active in the form designer.

One of Delphi's features is the ability to organize the contents of the Object Inspector, either by category or by name (alphabetically). To do this, just right-click anywhere in the Object Inspector window and select Arrange from the context menu that opens. In fig. 1.5 shows two side-by-side Object Inspectors. In the left window, objects are sorted by category, and in the right window - by name. In addition, using the View item of the same context menu, you can determine which categories of objects should be presented at the moment.

One of the most valuable sources of knowledge that you should be able to use

Any Delphi programmer can use the help system. It is fully integrated with the object inspector, and if you ever have any difficulties with properties or events, you just need to press the key. - and WinHelp comes to the rescue.

Code editor

Rice. 1.5.Content presentation

The Code Editor window is intended for entering program text. It also displays the code automatically generated by Delphi for the components of the designed form. The Code Editor window uses tabbed technology, with a separate tab created for each module or file. Each time a new form is added to the application, a new module is created, and a corresponding tab is added to the Code Editor window. The shortcut menu of the Code Editor window provides a wide range of editing commands, including commands for working with files, creating bookmarks, and searching for symbols.

You can work with several Code Editor windows at once. To open a new window, re-

of the code editor, you must select the New Edit Window item in the main menu View.

The Delphi visual programming system is very popular among a wide range of users: from laymen to system programmers involved in the development of complex applications and information systems.

Delphi allows you to quickly and easily develop efficient applications, including database applications. The system has advanced capabilities for creating a user interface, a wide range of functions, methods and properties for solving applied computational and computational problems. The system has advanced debugging tools to facilitate application development. Traditionally, Delphi is referred to as rapid application development systems. At the same time, this system has almost all the capabilities of a DBMS, such as Microsoft Access and Visual FoxPro. It allows you to conveniently create applications using software tools, visually prepare database queries, and directly write SQL queries to databases. With regard to working with databases, Delphi provides a wide range of tools, supports modern technologies, including multi-level client-server technology.

Like any similar programming system, Delphi is designed for software development and has two characteristic features: programs created with its help can run not only under Windows control, but it itself belongs to the class of tools for accelerated program development. This acceleration is achieved through two inherent properties of Delphi: visual form design and extensive use of the library of visual components.

Visual form design relieves the programmer of many aspects of program interface development, since Delphi automatically prepares the necessary program templates and the corresponding resource file. The programmer uses a special window called the form window as a prototype of the future program window and fills it with components that implement the necessary interface properties (all sorts of lists, buttons, scroll bars, etc.). After placing the next component on the form, Delphi automatically inserts a link to the component into the module associated with the form and corrects a special form description file with the DMF extension, which, after compilation, is converted into a Windows resource file.

The library of visual components provides the programmer with a huge variety of program templates created by Delphi developers, which are immediately or after a simple setup ready to work within your program. The placement of objects in Delphi has a tighter relationship between objects and real code. The objects are placed into the generated form, and the code corresponding to the objects is automatically written to the source file. This code is compiled to provide significantly higher performance than a visual environment that interprets information only during program execution. The use of components not only significantly reduces the development time of programs, but also significantly reduces the likelihood of random software errors, from which, alas, no large software project is protected.

None of the accelerated program development tools are built without the tools to run and debug the newly created program. Delphi refines these tools to perfection. You can start using the program and sequentially - operator by operator - follow its execution according to the source text. At any time, you can find out the current value of the variable and, if necessary, change it without recompiling the program.

The above two features of Delphi

1) visual design of forms

2) the use of a library of visual components reflect the great advantages of this language and are positive aspects in the process of further development and creation of a package of automated techniques.

The power and flexibility of the Delphi programming language is the undoubted advantage of Delphi, which distinguishes this programming system from other software development tools. The core of Delphi is Pascal.

Delphi differs from Visual Basic by its strong typing, which allows the compiler to detect many errors at the compilation stage, as well as tools for working with pointers. Delphi has the fastest optimization compiler of its kind, allowing you to create fast and relatively compact programs.

Delphi eliminates the need to program general Windows components such as labels, icons, and even dialog boxes. Delphi allows you to tailor the components of the dialog box (for example, Choose File and Save File) to the task at hand, so that they work exactly as required by the application being created. There are also predefined visual and non-visual objects, including buttons, data objects, menus, and pre-built dialog boxes. Using these objects, you can, for example, provide data entry with just a few clicks of the mouse buttons, without resorting to programming. This is a visual implementation of the applications of CASE technologies in modern application programming.

In the process of creating projects in a Windows environment using Delphi, the following benefits are observed: the need to re-enter data is eliminated; the consistency of the project and its implementation is ensured; development productivity and program portability increases.

Visual programming kind of adds a new dimension to the creation of applications, making it possible to depict objects on the monitor screen before executing the program itself. Without visual programming, the rendering process requires writing a piece of code that creates an object in place. It was only possible to see the encoded objects during program execution. With this approach, getting objects to look and behave in a given way becomes a tedious process that requires repeated corrections of the program code, followed by running the program and observing what happens in the end.

With visual development tools, you can work with objects in front of your eyes and get results almost immediately. The ability to see objects as they appear during program execution eliminates the need for many manual operations, which is typical for working in an environment that does not have visual means - regardless of whether it is object - oriented or not. After the object is placed in the form of the visual programming environment, all of its attributes are immediately displayed in the form of code that corresponds to the object as a unit that is executed in the course of the program.

The Delphi environment includes a complete set of visual tools for rapid application development (RAD) that support user interface development and enterprise database connectivity. VCL is a library of visual components that includes standard objects for building user interface, data management objects, graphic objects, multimedia objects, dialogs and file control objects, DDE and OLE control. Delphi's visual components are open to add-on and rewrite.

This object library includes standard UI building objects, data management objects, graphics objects, media objects, dialogs and file control objects, DDE and OLE control.

The Delphi environment consists of four windows, managed as a multi-window application with a single document interface (Figure 1). The main Delphi window manages its associated windows — the object inspector, the form, and the code editor window.

Figure 1 - The interface of the main windows of the Delphi environment

The main window (Figure 2) is the development control center. It contains the menu, the Quick Access Toolbar (SpeedWag) and the Component Palette. The menu bar gives you the ability to control all windows of the development environment. The Quick Access Toolbar provides quick access to common operations. The component palette consists of several groups, each of which contains component icons. Having indicated the required component in the palette, you can drag it (by clicking the mouse) to the form window. This creates an active object, for which, using the object inspector, you need to set properties and describe reactions to events that will occur with this object when solving a problem.

Figure 2 - Main window

The object inspector window (Figure 3) is a multi-page window that contains shortcut property pages (Propeperties) and events (Events). The property sheet shows the properties of objects located in the Form window. The events page shows the events to which the objects of the form window react. The Object Inspector consists of two pages, each of which can be used to define the behavior of a given component. The first page is the list of properties, the second is the list of events. If you need to change anything related to a specific component, you usually do it in the Object Inspector. For example, you can change the name and size of the TLabel component by changing the Caption, Left, Top, Height, and Width properties.

You can use the tabs at the bottom of the Object Inspector to switch between property and event pages. The event page is linked to the Editor; if you double-click on the right side of any item, then the code corresponding to this event will be automatically written to the Editor, the Editor itself will immediately receive focus, and you can immediately add the code for this event handler. This aspect of the Delphi programming environment will be discussed later.

The Object Inspector allows you to define the properties and behavior of objects placed on a form. The information in it changes depending on the object selected on the form. It is important to understand that each component is a real object, and you can change its appearance and behavior using the Object Inspector.

Delphi programmers spend most of their time switching between the Form Designer and the Source Text Editor Window (called the Editor for short). Let's talk in more detail about each window of the Delphi environment.

The form window (form designer window) (Figure 4) contains components (objects), with the help of which the user sets and receives from the program all the information necessary to interact with the task during its execution.

Figure 3 - Object Inspector

The Delphi Form Designer is where you create the visual interface of the program. It's so intuitive and easy to use that creating a visual interface is child's play. The Shape Designer initially consists of one empty window, which you fill in with all sorts of objects selected in the Component Palette. Despite the importance of the Form Designer, the place where programmers spend most of their time is the Editor. Logic is the driving force behind the program and the Editor is where you "code" it.

Figure 4 - Form Designer

Despite the importance of the Form Designer, the place where programmers spend most of their time is the Editor.

The code editor window (Figure 5) makes it possible to type and edit the code of the program module in the Object Pascal language. This window is multi-page, it allows you to navigate between program modules. Logic is the driving force behind the program and the Editor is where you "code" it. In the Editor window, you create the logic for controlling the program.

Figure 5 - Editor Window

In the main window, it is customary to highlight three main highlighted elements (not counting the standard title bar):

Menu bar (Menu System);

Component palette;

Quick Access Toolbar (SpeedBar).

The menu (Figure 6) provides a fast and flexible interface to the Delphi environment, because it can be controlled by a set of "hot keys".

Figure 6 - Menu bar

In this sense, designing in Delphi is not much different from designing in an interpreter environment, but after compilation, we get code that is executed 10 to 20 times faster than the same thing done using the interpreter.

It is also convenient because it uses words or short phrases that are more precise and understandable than icons or pictograms. You can use the menus to perform a wide variety of tasks; most likely for the most common tasks like opening and closing files, controlling the debugger, or setting up the programming environment.

The Component palette (Figure 7) allows you to select the desired objects to place them on the Form Designer. To use the Component Palette, simply first click on one of the objects and then click on the Shape Designer a second time. The object you have selected will appear on the projected window and can be manipulated with the mouse.

Palette Component uses page-by-page grouping of objects. At the bottom of the Palette there is a set of tabs - Standard, Additional, Dialogs, etc. If you click on one of the tabs, you can go to the next page of the Component Palette. The pagination principle is widely used in the Delphi programming environment and can be easily used in your program (the Additional page has components for organizing pages with tabs at the top and bottom).

Figure 7 - Component Palette

The SpeedBar (Figure 8) is directly below the menu, to the left of the Component Palette. The SpeedBar does a lot of what you can do through the menu. If you hold the mouse over any of the icons on the SpeedBar, you will see that a tooltip will appear explaining the purpose of this icon.

Figure 8 - SpeedBar

The last important part of the Delphi environment is the on-line help, (Figure 9). To access this tool, simply select Help from the system menu and then Delphi Help.

Figure 9 - Reference

The Picture Editor (Figure 10) works similarly to the Paintbrush program from Windows. You can access this module by selecting Tools | Image Editor.

Figure 10 - Image Editor

Now we need to consider the elements that a Delphi programmer uses in everyday life. In addition to the tools discussed above, there are five tools that ship with Delphi. These tools are: a built-in debugger; external debugger (supplied separately); command line compiler; WinSight; WinSpector.

These tools are collected in a separate category, not because they are less important than others, but because they play a rather abstract technical role in programming.

To become a powerful Delphi programmer, you need to understand how to use the Delphi debugger. The debugger allows you to step through the source code of a program, executing one line at a time, and open a Watch window that displays the current values ​​of the program variables.

The built-in debugger, which is the most important of the five tools above, works in the same window as the Editor. The external debugger does everything the built-in does and something else. It is faster and more powerful than the built-in one. However, it is not that easy to use, mainly due to the need to leave the Delphi environment.

An external compiler, called DCC.EXE, is useful mainly if you want to compile an application before debugging it in an external debugger. Most programmers will probably find it much easier to compile in Delphi rather than trying to create a program from the command line. However, there are always a few originals that will feel happier using the command line compiler. But it is a fact - it is possible to create and compile a Delphi program using only DCC.EXE and another CONVERT.EXE program that will help create forms. However, this approach is inconvenient for most programmers.

WinSight and WinSpector are mostly of interest to experienced Windows programmers. This does not mean that a beginner should not run them and experiment with them on their own. But these tools are secondary and used for narrow technical purposes.

Of the two, WinSight is definitely the more useful. Its main function is to allow monitoring of the Windows message system. While Delphi does a lot to hide the intricate details of this messaging system from inexperienced users, Windows is nevertheless an event-driven operating system. Almost all major and minor events in the Windows environment take the form of messages that are sent out with great intensity among the various windows on the screen. Delphi gives you full access to Windows messages and allows you to reply to them as needed. As a result, WinSight is a must for experienced users. WinSpector saves a record of the current state of the machine to a text file; You can view this file in order to find out what is wrong with the program. This tool is useful when the program is in trial operation - you can get important information in case of a system crash.

Thus, work in the Delphi environment is based on object-oriented technology and visualization of the process of creating programs. This technology supports the construction of programs by defining objects and actions on them. The visual environment frees the developer from the need to know many technical details, which allows him to focus on the essence of the problem being solved, shortens the time frame and improves the quality of work. Having familiarized yourself with the Delphi programming environment, having considered its obvious advantages - visual design of forms and the use of a library of visual components, you can use this OOP product to create a package of automated techniques.

Send your good work in the knowledge base is simple. Use the form below

Students, graduate students, young scientists who use the knowledge base in their studies and work will be very grateful to you.

Posted on http://www.allbest.ru/

3.2 Description of the programming environment

3.2.1 Delphi Development Environment

Interest in programming is constantly growing. This is due to the development and implementation of information technology in everyday life. If a person deals with a computer, then sooner or later he has a desire, and sometimes a need, to learn how to program.

The Windows operating system family is currently the most popular among personal computer users, and it is natural that those who are going to program tend to write programs that will work on these systems. The rapid development of computer technology, the need for effective software development tools led to the emergence of programming systems focused on the so-called "rapid development", among which Borland Delphi and Microsoft Visual Basic can be distinguished. Rapid development systems are based on the technology of visual design and event-based programming, the essence of which is that the development environment takes over most of the generation of the program code, leaving the programmer to design dialog boxes and event processing functions.

Delphi- is a development environment for programs focused on operating systems of the Windows family. Delphi programs are created on the basis of modern visual design technology, which, in turn, is based on the ideas of object-oriented programming. Delphi programs are written in Object Pascal, which is the successor and development of Turbo Pascal. The Turbo Pascal programming language, as well as the integrated development environment of the same name, in which it was used, has gained wide popularity in the recent past as a software development tool and especially as a programming tool. This popularity was due to the simplicity of the language, a high-quality compiler, and a user-friendly development environment.

Delphi and Object Pascal are the results of a long evolution and are now products that reflect the most modern computer technology. In particular, this means that using Delphi, you can create a wide variety of types of programs - from console applications to applications for working with databases and the Internet.

3.2.2 Delphi IDE

Integrated Development Environment (IDE, in the future we will use the abbreviation IDE for it) is an environment in which there is everything you need to design, run and test applications and where everything is aimed at facilitating the process of creating programs. The IDS integrates a code editor, a debugger, toolbars, an image editor, a database toolkit - everything you have to work with.

Start Delphi using the Windows menu Start | Programs... When you click on the Delphi icon, you will see the main IDE window (see Figure 1). In general, the IDE windows are the same for all Delphi versions.

Fig 1 The main window of the IDE in Delphi6

At the top of the WIS window, you see main menu bar ... Its composition differs slightly from version to version and also depends on the Delphi variant you are working with.

The main menu allows you to call all the tools necessary to work with the project. Let's consider the purpose of the menu sections and related functions.

File(File)- contains a set of commands for working with files, allows you to add them to the project, create new files using templates, delete, rename and print. In addition, this section contains commands for creating new forms and applications, and an exit command. In Delphi 6, this includes a command to create a new Frame element.

Edit(Edit)- here, in accordance with the name, there are commands for editing text, deleting and moving it to the clipboard, pasting text from the clipboard and canceling editing operations. This section contains commands for controlling the position of components on the surface of a form, as well as commands for adding new properties, procedures, and functions to the interface of the ActiveX component you are developing. Using one of the section options, it is also possible to prohibit changing the position of components on the form.

Search(Search)- contains a set of commands for working with text, its search and replacement, and both can be done both in one file and in all files of the project or in any directory and / or subdirectories available at the moment. This section also contains a command to find text and errors with an explorer.

View(View)- under this name, commands are combined to call the most commonly used project management tools, such as ProjectManager(Project manager), TranslationManager(DLL Language Manager), ObjectInspector(Object inspector), To- Do- List(Task list), AlignmentPalette(Component alignment window), Browser(Researcher), CodeExplorer(Program guide), ComponentList(Component List), WindowList(List box) TypeLibrary(Type library), DebugWindows(Debugger window). The latter include Breakpoints(List of breakpoints), CallStack(Stack window), Watches(Variable control window), LocalVariables(Variables window), Threads(Thread status windows) Modules(Window of executable modules), Cpu(Variable control window), FPU(Window of operations on floating point numbers), EventLog(Events window). In addition, there is also a menu section ToggleForm/ Unit(Form / module switcher) and options Forms(Form window), Units(Modules window), NewEditWindow(New editing window), which, as the name implies, allow you to display windows of forms, modules and create a new editing window, as well as customize the toolbar. In addition to them, Delphi5 has the ability to save the current environment settings for later use using a group of commands from the section Desktops.

Project(Project)- designed to add a project to Repository(Object archive), load the project text editing window, add projects to a group, compile both a separate project and a group as a whole, check the correctness of the code in both cases, get information about the results of project compilation, set the properties of the web applications and export them to the web server, as well as call the element Options(Project properties window). In addition to these functions, Delphi5 has the ability to use a group of commands from the section Languages create a custom DLL with a resource file containing national language support.

Run(Run)-Allows you to run the developed application, pass it a string of parameters, debug, set breakpoints, perform step-by-step execution, view the values ​​of variables and change them. When developing ActiveX components, using menu commands, you can register an ActiveX server or delete an entry about it from the system registry. This menu also contains the option that is required to install the MTS Object on the Microsoft Transaction Server (MTS) for its further use under the control of this server. Delphi 5 introduces a section AttachtoProcess, which allows you to debug processes running not only on the local, but also on a remote computer.

Component(Components)- here are concentrated commands for installing components, importing ActiveX components, creating new components and component templates, editing packages, and customizing the component palette.

Database(Database)- contain commands for calling utilities for working with databases, such as SQLExplorer(Database Explorer), SQLMonitor (SQLmonitor) and Form Wizard(Form wizard).

Tools(Service)- allows you to set the properties of the Delphi working environment and the debugger, configure the project archive, add or remove additional utilities for working on a project. In Delphi 6, this section includes a command that can be used to open another archive - TranslationRepository where resource strings with national alphabet are stored.

Help(Help)- combines commands to invoke the Delphi help system and its settings, and also allows you to access the Web server for more information.

Below the main menu bar there are two toolbars. The left panel contains two rows of quick buttons that duplicate some of the most commonly used menu commands.

SpeedBar(Toolbar) allows you to organize quick access to the Delphi tools you need.

To customize the toolbar, select the section View => Toolbars main menu or use the pop-up menu of the toolbar. After that, specify which of the groups of "quick" buttons should be displayed on the Available panel Standard(Standard), View(View), Debug(Debugger), Custom(Custom), ComponentPalette(Component palette). You can select those of them that are necessary for the work, and in addition, determine which "quick" buttons will be included in each of the groups.

The toolbar is configured as follows. First select a section of the popup menu Customize(User settings) and in the window that appears (see Fig. 2) open the page Commands(Commands). Next, use the mouse to select the icon of the option you need in the right window and drag it to the toolbar. To remove unnecessary buttons, just drag them from the toolbar to the window Commands.

In addition to this, using the page Options(Options) of this window, you can set whether or not to show the tooltip (line Showtooltips(Show the names of tools)) when you move the cursor over the buttons on the toolbar and whether or not to include in the tooltip a combination of "hot" keys (line Showshortcutkeysontooltips(Show tool shortcuts)) to invoke a command triggered by clicking a button.

The right panel contains palette of components libraries of visual components.

Componentpalette(Component Palette) is one of the most commonly used Delphi tools. It consists of more pages on which components are located (see Figure 3). In the process, the user can create new pages and delete existing ones, add and remove components on any of the pages, change their order.

rice. 3 Component palette

Standard- standard Delphi control components. expanding the capabilities of the previous set;

Additional-Additional Delphi control components that extend the capabilities of the previous set;

Win32 - components that encapsulate a set of 32-bit windows interfaces (9x / NT);

System- specific system non-visual components of Delphi;

DataAccess- components for accessing databases;

DataControls- components for displaying information from databases;

ADO- components that allow you to connect to databases using ActiveX Data Objects (ADO);

InterBase- components designed to connect to InterBase databases without using the Borland Database Engine (BDE) or ActiveX Date Objects (ADO);

MIDAS- components for multi-tier database access technology;

InternetExpress-Components that allow you to create applications that can work with both Web Server application (Internet applications) and multi-tiered database (multi-tier applications);

Internet-components for working on the Internet;

FastNetcomponents- the components that enable applications to use different Internet protocols;

DecisionCube- components for multidimensional analysis of database information (only in the delivery of Delphi Client / Server);

QReport- components for the visual design of printed reports;

Dialogs- components that encapsulate standard Windows dialog boxes;

Win 3.1 - Windows 3.1 management components (for backward compatibility of applications ) ;

Samples- components that are used as examples in the documentation (their texts are located in the / DELPHI / SOURCE / SAMPLES / folder);

ActiveX- ActiveX components developed by third parties;

Serverspagecomponents-Components, which are VCL wrappers for popular COM servers.

The Component Palette may or may not appear in the Delphi Toolbar. This option is controlled using the View => Component Palette section of the menu. As in previous versions, the palette configuration is done without recompiling the VCL.

In the main field of the window, you can see the Object Inspector window on the left, with the help of which you will further set the properties of components and event handlers. This page consists of 2 columns: the left column contains the name of the property, and the right one contains the specific value of the property (see Figure 4)

rice. 4 Object Inspector

The Object Inspector window displays information for the component that is selected with a mouse click. The page rows of this window are clickable and can display simple or complex properties. Simple properties are properties that are defined by a single value - a number, a character string, False or True, and so on. Complex properties are defined by a collection of values. To the left of the name of such properties, the symbol "+" is indicated. Double-clicking on the name of such a property opens the list of complex property values. The expanded list is also closed by double-clicking on the name of the complex property. An interesting innovation in Delphi 6 is the addition of the so-called extended inline component links(expanded inline component references) or, in short, inline components. This term refers to certain properties of components whose values ​​are the names of other components (that is, references to other components).

For example, many components have a Popup Menu property that contains the name of the context menu component. Properties that contain a reference to an embedded component are displayed in red in the Object Inspector by default. When such a property is assigned a value, a "+" symbol appears next to it. If you double-click on the property containing the name of the built-in component, or simply click on the "+" symbol, the list of properties of the built-in component will open.

Inline component properties are displayed in green by default.

To the right, you can see a window of an empty form, ready to transfer components to it. Below it is the Code Editor window. Usually it is invisible at the first glance at the screen, since its size is equal to the size of the form and the Code Editor window is completely covered by the form window.

There is an inextricable relationship between the contents of the form window and the code editor window, which is strictly controlled by Delphi. For example, placing a component on a form automatically changes the program code. As mentioned above, stubs for event handlers are also automatically created. At the same time, the programmer can fill the blanks with specific content - insert operators, add descriptions of his own variables, types, constants, etc. At the same time, the programmer must remember that he cannot delete from the program text those lines that were inserted there by the Delphi environment.

3.2.3 Delphi project structure

A Delphi program is a series of related files. So, any program always consists of a project file already familiar to us (such a file has the .dpr extension) and one or several modules (files with the .pas extension). The project file is not intended for user editing and is created automatically by the Delphi programming system itself. In order to see the contents of the project file, you need to run the command Project | View Source. The content of the project file can be, for example, the following:

programProjectl;

Forms,

Unitl in "Unitl.pas" (Forml);

($ R * .RES)

Application.Initialize;

Application.CreateForm (TForml, Forml);

Application.Run;

end.

The project file (main module) begins with the word program, followed by the name of the program, which is the same as the name of the project. The name of the project is set by the programmer at the time of saving the project file, and it determines the name of the executable file created by the Delphi environment (file with the .exe extension). Then the word uses is followed by the names of the units used: the standard Forms unit and the Unitl form unit. A comment-like directive ($ R * .res) tells the compiler to use a resource file that contains a description * of the application's resources, such as icons. The asterisk indicates that the name of the resource file is the same as the project file, but with a .res extension.

The executable part of the main module is between the begin ... end statement brackets. Operators of the executable part provide initialization of the application and displaying the start window.

In addition to the main module, each program includes at least one form module, which contains a description of the application start form and the procedures supporting its operation. In Delphi, each form has its own module. To switch between the form and the window of the code editor containing the corresponding module, execute the main menu command View | Toggle Form / Unit, or press the F12 function key.

Modules are software units that are used to house fragments of programs. With the help of the texts of programs (program codes) contained in them, the task to be solved by the user is realized. Modules have a standard construction (sequence and list of sections) provided by the Object Pascal programming language. Let's give a general structure of the module:

unit< namemodule >;

interface

…………………………

implementation

…………………………

initialization

…………………………

finalization

…………………………

end.

As an example, let's give the contents of the module as it is immediately after loading the Delphi environment:

unitUnitl;

interface

Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls, Forms,Dialogs;

TForml= class (TForm)

{ Private declarations }

{ Publicdeclarations }

Form1:TForm1;

implementation

{$ R*. dfm}

end.

A unit begins with the word unit followed by the name of the unit. This name is mentioned in the list of used units in the uses statement of the main application unit.

A module can be divided into four sections: interface, implementation, initialization, and the final part.

The interface section (beginning with the word interface) tells the compiler what data in a module is available to other program modules. This section lists (after the word uses) the standard units used by this unit, as well as the Delphi-generated description of the form type that follows the word type.

The implementation section begins with the word implementation and contains declarations of local variables, procedures, and functions that support the form's operation. At the beginning of the implementation section there is a directive ($ R * .dfin), which tells the compiler to insert commands for setting values ​​of form properties into the implementation section, which are in a file with the extension ".dfm, the name of which is the same as the name of the module. dfm is generated by Delphi based on the appearance of the form.

The ($ R * .dfm) directive is followed by descriptions of the form event handling procedures. Here, the programmer can place a description of his procedures and functions that can be called from the event handling procedures.

The beginning and ending parts are optional. The initial part begins with the word initialization or is enclosed in the begin ... end operator brackets. The statements from this part are executed before control is transferred to the main program and are usually used to prepare its work.

The final part begins with the word finalization and contains statements that are executed at the end of the program.

In the above module example, the initiation and trailing parts are missing .

Unlike a project file created automatically by Delphi, a module can be modified (edited) by a programmer. When a user creates a new form, a new module will be automatically created as well. The program can contain up to several dozen forms. In this case, the text of the module will be available to both the user and the Delphi environment itself, which will automatically insert into the text of the module a description of any component added to the form, as well as create templates (lines of code) for event handlers. At the same time, the programmer can add his own methods to the previously declared classes, fill the event handlers with specific content, insert his own variables, types, constants, etc. But, as mentioned earlier, the programmer cannot delete lines inserted into the module text by the Delphi framework.

When compiling a program, Delphi creates files with .dcu extensions for each module.

Thus, the pas-file contains the program code of the module, which was generated in the code editor window by the joint efforts of the programmer and the Delphi environment, the file with the .dfm extension stores the description of the contents of the form window, and the dcu-file contains the result of converting text from both files into machine instructions. The Delphi IDE linker converts dcu files into a single bootable (executable) exe file. The executable file allows you to run a program as a stand-alone application.

3.2.4 Visual Component Library

The classes created by Delphi developers form a complex hierarchical structure called the Visual Component Library (VCL). The number of classes included in the VCL is several hundred. Figure 5 shows the base classes that are the ancestors of all other classes.

Components Instances of classes that are descendants of the TComponent class are called. Instances of all other classes are called objects. The difference between components and just objects is that components can be manipulated on a form, but objects cannot.

A typical example of a class that is defined in the VCL but is not a component is the TFont class. We cannot directly place an object of the TFont class on the form. On the other hand, when working, for example, with components such as Label or Edit, we will use the Font property of the TFont class type.

Posted on http://www.allbest.ru/

Note also that not all TComponent descendants are visual. For example, the Timer component for counting real-time intervals is non-visual.

The above is somewhat contrary to the name VCL - Visual Component Library, but, on the other hand, visual components are the main achievement of Delphi developers, those building blocks with which a skeleton of any application is created. The rest of the VCL classes are the basis for creating visual components or are of an auxiliary nature.

As mentioned earlier, in accordance with the principle of inheritance, Delphi components inherit data and methods for processing them from their parents. Therefore, before moving on to familiarity with specific components, it will be useful to become familiar with the base classes shown in Figure 5.

Description of the operating environment. Pros and cons of Windows 98

Like any program, Windows 98 has its strengths and weaknesses; let's start with the strong ones.

First, it's a fairly user-friendly user interface (although many find it somewhat confusing).

Secondly, all programs running under Windows 98 have a standard interface (as far as possible for programs that perform a wide variety of functions). In practice, this means that, while mastering a new program, you do not need to retrain every time, moreover, you will know how the basic, basic functions are performed (for example, opening a document).

Third, support for a wide variety of devices and the Plug and Play mechanism. Most new devices Windows 98 finds itself, automatically installing the necessary drivers for them, and this mechanism is improved over the previous version.

Fourth, almost complete top-down compatibility. All programs (with rare exceptions) written for Windows and MS-DOS versions work fine under Windows 98 as well.

Fifth, the multitasking mechanism and crash protection have been improved compared to the previous version (albeit only for programs specially written for Windows 95 and Windows 98). It is possible to execute several programs at the same time (while, for example, one program performs complex calculations, you can type text in another), besides, the crash (freezing) of one program does not cause data loss in all other programs at the moment.

Sixth, an improved upgrade mechanism - upgrading the operating system is now easy to implement over the Internet.

Seventh, built-in tools for work and integration with the Internet.

Eighth, more efficient work on computers with Pentium processors and older.

Ninth, the long-awaited OS-level color calibration and support for up to 7 monitors simultaneously.

You can endlessly consider the strengths of Windows 98 in comparison with other operating systems, but, perhaps, all the main ones have already been covered. Now about the weaknesses.

As you know, you have to pay for everything, and for all the conveniences of Windows 98 you have to pay a very heavy load on the computer's hardware. Windows 98 (like its predecessor Windows 95) is very demanding in terms of processor speed, RAM and free disk space (and these requirements have slightly increased compared to the previous version). Thus, the main drawback is the high performance requirements for all parts of the computer, without exception. If you use Windows 98 on slow computers, the constant downtime and waiting turns your work from pleasant to real pain.

Another disadvantage of Windows 98 is its incomplete multitasking, especially for older programs. And if Windows 98 copes with the allocation of resources quite successfully, then the situation with protection is still not very good - if the incorrect operation of one of the programs leads to the destruction of shared system resources, then Windows 98 will most likely stop working normally.

The main disadvantage of Windows 98, related to the criticality of time, does not allow using this shell for processing incoming signals from the outside in real time. In this case, Windows 98 simply "chokes".

Although Windows 98 is aimed at regular Internet users, the degree of its protection against unauthorized access (hacking) is still insufficient.

Finally, sadly, Windows 98 is not without bugs, and so are other programs.

Windows 98 interface elements

Desktop

After starting Windows 98, you are taken to the Desktop (Desktop). Some elements of the Windows 98 interface are usually located here:

My computer(MyComputer) - contains a tree that conventionally represents all folders on the computer;

Basket (RecycleBin) - allows you to delete files and folders. If you drag any file (folder) onto the icon Baskets (RecycleBin) (the icon will turn blue), then you will delete it from the disk;

Network environment (NetworkNeighborhood) - allows you to view network resources if you are connected to a network;

Briefcase(MyBriefcase) - allows you to synchronize files processed on multiple computers at once. To use it or not is up to you;

InternetExplorer- allows you to surf the Internet. If you are not an Internet client, this icon can also be removed;

OutlookExpress - it is a kind of mailbox where information received by e-mail will be received. If you do not have one, then feel free to place OutlookExpress v Cart (RecycleBin) ;

My documents (MyDocument) - a folder for personal documents, in which you are invited to save the results of your work (if its location on disks by default does not suit you, you can move it to any place).

Task bar

The Taskbar is usually located at the very bottom of the screen. It contains buttons for all currently running programs and open folders. To go to any of the running tasks, just click on the corresponding button on the taskbar. If it is not clear to you which task corresponds to the button, hold the mouse on it for a couple of seconds.

The indicator of the current keyboard layout (language) is located on the right side of the taskbar; clicking on it allows you to change the layout.

The clock is also located there. If you hold the mouse pointer on them for a couple of seconds, the current date will be displayed.

Start Button and Main Menu

On the left side of the taskbar is the Start button. Clicking on this button brings up the main menu, which allows you to start any program, call up help, find a file, etc.

Let's say you want to run a program. You have to click on the Start button, select the desired item, wait for the next menu level to open, and repeat the same steps until you reach the icon of the program you need.

Window types

All windows used by Windows can be divided into five types:

Windows window - programs;

DOS window - a program running in a window;

secondary window of Windows - programs (created directly by the program itself).

A window with a message or request (created by one of the currently running Windows programs).

Expanded folder window.

Windows window - programs. Typically contains all the elements described above. The header contains the name of the program.

DOS window - programs. From - under Windows, you can run programs designed to work under DOS. Such a program can be launched in two modes - full screen and in a window. The first mode is practically no different from executing a program under direct control of DOS. The execution mode in the window allows more flexible control of the program. A DOS window program is missing a menu bar. All other elements are present. The title contains the name of the DOS program.

Windows Secondary Window - Programs. This window is created by the program itself. As a rule, it contains processed information, be it text, graphics, etc. This window does not have a menu bar and toolbar, all other elements are usually present. The title of such a window displays the name of the document being processed. A distinctive feature of the secondary Windows - program window is that it can be combined with the window of the program itself. In this case, the titles of these windows are combined into one, under this title is the menu bar of Windows - programs. The menu bar contains the secondary window control buttons. This method allows you to use the maximum area of ​​the monitor screen for work.

The message and query window is also generated by Windows programs. They display various warnings, messages about situations that have arisen, requests for various actions. As a rule, these windows are displayed on top of all other windows and contain only a title and a button. Close (Close) ... A distinctive feature of these windows is their constant size (i.e. it is impossible to change the window borders).

Active and inactive windows

There can be only one active window on the screen, all other windows on the screen at that moment are inactive. The active window is always displayed on top of others and all actions performed at the moment refer to it. The title of the active window is highlighted in a bright color, the title of inactive windows is faded. If the window of this program is inactive, then they say that the program is running in the background (if this mode makes sense for it).

Window management

To resize the window, the mouse pointer must be positioned on the window border. If this window can be resized, the marker will take the form shown in Figure 3.16. The arrows will show the possible direction. If you really want to change the window border, then you just need to move it to a new location (press the left mouse button and, without releasing it, move the marker to the desired location). If there were no scroll bars in the window, and you did not reduce its size, then one or both of these bars may appear.

You can also use the resize buttons. They are located to the right of the title. If some of these buttons or all of them are missing (displayed in faded color), then this operation is impossible for this window.

Let's start with the case when the window takes up part of the screen. On the left is the button Collapse (Minimize): it allows you to minimize the window (if this is a program window or a folder, then after minimizing the window there will be a button on the taskbar; if this is a secondary window, then the title bar will remain of it and it will be placed in the lower left corner of the program window). In the middle there is a button Expand (Maximize) , clicking on it allows you to expand the window to full screen (if it is a secondary window, it will merge with the program window). On the right is the button Close (Close) , it allows you to close the window.

If the window is maximized to full screen. then in the middle instead of the button Expand (Maximize) there is a button Restore (Restore) ; it allows you to restore the size of the window.

If the secondary window is minimized, then the button is located on the left. Restore (Restore) , and in the center is the button Expand (Maximize) .

If the secondary window is merged with the program window, then buttons for resizing the program window are located at the top, and immediately below them are buttons for resizing the secondary window.

Moving the window

Moving the window is easy enough. To do this, just grab the title of the window and move it to the desired location.

Scrolling window contents

If the contents of the window do not "fit" into the current size of the window, then scroll bars (or one of them) appear on the left and at the bottom. Let's see how to use them. The easiest option is to drag the slider to a new location. In this case, the contents of the window will change accordingly.

There are times when you need to scroll the window by just one line (column). Then you need to use the arrow buttons located at the ends of the scroll bar. Clicking on such a button scrolls (moves) the window by one line.

If you need to move the window one screen up or down (right or left), then you can proceed as follows. Place the mouse marker on the scroll bar above or below the slider and left-click. This will scroll one screen.

Closing the window

To close the window (if possible), you need to click on the button Close (Close) ... If this operation is permissible (program windows, folders, secondary windows, part of query windows), then after clicking the window will disappear from the screen.

Wherein:

If it was a program window, then this program will be terminated;

If it was a folder window, then it will disappear from the screen, and the folder will be closed;

If it was a secondary window of the program, then the processing of this document will be stopped;

If it was a program message, then this window will disappear from the screen;

If it was a window with a program request, then this will mean canceling the requested action.

If at the moment there is unsaved information in the window, then when you try to close this window, Windows will first offer to save the last changes.

When the button is clicked Close (Close) DOS - a program running in a window, an attempt is made to terminate this program. If this cannot be done correctly, a corresponding warning is displayed. In this case, it is recommended to cancel the closing of the window with the loss of data (click on the No button), and then close the DOS program in the usual way.

Program interface. Components used in the program

The simplest and perhaps the most commonly used button is the Button located on the Standard library page. Less commonly used button BitBtn characterized, first of all, by the ability to display an image on its surface. Most of the properties, methods and events of these types of buttons are the same.

The main property of the button from the point of view of appearance is - Caption.

In button labels, you can provide for the use of shortcut keys by highlighting one of the label symbols. The character that must correspond to the shortcut key is preceded by an ampersand "&". This character does not appear in the caption, and the character following it appears underlined. Then the user can, instead of clicking on the button, press at any time the Alt key together with the key of the selected symbol.

For example, if your application has a button to perform some operation, you can set its property Caption equal to & Run. On the button, this inscription will look like "Run". And if the user presses Alt-B keys, then it will be equivalent to clicking on the button.

The main event of any button is OnClick, that appears when you click on it. It is in the handler of this event that statements are written to be executed when the user clicks on the button. In addition, there are a number of events related to various key and mouse button manipulations.

Property Cancel, if you install it in true, specifies that pressing the Esc key by the user is equivalent to pressing this button. It is advisable to set this property equal to true for "Undo" buttons in various dialog boxes so that you can exit the dialog by clicking on this button or by pressing the Esc key.

Property Default, if you install it in true, defines that pressing the Enter key by the user will be equivalent to pressing this button, even if this button is not currently focused. However, if at the moment of pressing Enter another button is in focus, then the button with focus will be triggered. If several buttons on the form have the property Default set equal true, then when you press Enter, the one that is earlier in the tabulation sequence will be triggered.

Another property is ModalResult used in modal forms. In normal applications, the value of this property should be mrNone.

Of the methods inherent in buttons, it makes sense to note one - Click. Executing this method is equivalent to clicking a button, i.e. calls the button event OnClick. This can be used to duplicate the click on the button by some other user action. For example, suppose you want that when the user presses a key with the character "C" or "c" at any time when working with the application, the operations provided in the event handler are performed OnClick buttons Buttonl. Since it is not known which component will be in focus at the moment of this event, it is necessary to intercept it at the form level. Such interception is carried out if you set the form property KeyPreviewvtrue. Then in the event handler of the form OnKeyPresss you can write the operator

if (key = "Y" or key = "Z") then Buttonl.Click;

If the user entered the character "C" or "C", the result will be a handler for clicking the button Buttonl.

All of the above applies equally to Button, and toBitBtn. Let's now look at the features of the icon button BitBtn. The image on this button is set by the property Glyph. When the ellipsis button is clicked in the property line Glyph a window is called in the Object Inspector. By clicking the Load button in it, you will go to the usual window for opening a picture file and you can select a bit matrix file. bmR, containing the desired image. In particular, Delphi comes with a large number of button images. They are located in the \ lmages \ Buttons directory, and the Images directory itself in Delphi 5 and 4 is located in the \ program files \ common files \ borland shared directory, and in other Delphi versions, in the \ program files \ borland \ delphi ...

After you have selected an image, click OK and the selected image will appear on your button to the left of the caption.

A button image file can contain up to four 16x16 thumbnail images. The leftmost one corresponds to the released button. The second from the left corresponds to an unavailable button when its property is Enabled equals false... The third image from the left is used when the user presses the button when it is turned on. The fourth image from the left is used in latched buttons SpeedButton, which will be discussed later, for the image of the button in the pressed state. Most button images use two icons. You can find out the number of icons from the property of the button NumGlyphs which after loading the image will show you the number of icons in it.

The location of the image and label on the button is determined by the properties Margin, LayoutandSpacing... If the property Margin is -1 (the default), the image and label are centered on the button. In this case, the position of the image in relation to the inscription is determined by the property Layout, which can take on the following values: blGlyphLeft(on the left, this is the default), blGlyphRight(on right), blGlyphTop(up), blGlyphBottom(at the bottom). If Margin> 0, then depending on the value Layout the image and the inscription are shifted to one or another edge of the button, retreating from it by the number of pixels specified by the value Margin.

Property Spacing specifies the number of pixels separating the image and caption on the button surface. Default Spacing= 4. If you set Spacing= Oh, the image and text will be placed side by side. If you ask Spacing= -1, then the text will appear in the middle between the image and the edge of the button.

Another property BitBtn- property Kind defines the type of the button. By default, the value of this property is bkCustom- customized. But many other predefined types can be set as well: bkOK, bkCancel, bkHelp, bkYes, bkNo, bkClose, bkAbort, bkRetry, bklgnore, bkAll... In these types, appropriate labels have already been made, icons have been introduced, and some more properties have been set. It's usually best not to use them. First, the inscriptions still need to be translated into Russian. Second, predefined graphics tend to clash with the general style of a particular application. And most importantly, the predetermination of some properties that you did not take into account can sometimes lead to strange results. It's better to use custom buttons and set all the necessary properties in them yourself.

Image component and some of its properties

Often there is a need to decorate your application with some kind of images. This can be a graphical splash screen that is the logo for your application. Or it could be photographs of employees of a certain institution while developing an application that works with the database of this institution. In the first case, you need a component Image located on the Additional page of the component library, in the second - its analogue DBImage associated with the data and located on the Data Controls page.

Let's start our acquaintance with these components. Open a new application and drag the component onto the form Image... Its a property that an image can contain is Picture... Click on the ellipsis button next to this property, or simply double-click on Image, and the Picture Editor window will open in front of you, allowing you to load into the property Picture any graphic file (Load button), and also save the opened file under a new name or a new directory. Click on Load to load the graphic file. The Load Picture window will open in front of you. As you move the cursor in the list of graphic files, the images contained in them are displayed in the right window, and above them are numbers characterizing the size of the image. You can find graphic files in the Images directory. In Delphi 5 it is usually located in ... \ program files \ Common Files \ Borland \ Borland Shared, in Delphi 4 - in ... \ program files \ Common Files \ Borland Shared, in Delphi 3 - in ... \ program files \ Borland \ Delphi 3, and in Delphi 1 it is in the Delphi 1 directory. Unfortunately, in Delphi 1, the image load window will significantly preview files before loading them.

When you loaded an image from a file into a component during the design process Image, it not only displays it, but also stores it in the application. This gives you the ability to ship your application without a separate graphics file. However, as we will see later, you can also load external graphics files into Image at runtime.

Let's go back to considering the properties of the component. Image.

If you set the property AutoSize v true, then the size of the component Image will automatically fit to the size of the picture placed in it. If the property AutoSize installed in false, then the image may not fit into the component, or, conversely, the area of ​​the component may turn out to be much larger than the area of ​​the image.

Function graphs

Function interpolation

In practice, the problem is often encountered: using the values ​​(xi, yi), i = 0,1, ..., n, given on the plane, construct a function that either passes exactly through these points, or passes as close as possible to these points (Fig. 6.). Three ways to solve this problem are considered below: the Lagrange interpolation polynomial, the least squares method, and cubic spline interpolation.

x

Rice. 6 The interpolation problem

Lagrange interpolation polynomial

The graph of the function defined by the Lagrange interpolation polynomial passes through all points (xi i, yi.):

L (x) = i x -x j (1.1)

This method is extremely easy to use, but it has a significant drawback: the deviation of the function values ​​from the expected ones can be quite large.

To calculate the values ​​of the Lagrange polynomial according to equation (1.1), you can use the Lagr functions.

Listing 1. Lagrange function

functionLagr(n: Byte; xt: Real; x, y: Vect): real;

var I, j: Byte; S, P: Real;

For i:=0 to n do

P:= l;

orj: =0 to n do

ifi<>jthenP: = P * (xt-x [j] ) / (x [i] -x [j] ) ;

S: = S + y [i] * P;

end;

Lagr: = S;

end;

The project provides the ability to drag any point with the mouse. Therefore, along with the traditional scaling functions, inverse scaling functions are used and handlers for three events onMouseDown, onMouseMove, onMouseUp are created.In the Image IMouseDown procedure, the Num number of the point closest to (X, Y) is determined, and the flag that allows movement is raised, - Drawing: = True.

...

Similar documents

    Development of a program to work in operating systems of the Windows family. Using the Delphi environment - a modern visual design technology. Creation of user interface, window application, menu; setting the initial matrix.

    term paper, added 01/12/2011

    Delphi as a development environment for Windows-oriented programs. Purpose and advantage of using electronic textbooks. Description of the capabilities of the Delphi 5 environment for the development of an electronic textbook. Use cases for Internet services.

    thesis, added 07/13/2011

    Basic concepts about operating systems. Types of modern operating systems. The history of the development of operating systems of the Windows family. Characteristics of Windows operating systems. New functionality of the Windows 7 operating system.

    term paper, added 02/18/2012

    The evolution of graphical user interfaces. The X Window System Device and Window Managers. Description of the KDE and GNOME desktop and applications. An overview of the basic principles of organizing the interface in the Windows system, a description of the package of its application programs.

    abstract, added 02/15/2012

    Studying the textbook and help subsystem of Windows 95 / NT, gaining skills in working with the "mouse", manipulating windows and icons of programs and documents, launching programs in Windows 95 / NT. Developing a simple Windows application using Delphi.

    test, added 01/15/2009

    Development of a visual user interface based on screen forms of the Delphi environment and visual components. Basic data types used in MD 5 Calc. One-way hash functions. The MD5 hashing process, the possibilities of its application.

    term paper added on 08/28/2012

    The history of the development of operating systems of the Windows family and the basic concepts of system administration. Determination of the demand for Windows operating systems, comparative characteristics of their functions and capabilities, features of application in practice.

    term paper added on 05/08/2011

    The concept of an operating system as a basic complex of computer programs that provides control of computer hardware, working with files, input and output of data, execution of utilities. The history of the development of operating systems of the Windows family.

    term paper, added 01/10/2012

    The history of the integrated development environment, Delphi version. Organizing a component library. The Additional page, a series of commonly used general purpose components. Executable file of the "Text file archiver" program, application interface.

    term paper added on 05/16/2017

    Using the Delphi programming language to write programs that are a sequence of instructions. Classes and directives in object-oriented programming. Demo program development. Windows XP customization process.

0 Word for Windows Progrm Mnger are all MDI applications and look different than Delphi. Delphi environment follows another specification called Single Document Interfce SDI and consists of several separately located windows. If you use an SDI application like Delphi, you already know that before starting work it is better to minimize other applications so that their windows do not clutter up the workspace.


Share your work on social media

If this work did not suit you at the bottom of the page there is a list of similar works. You can also use the search button


Lecture-3 (2 hours)

Topic: Delphi Programming Environment

The structure of the programming environment

Appearance of the programming environment Delphi different from many others that can be seen in Windows. For example, Borland Pascal for Windows 7.0, Borland C ++ 4.0, Word for Windows, Program Manager are all MDI applications and look different than Delphi. MDI(Multiple Document Interface ) - defines a special way to manage multiple child windows within one large window.

Delphi environment it follows another specification called Single Document Interface (SDI ), and consists of several separately located windows. This was done due to the fact that SDI is close to the application model used in Windows 95.

If you are using SDI application type Delphi , you already know that before starting work, it is better to minimize other applications so that their windows do not clutter up the workspace. If you need to switch to another application, just click on the system minimize button Delphi ... All other windows of the programming environment will be minimized along with the main window, making room for other programs to work.

The main components of the programming environment

The following are the main components Delphi:

  1. Form Designer
  2. Source Text Editor window ( Editor W indow)
  3. Component Palette
  4. Object Inspector
  5. Help (On-line help)

There are, of course, other important ingredients. Delphi , such as the toolbar, system menu and many others that you need to fine-tune the program and programming environment.

Delphi programmers spend most of their time switching between the Form Designer and the Source Text Editor Window (which is called the Editor for short). Before you start, make sure you can recognize these two important elements. The Form Designer is shown in Fig. 1, the Editor window is shown in Fig. 2.

Fig. 1: The Form Designer is where you are Fig. 2: In the Editor window, you create

Create a visual interface of the program, the logic of program control

Form Designer in Delphi so intuitive and easy to use that creating a visual interface is child's play. The Shape Designer initially consists of one empty window, which you fill in with all sorts of objects selected in the Component Palette.

Despite the importance of the Form Designer, the place where programmers spend most of their time is the Editor. Logic is the driving force behind the program and the Editor is where you “code” it.

The Component palette (see Fig. 3) allows you to select the necessary objects to place them on the Form Designer. To use the Component Palette, simply first click on one of the objects and then click on the Shape Designer a second time. The object you have selected will appear on the projected window and can be manipulated with the mouse.

Palette Component uses page-by-page grouping of objects. At the bottom of the Palette is a set of tabs - Standard, Additional, Dialogs etc. If you click on one of the tabs, you can go to the next page of the Component Palette. The pagination principle is widely used in the programming environment Delphi and it can be easily used in your program. (On the page Additional there are components for organizing pages with tabs at the top and bottom).

Figure 3: The Component Palette is where you select the objects to be placed on your shape.

Suppose you place a component TEdit on the form; You can move it from place to place. You can also use the border drawn around the object to resize it. Most of the other components can be manipulated in the same way. However, components invisible during program execution (such as T M enu or TDataBase ) do not change their shape.

To the left of the Form Designer, you can see the Object Inspector (Figure 4). Note that the information in the Object Inspector changes depending on the object selected on the form. It is important to understand that each component is a real object and you can change its appearance and behavior using the Object Inspector.

The Object Inspector consists of two pages, each of which can be used to define the behavior of a given component. The first page is the list of properties, the second is the list of events. If you need to change anything related to a specific component, you usually do it in the Object Inspector. For example, you can change the name and size of the component TLabel changing properties Caption, Left, Top, Height, and Width.

Fig. 4: The Object Inspector allows you to define

Properties and behavior of objects placed on a form

You can use the tabs at the bottom of the Object Inspector to switch between property and event pages. The event page is linked to the Editor; if you double-click on the right side of any item, then the code corresponding to this event will be automatically written to the Editor, the Editor itself will immediately receive focus, and you can immediately add the code for this event handler. This aspect of the programming environment Delphi will be discussed later.

The last important part of the environment Delphi - Reference (on - line help ). To access this tool, you just need to select the item in the system menu Help and then Contents ... The screen will display the Guide shown in Fig. 5.

The directory is context sensitive; on key press F 1, you will be prompted for the current situation. For example, being in the Object Inspector, select a property and click F 1 - You will receive a help on the purpose of this property. If at any time in the environment Delphi ambiguity or difficulty arises - press F 1 and the required information will appear on the screen.

Additional elements

This section focuses on three tools that can be perceived as auxiliary to the programming environment:

Menu (Menu System)

Panel with buttons for quick access ( SpeedBar)

Image Editor

The menu provides a fast and flexible interface to the environment Delphi , because it can be controlled by a set of "hot keys". It is also convenient because it uses words or short phrases that are more precise and understandable than icons or pictograms. You can use the menus to perform a wide variety of tasks; most likely for the most common tasks like opening and closing files, controlling the debugger, or setting up the programming environment.

SpeedBar located directly under the menu, to the left of the Component Palette (Fig. 6). SpeedBar does a lot of what can be done through the menu. If you hold the mouse over any of the icons on SpeedBar , you will see that a hint will appear explaining the purpose of this icon.

Figure 6: The SpeedBar is to the left of the Component Palette.

The Picture Editor shown in Fig. 7 works similarly to the program Paintbrush from Windows ... You can access this module by selecting the menu item Tools | Im a ge Editor.

Fig. 7: The Picture Editor can be used to create pictures for buttons, icons and other visual parts for the program.

And now you need to consider those elements that the programmer is on Delphi uses in daily life.

Tools

In addition to the tools discussed above, there are five tools provided with Delphi ... These tools:

Built-in debugger

External debugger (optional)

Command line compiler

WinSight

WinSpector

These tools are collected in a separate category, not because they are less important than others, but because they play a rather abstract technical role in programming.

To become a strong programmer in Delphi You will need to understand how to use the debugger Delphi ... The debugger allows you to step through the source code of a program, executing one line at a time, and open a viewport ( Watch ), which will reflect the current values ​​of the program variables.

The built-in debugger, which is the most important of the five tools above, works in the same window as the Editor. The external debugger does everything that the built-in does and more. It is faster and more powerful than the built-in one. However, it is not that easy to use, mainly due to the need to leave the environment. Delphi.

Now let's talk about compilers. An external compiler is called DC C. EXE is useful mainly if you want to compile your application before debugging it in an external debugger. Most programmers will probably find that it is much easier to compile in the environment Delphi rather than trying to create a program from the command line. However, there are always a few originals that will feel happier using the command line compiler. But this is a fact - it is possible to create and compile a program in Delphi using only DC C. EXE and one more program CONVERT. EXE to help you create shapes. However, this approach is inconvenient for most programmers.

WinSight and WinSpector interesting mainly for experienced programmers in Windows ... This does not mean that a beginner should not run them and experiment with them on their own. But these tools are secondary and used for narrow technical purposes.

Of these two tools WinSight definitely more useful. Its main function is to allow you to observe the message system. Windows. While Delphi does a lot to hide the intricate details of this messaging system from inexperienced users, nevertheless Windows is an event-driven operating system. Almost all major and minor events in the environment Windows take the form of messages that are sent out with great intensity among the various windows on the screen. Delphi gives you full access to messages Windows and allows you to answer them as soon as necessary. As a result, power users WinSight becomes simply necessary.

WinSpector saves a record of the current state of the machine to a text file; You can view this file in order to find out what is wrong with the program. This tool is useful when the program is in trial operation - you can get important information in case of a system crash.

Other similar works that may interest you. Wshm>

7080. VISUAL STUDIO.NET VISUAL PROGRAMMING ENVIRONMENT 448.42 KB
The discipline Programming Technologies considers issues related to the use of object-oriented programming technologies in the design of Windows applications of complex software systems. Modularity of construction is the main property of Windows applications. In OOP Windows applications are developed on a modular basis, they consist of classes that are the main type of module. Object-oriented development of Windows applications is based on a style called data-driven design.
18329. Development of software for a recruiting station in the Delphi programming language 8.32 MB
One of the components of this system is a subsystem for the registration of conscripts, or, to be more precise, the registration and formation of teams for sending to military service in the armed forces of the Republic of Kazakhstan. The main purpose of this thesis is to create a software package in the field of accounting and the formation of various types of reports in the field of creating software packages, in particular the contingent formation system ...
1098. External and internal environment of Sreda Production Company LLC 156.89 KB
Analysis of the marketing environment of the enterprise Production company Sreda LLC. Characteristics of LLC Production company Wednesday. Analysis of the factors of the marketing environment LLC Production company Sreda.
20838. Studying the history of the emergence of programming and the basic principles and approaches when creating a programming language 705.86 KB
To achieve this goal, it is necessary to solve the following tasks: Analyze information sources on programming technologies; Consider the history of the development of programming technologies; Identify the stages of development of programming technologies. Create a database to store information about employees. A programming language is a formalized language for describing an algorithm for solving a problem on a computer. To automate programming, a separate autocode or assembler was developed for each computer.
8621. Programming languages. Programming systems. Visual design environments 21.13 KB
Bsic is a language that has both compilers and interpreters in popularity, it ranks first in the world. This language is the second most popular language after Bsic. Currently, the following visual programming environments for languages ​​are most popular ...
6924. Delphi Events 19.79 KB
Events in Delphi Objects from the library of visual components VCL Delphi as well as objects of the real world have their own set of properties and their own behavior, a set of responses to events occurring with them. Among the set of events for various objects from the VCL are both events ported from Windows MouseMove KeyDown and events generated directly in the DtChnge program for TDtSource. The simplest events that sometimes need to be responded to are, for example, events associated with the mouse, they are present in almost all visible objects ...
6923. Methods in Delphi 57.07 KB
To create the CONTROL1 program, use the mouse to place the Edit component located on the â € œStndrdâ € page of the Component Palette on the form. After that, in the activated Editor window you will see the generated â € œskeletonâ € of the Edit1DblClick method, which is a reaction to the OnDblClick event: procedure TForm1.Edit1DblClickSender: TObject; begin Edit1. The text on this line will change according to what we wrote in the Edit1DblClick method: see.
2451. GDI: Graphics in Delphi 26.05 KB
In Delphi, the device context is represented as TCnvs. The following are two functions that are used to draw lines and both belong to TCnvs: Name Description Example MoveTo Moves the starting point of line drawing to the specified x and y coordinates of Cnvs. Cnvs. for example Cnvs.
6922. Properties in Delphi 61.48 KB
However, unlike the “simple” field, any change in the value of some property of any component immediately leads to a change in the visual representation of this component, since the property encapsulates the action methods associated with reading and writing this field, which in turn include the necessary redrawing. Properties serve two main purposes. And secondly, properties determine the behavior of a form or component.
6929. The history of the Delphi language 13.01 KB
Delphi is the Greek city where the Delphi oracle lived. Delphi is a combination of several important technologies: High-performance compiler to machine code Object-oriented model of components Visual and therefore high-speed building of applications from software prototypes Scalable tools for building databases Compiler to machine code The compiler built into Delphi provides high performance required for building applications in architecture ...