Delphi Getting Started 1

zhaozj2021-02-16  53

1) Install Delphi: Run / ISTALL/setup.exe file on the CD

2) Enter the Delphi environment:

Load Delphi for the first time, four windows appear on the screen:

-> Delphi main window titled "Delphi-Project1"

-> Object Inspector Window

-> Form (FORM) window titled "Form1"

-> The title "Unit1.PAS" code editing window.

3) Main window (Main Form)

The main window of Delphi is located on the upper end of the screen, including the Menu (menu), the Speed ​​Bar (Accelerating Bar), and the Component Panel. Menu is a drop-down main menu. The Speed ​​Bar is located at the lower left of the main window, consists of a total of 14 acceleration buttons in two rows. These buttons are shortcuts for menu functions, and various icons can intuitively represent the action it can perform. Component Panel consists of one line, several page object buttons, using it to select the required components and put it in the form.

4) Object Inspector (Object Checkper)

The Object Inspector window contains two pages: Properties page Display the properties information of the currently selected components in the form, and allows you to change the properties of the object; the events page lists the events that the current components can respond. Press the "Events" page label at the lower end of the Object Inspector so that the events page can be seen that the blank of the event behind this can define the action that the object is performed when the corresponding event is accepted. When started for the first time, the Object Inspector window displays the properties of the current form FORM1. Object Inspector determines if there is a row display based on the object attribute. Move the rolling strip to view all the properties of the current object.

In addition, Object Inspector also has an Object Selector located in the drop-down menu above the Object Inspector. It shows the name and type of all parts on the form, and also contains the form itself. You can easily switch between the various components of the form, or quickly return to the form itself. When you contain more objects in the form, you will find that this is the fastest way to switch objects, especially back to the form.

To make Object Inspector, move the mouse to the Object Inspector, press Right-click to launch the Object Inspector's pop-up menu, set it to Stay on top. This is often a very important way for beginners.

5) Form window

The Forms window is a work area that is mostly designed. The form FORM1 is displayed when Delphi 2.0 is started for the first time. The components can be placed in the form, and they can arrange them with their heart by moving the position, changing the size, etc., to develop the user interface of the application to develop applications. You can imagine the form into a container that can place other parts. There is a grid (Grids) on the form, and the location is aligned when the part is placed, and the grids is invisible when the program is running.

A real application may have more than one window, you can use different forms to design. Other forms can be dialog (Dialog box), data entry box, and the like.

6) Code window

The code window is in the form window. Because in Delphi, the design user interface is directly in the form, and the operation results are completely consistent. When the component is placed on the form, Delphi automatically generates most of the user interface code. What you should do is joined to the block that you need to do in the framework. The status of the FORM1 is visible to the code window.

This window is the code editor. You can write the source code for the Delphi application. When there is more than one window in the program, there will be a source program of several library units appear in the code editor. The title bar of the code editor shows the name of the library unit file that is currently editing. To see the source code for a particular program, simply use the mouse point to write the page tab with the library unit file name, you can edit the library unit.

7) Start our first Delphi program: -> Select the File | New Application menu item on the menu to generate a new engineering file; -> Select the part Add to Form-> Change the object's properties (change with the Properties page Part's Property Value) -> Write an Event Process (in Object Inspector, point the "Events" page tab, the event window.) -> Parts Adjustment and alignment (mobile part, adjust the size, make a set of components) -> Save the job done (for designers, there are two files to save: library unit files (with .PAS are suffix) and engineering files (with a .dpr for suffix).) -> Running project (above Operation allows you to have your own application interface. Press the "Run" button in the speed bar (painted with green triangle icon), you can see that the generated interface is exactly the same as the interface you design.) 8) Take it back to see what is in the DFM file. 9) Take a look at the PAS file (the basic architecture of the Object Pascal) Unit unit1; {program unit start and unit name} interface {program unit external interface, Used to define components that can be seen and used by other programs} Uses {USES clause: Let us make program components declared in the Interface section of other program units} Windows, Messages, Sysutils, Classes, Graphics, Controls, Forms , Dialogs; Typetform1 = Class (TForm) {PRIVATE Declaration} PRIVATE {Private Declarations} PUBLIC {PUBLIC DECLARATIONS} End; Varform1: TFORM1; {Variable Declaration} Implementation {The actual program element is declared in the Interface section} {$ R * .dfm} end.

转载请注明原文地址:https://www.9cbs.com/read-20413.html

New Post(0)