Hardware and software setup

Didactic possibilities of Delphi. Delphi environment and simple application Delphi popular modern environment application 1

Delphi Programming Environment Interface

First of all Delphi is intended for professional developers of corporate information systems. Perhaps it should be clarified here what exactly is meant. It's no secret that some successful rapid application development (RAD) products work great when making fairly simple applications, however, the developer faces unforeseen difficulties when trying to do something really complex. It happens that a product reveals its inherent limitations only after some time has passed. Delphi has no such restrictions. A good proof of this is the fact that Delphi itself is developed in Delphi. You can draw conclusions. However, Delphi is not just for professional programmers. I read letters in an electronic conference that were completely unexpected for me, where teachers, doctors, university professors, businessmen, all those who use a computer for a purely applied purpose, talked about the fact that they purchased Delphi for Windows in order to quickly solve some problems. their tasks without involving outside programmers for this. In most cases, they succeed. Striking Fact - magazine Visual Basic Magazine awarded its Delphi for Windows award. Business leaders planning to allocate funds for the purchase of software products must be confident that the planned investment will pay off. Therefore, one of the evaluated factors should be the question - is it easy to find a specialist in Delphi and how much will his training cost, how much time will the specialist spend on mastering the product. The answer here is quite simple - any Pascal programmer is able to master Delphi professionally almost immediately. A specialist who has previously used other software products will have a harder time, but he will be able to write the very first working application within the first hour of working in Delphi.

Structure of the programming environment

The appearance of the Delphi programming environment is different from many others seen on 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 a single large window. If you're using an SDI application like Delphi, you already know that it's best to minimize other applications before you start so that their windows don't get cluttered. working space. If you need to switch to another application, just click on Delphi's system minimize button. 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 main parts of Delphi are listed below:

  1. Form Designer
  2. Source Editor Window
  3. Palette Component (Component Palette)
  4. Object Inspector
  5. Directory (On-line help)

Delphi's Form Designer is so intuitive and easy to use that creating a visual interface is child's play. The Form Designer initially consists of one empty window that you fill with all sorts of objects selected on 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 allows you to select the desired objects to place on the Form Designer. To use the Component Palette, simply click on one of the objects for the first time, and then click on the Form Designer a second time. The object you selected will appear on the projected window and can be manipulated with the mouse. The Component palette uses pagination 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 principle of pagination 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). To the left of the Form Designer, you can see the Object Inspector. Note that the information in the Object Inspector changes depending on the object selected on the form. It's important to understand that each component is a real object and you can change its look 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 a list of properties, the second is a list of events. If you need to change anything related to a particular component, then 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. The last important part of the Delphi environment is the Reference (on-line help). To access this tool, simply select Help and then Contents from the system menu. The Directory will appear on the screen. The directory is context-sensitive; when you press the F1 key, you will get a prompt corresponding to the current situation. For example, while in the Object Inspector, select a property and press F1 - you will get help on the purpose of this property. If at any moment of work in the Delphi environment there is an ambiguity or difficulty - press F1 and the necessary information will appear on the screen.

Additional elements

V this section attention is focused 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 Delphi environment because it can be controlled by a set of "hot keys". This is also convenient because it uses words or short phrases that are more precise and understandable than icons or pictograms. You can use the menu to perform a wide range of tasks; most likely, for the most common tasks like opening and closing files, controlling the debugger, or setting up the programming environment. The SpeedBar is located directly below the menu, to the left of the Component Palette. The SpeedBar does a lot of the things that can be done through the menu. If you hover your mouse over any of the icons on the SpeedBar, you will see that a tooltip will appear explaining the purpose of that icon. The Picture Editor works similarly to the Windows Paintbrush program. You can access this module by selecting the menu item Tools | image editor. And now we need to consider those elements that a Delphi programmer uses in everyday life.

Tools

In addition to the tools discussed above, there are five tools shipped with Delphi. These tools are:
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 Delphi programmer, you need to know how to use the Delphi debugger. The debugger allows you to step through the source code of a program, one line at a time, and open a Watch window that displays the current values ​​of the program's variables. The built-in debugger, which is the most important of the five tools listed above, runs in the same window as the Editor. The external debugger does everything the built-in debugger does and more. It is faster and more powerful than the built-in one. However, it is not as user-friendly, mainly due to the need to leave the Delphi environment.

Standard Components

For further acquaintance with the Delphi programming environment, you will need to talk about the composition of the first page of the Component Palette. On the first page of the Component Palette there are 14 objects of particular importance to use. Few will get by long time without buttons, lists, input windows, etc. All of these objects are as much a part of Windows as the mouse or the window. The set and order of the components on each page are configurable. So, you can add new components to the existing ones, change their number and order. The standard Delphi components are listed below with some comments on their use. When examining these components, it would be helpful to have a computer handy to see how they work and how to manipulate them. TMainMenu allows you to put a main menu in a program. When you place a TMainMenu on a form, it looks like just an icon. Icons of this type are called "invisible components" because they are invisible during program execution. Menu creation involves three steps: (1) placing a TMainMenu on the form, (2) calling the Menu Designer via the Items property in the Object Inspector, (3) defining menu items in the Menu Designer. TPopupMenu allows you to create popup menus. This type of menu appears when you click the right mouse button. TLabel is used to display text on the screen. You can change the label's font and color by double-clicking the Font property in the Object Inspector. You'll see that it's easy to do this at runtime as well, with just one line of code. TEdit is a standard Windows input control. It can be used to display a short piece of text and allows the user to enter text while the program is running. TMemo is another form of TEdit. Involves working with large texts. TMemo can wrap words, save text fragments to the Clipboard and restore them, and other basic editor functions. TMemo has a text size limit of 32Kb, which is 10-20 pages. (There are VBX and "native" Delphi components where this limit is lifted). TButton allows you to perform some action when a button is pressed during program execution. Everything is very simple in Delphi. By placing a TButton on a form, you can double-click to create a template for the button's click event handler. Next, you need to fill in the blank with code (what you need to write manually is underlined):

Procedure TForm1.Button1Click(Sender: TObject); begin MessageDlg("Are you there?", mtConfirmation, mbYesNoCancel, 0); end; TCheckBox displays a line of text with a small box next to it. You can put a checkmark in the box, which means that something is selected. For example, if you look at the compiler settings dialog box (Options | Project menu item, Compiler page), you can see that it consists mainly of CheckBoxes. TRadioButton allows you to select only one option out of several. If you open the Options | Project and select the Linker Options page, you can see that the Map file and Link buffer file sections consist of RadioButton sets. TListBox is needed to show a scrollable list. The classic ListBox example in Windows environment - selecting a file from the list in the menu item File | Open many applications. The names of files or directories are in the ListBox. A TComboBox is similar to a ListBox in many ways, except that it allows you to enter information in a small input box on top of the ListBox. There are several types of ComboBoxes, but the most popular is the drop-down combo box, which can be seen at the bottom of the file selection dialog box. TScrollbar - a scrollbar that appears automatically in edit objects, ListBoxes when it is necessary to scroll the text for viewing. TGroupBox is used for visual purposes and to tell Windows what order to move through the components on the form (by pressing the TAB key). TPanel - a control similar to TGroupBox, used for decorative purposes. To use a TPanel, simply place it on a form and then place other components on top of it. Now, when moving the TPanel, these components will also move. TPanel is also used to create the toolbar and status window. A TScrollBox represents a place on a form that can be scrolled vertically and horizontally. Until you explicitly disable this option, the form itself works the same way. However, there may be times when you want to scroll only part of the form. In such cases, TScrollBox is used. This is the complete list of objects on the first page of the Component Palette. If you need additional information, select an object on the Palette and press the F1 key - a Reference book will appear with a full description of this object. The rest is related to building the user interface: placing objects on the form, setting their properties, and writing event handlers. As well as creating applications that work with databases. So, it is obvious that the user is the closing link of the control system, i.e. the subject of control, and the program is the object of control. The rational organization of the work of users is one of the most important factors determining the effective functioning of the system as a whole. Before the advent of operating systems of the Windows family, the user was in control without “seeing” the real object. Between the real control object and the user there was an information model of the object (means of displaying information). Therefore, there was a problem of designing not only the means of displaying information, but also the means of interaction between the user and the technical means of the program, i.e. the problem of designing a system that is called a user interface.

