Tip 1: How to write a program in Delphi

Delphi programming language has a vast army of fans.Among its advantages include simplicity and clarity, to learn the basics of programming it may even a beginner.To write a program on Delphi, you must be able to work with the programming environment Borland Delphi and know the basic rules for creating applications.
found on the internet and download the programming environment Borland Delphi.Install it on your computer, run.In the window you see the future of the workpiece interface - a window with the name Form1.Change the name to the right you click the title bar and typing in the desired text in the left column, in the Caption.
At the top of the program window is a palette of components.It has all the necessary elements to create almost any program.You can simply drag them with the mouse on the form.For example, drag the button and place it in the right place.Change its name just as you have changed the name of the form.
If you create a text editor, analogue of "
Notepad", you need a text field.Locate the Component Palette element Memo or RichEdit and drag it onto the form.Be in the right place and drag to the desired size.Add the shape of the right buttons.Menu you create by using the MainMenu.
to open files and save them you need OpenDialog components and SaveDialog.The context menu you can call by using the PopupMenu.FontDialog component allows to choose the desired font.The icons of the last five components located in any part of the form, in the finished program, they will not be visible.
Do you have a blank text editor future, but its components need to be configured.In particular, it is necessary to enter the menu items and assign them to the event handlers.You must enter a line of code that handle key presses.Click a button on the form, double-arm, open the code window.
It now you and start to really learn programming.You need to enter the desired line of code.Look at this one example: http://drug.xan.su/?p=61.Using it, you can create a simple text editor.
Ready program be compiled to get the executable file.To learn how you compile in Delphi, you can see here: http://www.kurslab.ru/lesson1.html.The compilation has its own quirks, such as the program to work not only on your computer, but on the other, to adjust some settings.
Open the menu Project - Options.Uncheck the Use dynamic RTL properties Linker and Build with runtime packages in the properties of Packages.
With self-writing programs are very important to make the correct algorithm of its work.Do not spare the time for it, because the more carefully you prescribe algorithm, the easier it will be to translate it into the code, and the better your program.The code required to make a comment.Without them, you have a couple of months can hardly understand your own code.Comments are deleted during compilation, so do not affect the size of the program.
thoroughly tested ready program for possible errors.Tortured her in all possible ways: perform unintended operations, resize windows, etc.Properly tuned program will not change the size of the window if it is not provided, do not throw an error in response to inappropriate actions.In the latter case, error handlers are activated.

Tip 2: How to write a program in Delphi

Delphi is one of the most common programming languages.However, beginners who are just beginning familiarity with Delphi , the question arises of how to still write and run a program this convenient and practical language.
How to write a program in Delphi
you need
  • installed package Delfi.
Delphi characterized primarily by the fact that for him there is no need to download additional software packages for writing and compiling.The compiler comes with the package itself a programming language that makes it easier to work with this program yazykom.Chtoby write , you must run the Delphi compiler .When you start a new project is created automatically, with whom to work.To create a new project, you can always use the corresponding menu item (File - New - Application).
Next you need to create the necessary components on the form that is displayed after you create the application.To do this, select the item in the component palette, and then select the desired location and size of the mold, stretching the left mouse button rectangle.To create multiple components at once, the choice of the palette should be carried out while holding the key Shift.
Next you need to create a handler for the component.The desired component is selected on the form, and then switch to the tab "Events» («Events») Object Inspector.Then you need to make a double click on the name of the event, and then create the right method from the template.
Next to start the program simply press F9, or Run on the toolbar.
compiled program in the environment of Delphi has a resolution «* .exe», while the modules themselves have the extension «* .pas», as a form file - «* .dcu».
Helpful Hint
for more thorough study of the Delphi programming environment should refer to specialized literature.This will help improve the quality of writing programs and their functionality.
Helpful Hint
Always consider contingencies in the code that the program knew how to do it.If the program is in response to some action is aborted with the message about the unacceptable error, it is a clear sign of programmer error.


Related Posts