Features of the Delphi Programming Environment

Analysis of the implementation experience in schools, universities and various enterprises, computer programs educational purpose shows that an important factor preventing their widespread use is the incomplete correspondence of the proposed material to the ideas and methods of teaching a particular discipline. Many educators show considerable caution in the use of tutorials and pedagogical software. The ideal solution This problem is the full consideration of the requirements of the user (teacher), which is practically unattainable. At present, the interests and preferences of the manufacturer, that is, programmers-developers of computer programs, dominate in the development of training and other educational programs. In the press and at conferences of various levels, the opinion has been expressed more than once that the modern teacher rather needs not a disk with a complete multimedia course on the subject, but some elementary bricks that he could use as colorful illustrations of his ideas and methods and which fit more organically would be in the tradition of using visual aids selected by the teacher for his lesson. In this regard, it seems appropriate to create not finished educational products, but original electronic designers - software tools (author's systems) for the teacher to create his own applications. One such tool is Delphi. However, there is very little entry-level literature designed to master Delphi in relation to use in the educational process. Professional programmers are not interested in such tasks as a mini-calculator or an educational graphic editor - they should rather give examples of working with databases using the "client-server" technology. And the teacher doesn't need it at all. Delphi can be learned and used on several levels: Working with visual lenses with little or no programming. Using ready-made system components with writing your own program code based on them. Create your own components in Pascal and include them in the Delphi component palette as standard. Development of complete Windows applications. For a school course, the first level is more than enough (tasks of the second level can be solved in the course of a specialized school and on electives). Not so long ago, object- and event-oriented programming seemed like a big exotic to non-professionals. However, even after the arrival of Windows 95/98, this style of creating programs is not actually in demand in real school practice. I will give an example of conducting classes on creating Windows applications with groups of schoolchildren who study computer science in depth. For work, the visual design environment for Delphi3 programs was chosen. Schoolchildren who started learning and using Delphi already worked quite well in Windows 95 and applications. Therefore, the Delphi integrated development environment was perceived by students quite naturally. Designing forms with various visual components (well-known Windows controls) and working with the object inspector to set the properties of objects aroused genuine interest among schoolchildren. At the same time, the first applications were created in which the properties of objects can be changed programmatically. The figurative comparison used by the teachers was very vividly perceived: we design a Windows robot, create blanks for its parts, program its reactions to certain user actions, in the process of compiling Delphi assembles the robot and puts it into operation. Now we need to determine whether the robot turned out, just the way we wanted. practical experience constructing event-driven object-oriented programs, the students then went out with the help of a teacher to the level of the corresponding theoretical generalizations. A number of students with an empirical style of thinking have successfully constructed very interesting applications, limiting themselves to the minimum use of basic control structures in the development of procedures. At the same time, they now saw behind these structures not the means for organizing hard-to-perceive abstract calculations, but the means for teaching a Windows robot, that is, a means for solving a very interesting problem. Schoolchildren with a developed theoretical style of thinking, having freed themselves from the routine of organizing the Turbo Pascal interface and the rigid framework of its capabilities, led to the development of serious advanced projects using a variety of Delphi components and a good study of the code procedures.In my opinion, modern technologies for constructing Windows applications in Delphi are in many ways more accessible to schoolchildren than traditional programming, arouse great interest, contribute creative potential of the student and have excellent didactic capabilities.

Overview of applications created in the Delphi environment

Requirements for visual programming environments

The main requirements that the environment for the visual design of algorithms must satisfy:

  1. The environment must be designed to run on the most popular modern operating system that supports a graphical user interface. This will make it possible to study the basics of algorithmization using a significant number of computer technology with which secondary schools are staffed. At the moment, these are operating systems of the Windows family from Microsoft.
  2. The environment should be designed in accordance with common standards for modern software products. This will ensure the convenience and ease of working with the environment controls: menus, toolbars, etc., and will provide an opportunity to consolidate the user's basic skills in working with software.
  3. The environment should be simple and powerful. Ease of development and use of the environment, the possibility of designing a wide class of algorithms using all the resources of multimedia computers available today.
  4. To provide algorithms, it is necessary to choose a form that must meet two main criteria: be visual and understandable for the user and be convenient for implementation in the graphical shell of the operating system. In addition, the presentation form, by virtue of the possibilities, should be as close as possible to the content of the algorithm, and not to the syntax of the algorithmic structures that is used in this representation.
  5. The methods by which algorithms are constructed in the environment should be based on the methods of creating software using modern development tools, which are based on an object approach and visualization. This, in our opinion, will enable students, if necessary, for example, when studying the basics of modern programming in classes with in-depth study of computer science or optionally, to quickly master the technology of visual programming.
  6. One of the main tasks is to create an environment focused on highlighting the semantic content of the problem being solved, and not on studying the algorithmic structures of a particular representation. "Despite the fact that the development of each new algorithm requires its own approach, nevertheless, there are certain general techniques and stages of this kind of activity." Therefore, the unification of algorithmic structures as constructions that are contained in any algorithms, and not just algorithms of a certain class, must be implemented in the environment. In the role of such unified structures, it is advisable to use such standard algorithmic constructions: following, branching, repetition, and calling a subroutine.
  7. Actions that relate to the solution of a specific problem must be defined in terms of semantic content, and organized as a separate block (subroutine). For example, if you need to play some sound file, then the meaning of this construction should be - "play a sound file with a specific name".
  8. In the environment, the structure of the algorithm should be represented in graphic form using a certain "graphical" syntax. Along with this, to designate identifiers, names of methods of graphic-visual objects, it is possible to use text syntax. This kind of syntax cannot be "removed" completely, since it is external to the algorithmic representation. But this "external" syntax is based on concepts known to students from their own experience gained from studying others. school subjects, and its application should not cause significant difficulties.
  9. In the environment, the user should be given the opportunity to freely change the syntax of text-character commands (where appropriate). For example, changing the arithmetic addition symbol "+" to some other one is hardly worth it from the point of view of clarity and unification, but choosing a name for the removal action in a character string - "erase" or "delete" - depends entirely on the user's desire.
  10. As you know, each algorithm works with a specific set of data, which are processed using some methods. Actually, an algorithm is a process of converting input data into output data. Therefore, a clear distinction should be made between data and methods of processing it. This does not contradict the procedural programming paradigm. Suffice it to recall the well-known "formula" by N. Wirth "algorithms + data = program". At the same time, it is logical to make the data strongly typed, as required by the rules of modern programming languages, and place them separately, for example, in the form of a table, which can be quickly accessed at any time during the construction of the algorithm.

Methodology for creating applications for educational purposes

The creation of any computer application, and especially a course in computer science, today is not conceivable without a carefully thought-out development plan. Currently, there is a well-established methodology for creating computer training systems. Like any design methodology, it includes a number of successive stages. To create a training program, you need:
Select the type of program. At this stage, the main goals and objectives of the program are determined, as well as the means of its implementation.
Collect suitable source materials - texts, reproductions and illustrations, audio recordings, video cassettes, computer files. The completeness of the collected materials indicates the readiness for the implementation of the program and determines the level of its quality.
Write a script for the program and the interaction of the teacher with it, which determines the composition of all the collected materials. This is where the entire logic of the program is defined. The script describes the relationships between slides, the structure and changes on those slides, and the sound and video effects.
Process the collected materials on a computer, preparing them for inclusion in the training program, i.e. create and edit text, graphics, animation, video, sound. Here they are used as standard means the operating system itself, as well as the standard packages for text editing (Microsoft Word), computer graphics and animation (3D Studio, Adobe PhotoShop), video editing (Adobe Premiere), Web-mastering (Microsoft FrontPage), as well as programs that come with audio - and video boards.
Implement the scenario in the form of an active program, making the necessary changes to the materials and the scenario during trial operation. For authors who are not programmers, the best option is the use of visual programming tools such as Power Point from Microsoft Office, Macromedia Director, and Web-mastering tools. Finally, professional programmers can use the programming systems Visual C++, Visual Basic, Delphi, Java, etc., but they will achieve optimal development time if they use them in addition to the systems listed above.
Prepare methodological materials for users of the program - teachers. Such materials are necessary, since users of the program, as a rule, do not have the qualifications of its authors.

Practical part

Creation of the simplest educational programs.

Project "Color Matching"

Formation of color from individual components. TColor class, color constants, RGB function Colors of objects are formed by mixing three components - red (red), green (green) and blue (blue). The intensity of each color component can vary from 0 to 255. The combination (0, 0, 0) corresponds to black, and (255, 255, 255) to white. Almost every visual component has a Color property. So far, we have chosen its value from a list of standard colors, but nothing prevents us from creating a color from individual components. To do this, we use the RGB function: Color:= RGB (red, green, blue); You can also create your own color scheme by pre-preparing colors for various visual objects. But it will be possible to use these colors only when creating the corresponding object at the stage of program execution (we will talk about this a little later). To match the color, we will develop a project that allows you to easily change the color of the panel using scroll bars - objects of the TScrollBar class. Let's place a panel and three scrollbars on the form (they are also on the standard tab). Each scrollbar will be responsible for the intensity of one of the three color components. The leftmost position of the slider should correspond to the minimum, and the rightmost position - to the maximum intensity value. Let's set property Min=0 for all stripes, and property Max=2 5 5. Let's set up other properties: Kind - determines the placement of the strip - horizontal (sbHorizontal) or vertical (sbVertical); LargeChange - step of moving the slider when clicking on the bar itself; SmallChange - step of moving the slider when the arrow is clicked; Position - numerical equivalent of the position of the slider on the scrollbar,

Source:

You can immediately download in a ZIP archive.

Program1. "Color Matching"
The main event for the scrollbar is the movement of the slider (the OnChange event), while the method of movement does not matter. Let's write a separate procedure for changing the panel color:

SetProcedurePanelColor; var red, green, blue, k: word; begin red:= Form1. ScrollBar1.Position; if form1.rb1.Checked then begin k:=255 div 2; if (red>=0) and(red=0) and(green=0) and(blue) and we will call it in response to moving the slider on any scroll bar: procedure TForm1.ScrollBar1Change(Sender: TObject); begin SetPanelColor; end ; procedure TForm1.ScrollBar2Change(Sender: TObject); begin SetPanelColor; end; procedure TForm1.ScrollBar3Change(Sender: TObject); begin SetPanelColor; end; Selecting a palette of 8 colors, we must change the position of the slider so that its movement is 0 or 255: procedure TForm1.RB1Click(Sender: TObject); begin Form1.Caption:="Palette of 8 colors; ScrollBar1.LargeChange:=255; ScrollBar1.SmallChange:=255; ScrollBar1.Position:=0; ScrollBar2.LargeChange:=255; ScrollBar2.SmallChange:=255; ScrollBar2.Position:=0; ScrollBar3.LargeChange:=255; ScrollBar3.SmallChange:=255; ScrollBar3.Position:=0; end; procedure TForm1.RB2Click(Sender: TObject); begin Form1. Caption:="Palette of 256 colors; ScrollBar1.LargeChange:=1; ScrollBar1.SmallChange:=1; ScrollBar1.Position:=0; ScrollBar2.LargeChange: =1; ScrollBar2.Position:=0; ScrollBar2.SmallChange:=1; ScrollBar3.LargeChange:=1; ScrollBar3.SmallChange:=1; ScrollBar3.Position:=0; end; The project is ready, we can launch and work with it. The project design option is shown in the figure:

This application can be used in computer science lessons to consolidate the material "Representation of graphic information in a computer", clearly showing that the color is stored as a numerical code. The set contains palettes of 8 and 256 colors.

Components of the program:
Panel (Panel) for displaying color;
3 scrollbars (ScrollBar) to change the color scheme (KZS or KKKZZZSS);
2 switches (RadioButton) for choosing a color palette;
3 text fields (Edit) for displaying a color code;
Button (BitBtn) to close the program.

Encyclopedic YouTube

  • 1 / 5

    The environment is designed for rapid (RAD) development of application software for operating systems Windows, Mac OS X, as well as iOS and Android. Due to the unique combination of simplicity of the language and generation of machine code, it allows you to interact directly, and, if desired, quite low-level with the operating system, as well as with libraries written in C / C ++. The created programs are independent of third-party software, such as Microsoft . NET Framework or Java Virtual machine. The allocation and release of memory is controlled mainly by user code, which, on the one hand, tightens the requirements for code quality, and on the other hand, makes it possible to create complex applications with high requirements for responsiveness (real-time operation). In cross compilers for mobile platforms automatic counting of references to objects is provided, which facilitates the task of managing their lifetime.

    Pronunciation

    Regarding the "correct" pronunciation of the name of the development environment, many copies were broken not only in Russia. Interestingly, there is no unity even among English-speaking countries. In particular, according to this source, the pronunciation "del-fi" dominates in the UK, and "del-fi" in the USA.

    codegear

    Delphi version history

    Borland Delphi

    The first version of Borland Delphi (later known as Delphi 1) was released in 1995 and was designed to develop 16-bit applications for Windows 3.1. It was one of the first RAD systems.

    Delphi 2

    Delphi 2 appeared in 1996 and allowed the development of 32-bit applications. For programming under Windows 3.1, Delphi 1 was included in the package.

    Delphi 3

    Delphi 3 was released in 1997. This version introduced Code Insight technology, component packages, support for ActiveForms, MIDAS, and COM interfaces.

    Inprise Delphi 4

    Inprise Delphi 4 was released in 1998. The IDE has been completely redesigned with Drag-and-Dock interfaces. Support for ActionLists has been added to the VCL. Procedure and function overloading, dynamic arrays, support for Windows 98, CORBA, and Microsoft BackOffice were introduced. This was the last version shipped with Delphi 1 for 16-bit programs.

    Borland Delphi 5

    Borland Delphi 5 appeared in 1999. Added frameworks, parallel programming, advanced integrated debugger, XML support, ADO database support.

    Kylix

    In 2001, Borland released a Linux version of Delphi, called Kylix. Instead of the VCL library, the cross-platform CLX (wrapper for ) was used. The Kylix IDE was based on the Wine libraries. Since kylix was previously called GRODT in a different way, then N. Nikos changed the name to kyluix. [ ]

    Borland Delphi 6

    Supported the cross-platform CLX library.

    Borland Delphi 7

    Delphi 7, released in August 2002, has become the standard for many Delphi developers.

    It is one of the most successful Borland products due to its stability, speed, and low hardware requirements. Delphi 7 adds new components for Windows XP and increases the number of components for building web applications.

    Borland Delphi 8

    Delphi 8 was released in December 2003. Had a new fixed Galileo interface similar to visual studio.NET Microsoft. Supported application development for .NET only. It was positioned as the first programming system for .NET, released not by Microsoft, but by a third-party developer.

    Borland Delphi 2005

    Also Delphi 9 and Borland Developer Studio 3.0. This version brought back the ability to develop applications for Win32, removed from the previous Delphi 8. But if the VCL library was brought back, then CLX was no longer supported.

    Borland Delphi 2006

    Delphi 2006 (Delphi 10, Borland Developer Studio 4.0) was released in December 2005. One IDE supported the development of C#, Delphi.NET, Delphi Win32, and C++ projects.

    Code Gear Delphi 2007

    Delphi 2007 (Delphi 11, part of CodeGear RAD Studio 5.0 IDE) was released in September 2007. It is the latest non-unicode version of Delphi.

    New in Delphi 2007

    • Standard components in the new Delphi now automatically support windows themes. In previous versions, it was necessary to throw the XPManifest component onto the form. XPManifest worked incorrectly (color disappeared on some components) in OS Windows Vista and higher;
    • VCL has undergone some changes. Along with the usual, standard "Dialogs" tab, there is a new one - "Vista Dialogs". It contains only three components: TFileOpenDialog, TFileSaveDialog and TTaskDialog;
    • The VCL added Vista-oriented dialogues classes (TCustomFileDialog, TCustomFileOpenDialog, TCustomFileSaveDialog, TCustomTaskDialog, TFavoriteLinkItem, TFavoriteLinkItems, TFavoriteLinkItemsEnumerator, TFileTypeItem, TFileTypeItems, TTaskDialogBaseButtonItem, TTaskDialogButtonItem, TTaskDialogButtons, TTaskDialogButtonsEnumerator, TTaskDialogProgressBar, TTaskDialogRadioButtonItem) and revised some existing classes under Windows Vista;
    • The Delphi help system is made in the Microsoft Document Explorer format. Many of its points have been revised and expanded. Visually, it looks better;
    • DBExpress has undergone some changes. There was support for Interbase 2007, MySQL 4.1 and 5. There was also support for Unicode in the Oracle, Interbase and MySQL drivers.

    Delphi 2009

    New in Delphi 2009
    • full Unicode support. Applications can run in any language Windows versions. Using Unicode ensures that applications look and function the same across all language versions of Windows and support both Unicode and ANSI strings. New and improved localization tools help you translate applications into different languages. All Windows API functions have been replaced with their unicode counterparts (for example, MessageBox was previously defined as MessageBoxA, now it is MessageBoxW); the type String is now actually UnicodeString and Char is WideChar, PChar is now declared as PWideChar. The old types and descriptions of the ANSI variants of system functions have been preserved, but now they will need to be specified directly (for example, Set of Char in Delphi 2009 will be Set of AnsiChar, and MessageBox will be MessageBoxA). Delphi 2009 is the first version of Delphi for Win32 that requires serious reworking of projects when moving to a new version, which is especially critical for system programmers who widely used direct processing of data types;
    • new elements of programming languages, including Generics and anonymous methods for Delphi, allow you to create more flexible and high-quality code and provide new opportunities for refactoring;
    • the new VCL library includes many improvements and new components to create an advanced graphical interface;
    • the VCL web library allows you to create web applications with a developed interface with AJAX support;
    • reduced the time for the application to send messages to the operating system;
    • visual design and database development with Embarcadero ER/Studio, a professional modeling tool included with the Delphi Architect edition.

    Delphi 2010

    On August 25, 2009 the Embarcadero Technologies company announced sale of the Embarcadero Rad Studio 2010 integrated development environment which included the new version of Delphi 2010.

    New in Delphi 2010

    • Support for Windows 7 API, Direct2D and multi-touch input.
    • Touch and gesture support for Windows 2000 , , Vista and 7.
    • IDE Insight in Delphi 2010 - instant access to any function or parameter.
    • Delphi 2010 includes over 120 performance enhancements.
    • Debugger visualizers.
    • Delphi 2010 includes Firebird support with dbExpress .
    • Classic Delphi 7 interface and tabbed toolbar as an option.
    • RTTI extension - support for attributes that can be applied to types (including classes and interfaces), fields, properties, methods, and enum members.
    Delphi 2010 Professional Edition
    • Local connection to InterBase, Blackfish SQL and MySQL databases
    • Deploying Blackfish SQL on systems with a single user and a 512 MB database.
    • Web VCL with a connection limit of 5.
    Delphi 2010 Enterprise Edition
    • Delphi 2010 Enterprise includes all the features of the Delphi 2010 Professional edition plus a number of additional features.
    • Connecting to InterBase , Firebird , Blackfish SQL, MySQL , Microsoft SQL Server , Oracle , DB2 , Informix and Sybase database servers when connected via dbExpress.
    • Development of multi-tier DataSnap database applications.
    • Deploying Blackfish SQL on systems with five users and a 2 GB database.
    • Web VCL with no connection limit.
    • Additional features of UML-modeling.
    Delphi 2010 Architect Edition
    • Delphi 2010 Architect includes all the features of the Delphi 2010 Enterprise edition plus a number of additional features.
    • Reverse engineering, analysis and optimization of databases.
    • Create logical and physical models based on information retrieved from databases and script files.
    • Easy-to-read and navigate charts.
    • Delphi 2010 Architect enables direct design by automatically generating database code from models.
    • Delphi 2010 Architect has improved bi-directional comparison and merging of database models and structures.

    Delphi XE

    What's New in Delphi XE

    • Subversion integration.
    • New VCL and RTL features.
    • Improvements in the code editor.
    • Updating DataSnap, in particular in terms of support for new versions of the DBMS.
    • Update of modeling tools, support for sequence diagrams.
    • New features for IDE extension, updated Open Tools API.

    Delphi XE2

    On September 1, 2011, Embarcadero released RAD Studio XE2 which includes Delphi XE2 as well as C++Builder XE2, Prism XE2 and RadPHP XE2.

    New in Delphi XE2;

    Delphi XE3

    Delphi XE3 supports 32-bit and 64-bit editions of Windows (including Windows 8) and enhanced Apple support Mac OS X with Firemonkey 2/FM² framework. Support for iOS has been dropped (with the intention of bringing it back in a separate product - Mobile Studio), but applications for this platform can still be developed in Delphi XE2.

    Delphi XE4

    Innovations
    • Support for iOS has returned, which was missing in RAD Studio XE3.
    • To replace RAD Studio XE3 Mobile, which was expected to be released in early 2013, RAD Studio XE4 has been enhanced with functionality for developing mobile applications.
    • Programming directly for iPhone and iPad, taking into account all software and technical features.
    • Code generation for the Apple iOS emulator.
    • Improved interaction with databases such as InterBase , SQLite , MySQL , SQL Server, Oracle , PostgreSQL , DB2 , Advantage DB, Firebird , Access , Informix , DataSnap etc.

    Delphi XE5

    RAD Studio XE5 went on sale September 11, 2013. V new version Added support for software development for ARM devices running Android .

    Delphi XE6

    On April 15, 2014, Embarcadero released RAD Studio XE6. The developers called it a "quality release" as hundreds of design and performance bugs were fixed.

    New in IDE XE6

    • Google Glass device design added in form builder.
    • New icons in the IDE. Icons have been updated throughout the product.
    • New features in the deployment manager. New option Rewriting allows you to select files that do not need to be deployed, specifically so that you can avoid overwriting files on the target device. Option Rewriting installed in Is always default.
    • Changes in the SDK manager for Android platforms. Properties for the Android SDK are now organized in three different tabs: SDK, NDK, and Java.
    • Changed and added some options in the Project Options window (new page orientation for mobile apps, new feature Use MSBuild externally to compile for Delphi compiler, new key hardware accelerated on Info Version Page for Android, new features for C++ Linker for all mobile platforms).
    • Run commands provide a new parameter -cleaninstall for mobile platforms.
    Key New Delphi XE6 Features
    • Application Tethering Components
    • Taskbar component: Components for implementing multiple window previews that can be selected in applications using control buttons. Automatic or custom previews. Show progress in taskbar buttons for apps. Overlapping icons on taskbar buttons.
    • Interaction with services in the clouds (BaaS), components for Kinvey and Parse: Interaction with leading backend-as-a-service providers to add this functionality to mobile applications. Easy access to services in the clouds, which eliminates the need to create and maintain your own "backend services". Using push notifications to engage any device and platform users. Access to data and object storage in the clouds. User authentication. Support for REST clients, the creation of which has been available since XE5. Support for the three most popular BaaS providers - Kinvey and Parse based on a set of API access components.
    • New VCL Styles : Give the application an updated look for current versions of Windows or create a unique design for them. Includes Windows Tablet style. Supports Windows 7 and Windows 8. Complete application styling, including menus and window borders.
    • VCL components for working with sensors: Delphi applications can use the capabilities of position sensors, displacement sensors, and others. Access to device sensors from VCL applications for Windows tablets. Capabilities of accelerometer, GPS and gyroscope.
    • In-app purchases and in-app advertising: Mobile apps provide an opportunity to earn money for their developers. You can monetize mobile apps by embedding in-app purchases and ads. Sale of content, functionality, services and subscriptions in iOS and Android. Support for major advertising networks (Google AdMob and Apple iAd).
    • Applications for Google Glass : Delphi development for various devices now extends beyond PCs, tablets and smartphones to wearables. Ability to create Andorid applications for Google Glass . New custom styles to optimize app design and resolution for Google Glass. Designer templates for the Google Glass device.
    • Accessibility: You can make applications more convenient to use large quantity users, including those using screen readers. New special abilities for desktop applications based on FM. Support for JAWS on Windows and VoiceOver on Mac OS X.
    • Quality, performance and stability: Best Opportunities to develop and deliver applications with the highest level of user experience. Over 2000 reported bugs fixed. Improved overall application runtime performance for all platforms.
    • Key features and work with databases: Expansion of key features of the product. Improvement in the FireDAC library for working with databases, FDMemTable. "Data Explorer" (Database Explorer) for FireDAC. Apache support (WebBroker). Support for DirectX 11, OpenGL 4.3 and earlier. DataSnap performance and updated wizards. Refactoring and improvements in RTL. FireDAC driver update for Informix. Apache C++ support.

    Delphi XE7

    Major changes

    Delphi XE8

    • Now you can develop 64-bit applications for iOS;
    • App design preview on different devices simultaneously;
    • The ability to run iOS applications on any iOS simulator registered with RAD Studio (iPad, iPad Air, iPhone 4 and above);
    • Ability to disable built-in RAD Studio Android libraries;
    • RAD Studio now supports new system version control integrated into the IDE to manage and track changes in projects: Mercurial Version Control System Integrated;
    • Allows you to create universal applications for iOS with different bitness - in one executable file there are two codes: 32 bit and 64 bit (ARMv7 + arm64);
    • Integrated Castalia (adds functionality that allows you to perform some tasks in an easier way);
    • Two new platform-independent data types have been added: FixedInt and FixedUInt. (FixedInt- 32-bit signed integer, FixedUInt is a 32-bit unsigned integer).

    Delphi 10 Seattle

    The main innovations of the development environment

    Delphi 10.1 Berlin

    Added support for Android 6.0.

    Delphi 10.2 Tokyo

    Key new features in Delphi 10.2 Tokyo:

    • Delphi includes an application compiler for Linux (Ubuntu Server (LTS 16.04) and RedHat Enterprise (V7));
    • support for MariaDB DBMS is included.

    Delphi for PHP

    In March 2007, CodeGear released the Delphi for PHP development environment for developing web applications using the PHP programming language. Now the Delphi environment is focused not only on the Delphi language. Versions 1 and 2 were released, after which Delphi for PHP was renamed to RadPHP XE (essentially version 3), then RadPHP XE2, and with the release of Delphi XE3, this product was heavily redesigned and named HTML5 Builder.

    Delphi for .NET

    The first version of a full-fledged Delphi environment for .NET is Delphi 8. The environment allows you to write applications only for .NET.

    In Delphi 2005, you can write .NET applications using standard library.NET classes and VCL for .NET. The environment allows you to write .NET applications in . Delphi 2005 also allows you to write common applications using the VCL and CLX libraries.

    Delphi 8, 2005, 2006 use .NET Framework version 1.1. Delphi for .NET 2007, included with CodeGear RAD Studio 2007, is designed for the .NET Framework 2.0.

    As of version 2009, support for Delphi.NET has been dropped. For .NET development, Delphi Prism is offered.

    Delphi Prism

    Delphi Prism- development environment for .NET and Mono in the Oxygene language, using the Visual Studio Shell (with the ability to integrate into Visual Studio).

    see also

    Notes

    1. “The strength independent vendor development - in support multi-platform” (indefinite) (September 18, 2015). - "we have only three such centers outside the USA (one in Canada, and recently appeared in Spain instead of the closed one in Romania)". Retrieved 4 October 2015.

    To confirm the fact of 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: main window (Main Window), Component Palette (Component Palette), toolbars (toolbars), form designer window (Form Designer), code editor window (Code Editor), inspector window objects (Object Inspector), an object tree (Object TreeView) and a code structure explorer (Code Explorer).

    Main window

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

    Main menu

    As in any Windows program, the menu is accessed when needed to open, save or create a new file, call a wizard, switch to another window, change settings, and so on. Each element of the main menu can be duplicated by the corresponding button on the toolbar.

    Delphi toolbars

    Toolbars provide access to the various functions of the IDE's main menu with a single click on the appropriate button. Please note that each button on the toolbar has a sub-tip containing a description of its purpose. In addition to the component palette, the Delphi IDE has five separate toolbars: Debug (Debugging), Desktop (Desktop), Standard (Standard), View (View) and Custom (User). On fig. Figure 1.2 shows the default button configuration for these panels. But any of the buttons can be removed or added by selecting Toolsbars, Customize from the View menu. On fig. Figure 1-3 shows the Customize dialog box for customizing toolbars. To add a new button to any toolbar, simply drag it from this window. To remove a button, simply drag it off the toolbar.

    Toolbars Object tree Main window Form designer window

    Component Palette Object Inspector Window Code Outline 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 containing several tabs that contain all of the VCL and ActiveX components installed in the IDE. The order and appearance of tabs and components can be customized by clicking right click mouse on the object of interest or in the main menu (items Component, Configure Palette).

    Form Builder

    When launched, the Form Designer is a blank panel ready to be turned into a Windows application window. It can be thought of as an artist's canvas for creating the graphical interface of the 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. Precise placement and sizing of components can also be done with the mouse. In addition, it is possible to manage appearance and the behavior of components from the Object Inspector and Code Editor windows.

    Object Inspector

    In the Object Inspector window, you can change the properties of the form components or define events that the form itself or its components will respond to. Properties(properties) are data that define how an object looks on the screen - size, color, font, and so on. Events(events) are sections of code that are executed in response to some action occurring in the application. An example of an event is when a message is received from the mouse or a message is sent to a window requesting that it 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 shows 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 arrange the contents of the Object Inspector window either by category or by name (in alphabetical order). To do this, just right-click anywhere in the Object Inspector window and select Arrange from the pop-up context menu. On fig. Figure 1.5 shows two side-by-side Object Inspector windows. 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 you need to present at the moment.

    One of the most valuable sources of knowledge, which should be able to use

    For any Delphi programmer, is the help system. It is fully integrated with the Object Inspector, and if you ever run into any difficulties with properties or events, all you need to do is 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 generated automatically 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 form is created. new module, and a corresponding tab is added to the Code Editor window. The context 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,

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

    Visual programming environmentDelphi. The Delphi programming environment consists of many visual and non-visual standard components that can significantly speed up the process of developing programs. We will consider one of the most popular versions of Delphi 7. The working window of the program consists of five auxiliary windows (Fig. 3.1.): main window (1), module list window (2), program code window (3), project form window (4 ), object inspector (5), object list window (6).

    Rice. 3.1. Working window Delphi7.

    Main window consists of a menu bar, toolbar and component palette. The component palette consists of 14 pages (Standard, Additional, Win32, System, etc.). To move a component onto a form, you must first click on the component and then on the form.

    Module list window contains a list of all modules connected to the program.

    V program code window programs are directly written in the Object Pascal language. By default, the code window contains text empty program, which meets all the requirements of the program in Delphi.

    Window forms is the Windows window of the program being created: menus, window sizes, titles, frames, and any standard components. When the created program is running, the user sees only the form.

    Object Inspector contains two pages: Properties (properties) and Events (events). The properties page displays all the characteristics of the selected object. The event page displays all possible actions with the object.

    Object list window contains a list of all components placed on the form.

    Structure of the program in the environmentDelphi. A program in any programming language has a standard structure:<заголовок программы> <тело программы>. The program header in the Delphi environment contains the name of the main program module and the scope of all standard and non-standard program modules that are used by the environment to organize the program execution. Consider sections of the program template in the environment.

    The title always starts with the word unit. The default program name is Unit1. To change the program name, it is enough to save the program under a new name.

    Chapter interface starts with a listing in the uses clause of the standard modules. For example, the SysUtils module is designed to be used in the language of all standard features. The Delphi environment automatically inserts a list of required modules into the template of the program being developed. But there are modules that the user needs to enter manually. Further in the section interface under the heading type all data types created in the program are declared. Here under the heading private variables are declared that are available only in this module, and under the heading public– available in all modules of the program. An empty program template in the Delphi environment is shown in Figure 3.2.

    Rice. 3.2. Blank program template in Delphi7

    The type declaration ends when the next section heading appears in the program. In the example above, this is the var keyword. In this section, all variables will be declared according to the data types defined in the program. In the above template, there is only one variable Form1, which is an object of the declared class TForm1. From the line unit to the word implementation is the title of the program. After this word, descriptions of all actions in the program are located. The first mandatory action is the $R directive, which ensures that the form module and the program module are combined into one project - the program. The end of the module program text is determined by the word end with a dot.

    The Delphi environment creates a program from a number of files that provide project setup for the environment, compiler options, and other files. The largest file is the .exe file, which is the finished program. Working files are files with extensions dpr and pas. The file with the cfg extension provides configuration options for the project. A dof file provides compiler options. A file with a res extension is defined as a resource file. It also contains a standard project icon, which the developer can replace. A dcu file is a compiled module file. If there are several modules, they will be combined into a single project. A file with the dfm extension contains the characteristics of all standard form components.

    Data types inDelphi 7 . Each version of the data in the development of the program must be assigned to a specific data type. Each type has its own specific set of operations. You can work with data of a certain type only by creating variables of this type. The data type determines the format of values ​​that a variable of that type can take. Data types are usually divided into simple, structured, dynamic, string and procedural. Simple types include real, date-time, integer, boolean, character, enumerated. Structured types include arrays, records, sets, files, classes.

    To record integers, the same (plus some of their own) data types are used as in Turbo Pascal 7.0., but only with different ranges of values ​​(Table 3.29.).

    Integer data type

    Value range

    Size in bytes

    2147483648…2147483647

    Corresponds to type integer

    2 63 …2 63 – 1

    Corresponds to cardinal type

    Table 3.29. Integer data types in Delphi7.

    Often, when creating programs, it is necessary to convert a number to a string or vice versa. There are functions for this: StrToInt(s) and IntToStr(x), the first of which translates the string s into a number, the second is a number X to a line.

    Real (real) numbers are characterized by the presence of a decimal point in the notation of the number. The recording of such numbers is provided with a certain accuracy, which determines the number of digits in the exponential notation of the number. Delphi 7 uses 6 real types (Table 3.30.).

    Real

    data type

    Maximum value

    Number of digits

    Size in bytes

    9223337203685477.5807

    Table 3.30. Real data types in Delphi7.

    The highest performance is provided for the real type. For transfers real number to a string and vice versa, there are functions StrToFloat(s) and FloatToStr(x).

    Boolean data type as in Turbo Pascal 7.0. contains two variables: true (true) and false (false). The use of logical variables allows you to significantly improve the algorithm for solving problems by controlling some special options for solving the problem.

    String (string) and character (char) data types in Delphi 7 are similar to those in Turbo Pascal 7.0. There are 3 more string data types (Shortstring, Ansistring, Widestring) that differ in length and are used, as a rule, for compatibility with other versions.

    The date-time type (TDateTime) was introduced for user convenience. In this case, the date and time can be written in several forms.

    Constants and arrays are written similarly to Turbo Pascal 7.0.

    P The application of all described data types, functions for working with them and the process of creating specific programs will be considered in the workshop.

    Questions for reflection:

    1. In what language are programs written in the Delphi 7 environment?

    2. What parts does the working window of the Delphi 7 program consist of?

    3. How many files are used to create a program in Delphi 7?

    4. What are the data types in Delphi 7?

    5. How can data types of the same name differ in Turbo Pascal 7.0. and Delphi 7?

    1. Familiarity with the Delphi programming environment

    1.1 Structure of the programming environment

    Delphi- a system for rapid development of applications for the Windows operating system. Concept Delphi was implemented at the end of 1994, when the first version of the development environment was released. This software product is based on the concepts of object-oriented programming and a visual approach to building an application interface. To date, the seventh version of the environment has been released. From version to version, developers improve the tools for developing applications.

    Delphi it is a combination of several key technologies:

    o High performance compiler to native code

    o Object-oriented component model

    o Visual building applications from software prototypes

    o Scalable database building tools

    A Windows application is a special type of program that:

    Ø Has a special format executable file(*.exe)

    Ø Only works with Windows

    Ø Usually works in a rectangular window on the screen

    Ø Can run simultaneously with other Windows programs, including other instances of the same application

    Ø DIV_ADBLOCK441">


    The main parts of Delphi are listed below:

    1. Main window

    2. Form Designer

    3. Source Editor Window (Editor Window)

    4. Component Palette

    5. Object Inspector

    6. Directory (On-line help)

    There are, of course, other important parts of Delphi, such as the toolbar, the system menu, and many others, that are needed to fine-tune the program and programming environment. Consider the functions of each component.

    Main window manages the application development process. It manages the files included in the application and does all the work related to maintaining, compiling, and debugging them. The main window has

    § Main menu(MenuBar), located directly below the title bar of the main window and allows you to access all the features of the development environment.

    § Toolbar(SpeedBar) provides fast access to most of the main menu commands. Located below the main menu.

    § Component Palette(Component Palette) provides access to visual components that can be placed on the form.

    Delphi programmers spend most of their time switching between the Form Designer and the Source Editor Window (called the Editor for short).

    Form Designer Delphi is so intuitive and easy to use that creating a visual interface is child's play. The form window is a project of the Windows-window of the future program. At first, this window is empty. More precisely, it contains interface elements standard for Windows - buttons for calling the system menu, maximizing, minimizing and closing the window, a title bar and an outlining frame. The entire working area of ​​the window is usually filled with points of the coordinate grid, which serves to arrange the components placed on the form (you can remove these points by calling the corresponding settings window using the Tools | Environment options menu and unchecking the Display Grid switch on the window associated with the Preferences tab) . A significant part of the time, the programmer is busy with an exciting activity, reminiscent of working with a set of Lego parts: he “pulls out” the required component from the palette of components, as if from a box with parts, and places it on the “typesetting field” of the form window, gradually filling the form with interface elements. Actually, it is in this process of filling out the form that the main highlight of visual programming lies. The programmer at any time controls the content of the window of the program being created and can make the necessary changes to it. Despite all the importance Form Designer, the place where programmers spend most of their time is Editor. Logic is the driving force of the program and Editor - the place where you "code" it.

    Component Palette - this is the main wealth of Delphi. It occupies the right side of the main window and has tabs that allow you to quickly find the desired component. A component is a functional element that contains certain properties and is placed by the programmer in the form window. With the help of components, a program framework is created, in any case, its external manifestations visible on the screen: windows, buttons, selection lists, etc. Palette Component allows you to select the desired objects to place them on the Form Designer. For use Palettes Component just click on one of the objects for the first time and then on the second time Form Designer. The object you selected will appear on the projected window and can be manipulated with the mouse. Palette Component uses pagination grouping of objects. At the bottom Palettes there is a set of bookmarks - Standard, Additional, Dialogs, etc. If you click on one of the bookmarks, you can go to the next page Palettes Component. The principle of pagination is widely used in the Delphi programming environment and can be easily used in your program.

    On the left of Form Designer You can see Object Inspector. Any component placed on the form is characterized by a certain set of parameters: position, size, color, etc. Some of these parameters, for example, the position and size of the component, the programmer can change by manipulating the component in the form window. To change other parameters, use the Object Inspector window. This window contains two pages - Properties (Properties) and Events (Events). The properties page is used to set the necessary properties of the component, the Events page allows you to determine the component's reaction to a particular event. The set of properties displays the visible side of the component: the position relative to the upper left corner of the form workspace, its size and color, the font and text of the inscription on it, etc.; a set of events - its behavioral side: whether the component will respond to a mouse click or keystroke, how it will behave when it appears on the screen or when the window is resized, etc. Each page of the Object Inspector window is a two-column table, the left column contains the name of the property or event, and the right column contains the specific value of the property or the name of the subroutine [If you are not already familiar with this term, consider that a subroutine is just a relatively small piece of program.] that handles the corresponding event. At the top of the Object Inspector window is a drop-down list of all components placed on the form. Because the form itself is a component, its name is also in this list.


    The event page is linked to editor; If you double-click on the right side of an item, the code corresponding to this event will automatically be written to Editor, myself Editor immediately receives focus, and you immediately have the opportunity to add code for this event handler. The code window is intended for creating and editing program text. This text is compiled according to special rules and describes the algorithm of the program. The set of rules for writing text is called a programming language. The Delphi system uses the Object Pascal programming language, which is an extended and improved version of the widely used Pascal language, first proposed by the Swiss scientist N. Wirth back in 1970 and improved by employees of the Borland Corporation (the languages ​​they created were called Turbo Pascal, Borland Pascal and Object Pascal). Initially, the code window contains minimal source code to ensure that the empty form functions properly as a full-fledged Windows window. During the work on the project, the programmer makes the necessary additions to it in order to give the program the desired functionality. Since you will need to create and modify (edit) program code to create even simple programs, the following describes the basic techniques for working with the code window. Immediately after opening a new project, it will contain the minimum required lines of code to describe the form.

    The last important part of the Delphi environment is − Directory (on-line help). To access this tool, simply select Help and then Contents from the system menu. The screen will show Directory. Directory is context-sensitive; when you press the F1 key, you will get a prompt corresponding to the current situation. For example, while in the Object Inspector, select a property and press F1 - you will get help on the purpose of this property. If at any moment of work in the Delphi environment there is an ambiguity or difficulty - press F1 and the necessary information will appear on the screen.

    1.2 The Delphi project

    The main program that uses modules written by the programmer is called project. A project may include forms, modules, project settings, resources, graphic information, etc. All this information is stored in various files that are used in the host program, i.e., in the project.

    Any project has at least six files associated with it. Three of them relate to project management from the environment and are not directly changed by the programmer. The following is a list of files that must be included in a project.

    · The main project file, originally called PROJECT1.DPR.

    · The first module of the program (unit), which automatically appears at the beginning of work. The file is called UNIT1.PAS by default, but it can be called any other name, such as MAIN. P.A.S.

    · The main form file, which is called UNIT1.DFM by default, is used to store information about the appearance of the main form.

    · The file PROJECT1.RES contains the icon for the project, it is created automatically.

    · The file, which is called PROJECT1.DFO by default, is a text file for saving the settings associated with this project. For example, compiler directives set by the developer are saved here.

    · The PROJECT1.CFG file contains information about the state of the workspace.

    Of course, if you save the project under a different name, then the name and files with the extension RES, DFO and CFG will change. In addition, backup files (i.e. files with extensions *.~df, *.~dp, *.~pa) are stored in the project. Since the project contains many files, it is recommended to create a separate directory for each project. All manipulations with files (saving, renaming, editing, etc.) are recommended to be done only in the development environment.

    After compiling the program, files with extensions are obtained: DCU - compiled modules EXE - executable file

    1.3 Main menu of the environment

    Menu item “File”

    New prompts you to select the type of new application

    NewApplication starts new project for window application

    new form creates a new form and a module associated with it

    open opens any module if necessary, or simply text file. If the module describes a form, then this form will also appear on the screen.

    open project opens an existing project.

    Reopen opens a previously opened project

    Save saves only the edited file, not the whole project.

    Save As saves the edited file under a different name.

    Save ProjectAs saves the project

    close removes the current file from the Editor window.

    close All closes all project files

    Figure 2

    Menu item “Edit”

    "Edit" contains commands Undo and redo, which can be very useful when working in the editor to eliminate the consequences of incorrect actions, for example, if a necessary piece of text is accidentally deleted.

    Teams Cut, Copy, Paste and Delete- as in all other Windows applications, but they can be applied not only to text, but also to visual components. bring To Front, send To Back, Alignandsize are used to align and control the appearance of components on a form.

    Menu item " view

    project manager allows you to see the contents of the project.

    Object Inspector shows the Object Inspector window.

    Paragraph menu “project”

    Add to project allows you to add a form to the project.

    Remove from project removes the form from the project.

    view Source shows the contents of the project file.

    Syntax Check only checks the correctness of the program code, but does not update DCU files.

    Menu item “Run”

    RunF9 compiles and runs the application for execution

    program reset removes the application from execution.

    1.4 First Delphi application

    Consider the process of building a simple application that works as follows. When the button is pressed, the message "Hello, world!" appears.

    Procedure:

    1. Run Delphi. (Start/ Programs/Borland Delphi 5 ) This automatically opens a new project for a window application with one main form and a module corresponding to this form.

    2. Select the tab in the Component Palette standard. and drag from the Components Palette to the form components and TButton. To do this, move the mouse cursor to the components one by one, reading the hints, until the TButton. Select it by pressing the left mouse button, and then move the pointer to the shape and click again on the mouse button. The component placed on the form will have the name button1 . In this case, the text of the module will look like

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

    TForm1 = class(TForm)

    Button1: TButton;

    (Private declarations)

    (Public declarations)

    3. In order for any actions to take place when the button is clicked, you need to write an event handler button1 Click. To do this, select on the form button1 and double click on it. You will be in the editing window.

    4. Make the button click event handler look like this:

    procedure TForm1.Button1Click(Sender: TObject);

    ShowMessage('Hello, peace!");

    end;

    5. Save the Application by selecting the item in the main menu File -> Save All . The name of the project and the name of the program module must not match! It is recommended to create a separate directory for project files.

    6. Run your Application. To do this, select the item in the main menu. run-> Run , or press the key F 9 .

    Unit1.pas" (Form1);

    application. initialize;

    application. CreateForm(TForm1, Form1);

    Each project has an associated global Application object that encapsulates the properties and methods of a Windows application. In the project file that the environment generates automatically, the methods of this object are called: initialization, form creation, application operation.

    1.5 Security questions

    1. Name the main components of the DELPHI environment and their purpose.

    2. Name the composition and purpose of the main menu items of the system.

    3. What is the purpose of the Object Inspector?

    4. What are the main files of an application project?

    5. How are components placed, moved, resized on the form?

    6. How to run an application from the DELPHI environment?

    2. Visual Component Library (VCL)

    2.1 VCL Base Class Hierarchy

    The Visual Component Library includes many classes that you can use when developing applications. VCL is closely related to the development environment (all visual components are located on the Component Palette) and allows you to quickly create an application interface. The set of classes included in the visual component library is organized in a hierarchy. At the top level of the hierarchy is the TObject class, which is the ancestor of any class. From it, each class inherits the mechanisms for creating and destroying an instance of the class. All classes in the Visual Component Library are descended from a group of base classes that form the basis of the hierarchy.

    The TComponent class is the most important class because it is the ancestor of visual components. It is endowed with the interaction of the component with the development environment, with the Component Palette and the Object Inspector. Thanks to these features, the components start working already during the development of the application interface. Visual components can be divided into two groups: visible and invisible. Visible components are visible not only during interface design, but also during application operation. Invisible components are not visible while the program is running; they interact with resources or with other components. Invisible visual components can be generated directly from the TComponent class.

    The TControl class is the direct ancestor of the visible visual components and has the appropriate properties and methods to control the appearance of the components. Visible components that have input focus, i.e., have the ability to receive and process Windows messages (for example, from the keyboard), are derived from the TWinControl class.

    2.2 Types of component properties. Change properties

    Each component has its own set of characteristics or properties. For the user (programmer), the property looks like a simple field of some structure containing some value. However, unlike “just” a field, any change in the value of some property of the component immediately leads to a change in the visual representation of this component, since the property encapsulates the methods (actions) associated with reading and writing this field (which, in turn, include necessary redrawing). Each component that is placed on the form is reflected in the Object Inspector window. The Object Inspector has two "pages" - "Properties" (Properties) and "Events" (Events), where you can change the characteristics of the component.

    There are several types of properties, depending on their “nature”, i.e. internal structure.

    o Simple properties are those whose values ​​are numbers or strings. For example, the Left and Top properties take integer values ​​that specify the position of the top left corner of a component or form. The Caption and Name properties are strings and define the title and name of the component or form.

    o Enumerated properties are those that can take values ​​from a predefined set (list). The simplest example is a property of type Boolean, which can take the values True or False.

    o Nested properties are those that support nested values ​​(or objects). The Object Inspector displays a “+” sign to the left of the name of such properties. Some properties, such as Font, have the ability to call a dialog box to change their values. To do this, just click on the small button with three dots on the right side of the line in the Object Inspector that shows this property.

    Delphi makes it easy to manipulate component properties both in design time (design time) and run time (run time). In design mode, properties are manipulated using the Forms Designer or on the “Properties” page of the Object Inspector. For example, in order to change the Height (height) and Width (width) properties of a button, it is enough to “hook” the mouse over any of its corners and move it to the desired view. The same result can be achieved by simply substituting new values ​​for the Height and Width properties in the Object Inspector window.

    On the other hand, in runtime mode, the user (programmer) has the ability not only to manipulate all the properties displayed in the Object Inspector, but also to manage a more extensive list of them, including properties of other classes that are not visual components and, therefore, are not displayed in the Object Inspector.

    All changes to component property values ​​in runtime must be done by directly writing lines of code in Pascal. It is not possible to use the Object Inspector in runtime. However, it is quite easy to access component properties programmatically. All you need to do to change any property is to write simple stitch code similar to the following:

    MyComponent. Width:= 35;

    The above line sets the width (Width) of the component to 35. If the component's Width property was not already set to 35 by the time this line of code is executed, you can see how the component visually changes its width.

    Thus, there is nothing magical about the Object Inspector. The Object Inspector is simply a convenient way to do things in design mode that can be done programmatically in runtime. Moreover, as mentioned above, a component may have properties that are not displayed in the Object Inspector window.

    The object-oriented language Pascal, which underlies Delphi, has as its base the principle of matching visual components to the things they represent. The Delphi developers have set themselves the goal that, for example, the representation of a Button component (button), encapsulating some code, matches the visual image of the button on the screen and is as close as possible to the real button that can be found on the keyboard. And it is from this principle that the concept of property was born.

    If you change the Width and Height properties of the Button component, the button will change its width and height accordingly. However, after changing the Width property, there is no need to tell the object to redraw itself, although in normal programming this is exactly what should be done.

    2.3 Some general properties of components

    Let's look at some of the properties that each visual component has, since these properties are inherited from the base classes of the visual component library hierarchy. The TComponent class is the ancestor of all visual components, and components get the following properties from it.

    Table 1 Properties of the TComponent class

    Property

    Purpose

    component ID

    a four-byte integer property that the programmer can use at will

    All visible visual components are derived from the TControl class and inherit properties related to the location and appearance of the component. These properties can be divided into several groups.

    Table 2 Component size and location

    Property

    Purpose

    vertical position of the top left corner of the component

    horizontal position of the upper left corner of the component

    component height

    component width

    Table 3 Alignment and scaling

    Property

    Purpose

    alignment of the component relative to the parent component's bounds

    Alignment

    alignment of the label on the component

    anchoring the component to the sides of the parent component

    Constraints

    a complex property that determines the maximum and minimum allowable dimensions of the component

    autosize

    Boolean property that enables or disables automatic resizing of the component according to the size of its content

    Table 4 Appearance

    Property

    Purpose

    component color

    cursor appearance when hovering the mouse over the component

    label on the component

    a complex property that determines the font type of the inscription

    a boolean property that determines the visibility of the component

    PopupMenu

    a boolean property that enables or disables the use of the popup menu

    a boolean property that determines the availability of the component

    tooltip text that appears when the mouse cursor is hovered over the component

    ShowHint

    a boolean property that enables or disables the hint

    2.4 Events in Delphi

    One of the key goals of a visual programming environment is to hide the complexity of Windows programming from the user. At the same time, however, it would be desirable that such an environment would not be simplified to such an extent that programmers lose access to the operating system itself.

    Event-driven programming is an integral part of Windows. Delphi provides full access to a substructure of events that occur in the Windows operating environment. On the other hand, Delphi makes it easy to program handlers for such events.

    Objects from the Visual Component Library (VCL) Delphi, as well as real world objects, have their own set of properties and their own behavior - a set of responses to events that occur to them. The list of events for a given object to which it responds can be viewed, for example, in the Object Inspector on the events page. (Actually, this page provides a list of properties that are links to event handler procedures.) Among the set of events for various objects from the VCL, there are both events ported from Windows (for example, events that are generated by the mouse or keyboard) , and events generated as a result of running the application by changing the properties of objects).

    The behavior of an object is determined by what handlers and for what events it has. Creating an application in Delphi consists of setting the properties of the objects used and creating event handlers.

Liked the article? Share with friends!
Was this article helpful?
Yes
Not
Thanks for your feedback!
Something went wrong and your vote was not counted.
Thank you. Your message has been sent
Did you find an error in the text?
Select it, click Ctrl+Enter and we'll fix it!