




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Developing applications with DelphiBorland Delphi is an object-oriented, visual programming environment to develop32-bit applications for deployment on Windows and Linux. Using Delphi, you can create highly efficie nt applicati ons with a minimum of manual codi ng.Delphi provides a suite of Rapid Ap
2、plicati on Developme nt (RAD) desig n tools, in clud ing programming wizards and application and form templates, and supports object-oriented program ming with a comprehe nsive class library that in cludes:? The Visual Component Library (VCL), which includes objects that encapsulate the Win dows API
3、 as well as other useful program ming tech niq ues (Win dows).? The Borland Component Library for Cross-Platform (CLX), which includes objects that en capsulate the Qt library (Win dows or Linu x).This chapter briefly describes the Delphi development environment and how it fits into the development
4、life cycle. The rest of this manual provides technical details on developing general-purpose, database, Internet and Intranet applications, creating ActiveX and COM con trols, and writi ng your own comp onen ts.In tegrated developme nt en vir onmentWhe n you start Delphi, you are immediately placed
5、with in the in tegrated developme nt environment, also called the IDE. This IDE provides all the tools you need to design, develop, test, debug, and deploy applications, allowing rapid prototyping and a shorter development time.The IDE in cludes all the tools n ecessary to start desig ning applicati
6、 ons, such as the:? Form Desig ner, or form, a bla nk window on which to desig n the user in terface (UI) for your applicati on.? Component palette for displaying visual and nonvisual components you can use to desig n your user in terface.? Object Inspector for examining and changing an object s pro
7、perties and events.? Object TreeView for displayi ng and cha nging a comp onents logical relati on ships.? Code editor for writing and editing the underlying program logic.? Project Manager for managing the files that make up one or more projects.? Integrated debugger for finding and fixing errors i
8、n your code.? Many other tools such as property editors to change the values for an object s p? Command-line tools including compilers, linkers, and other utilities.? Extensive class libraries with many reusable objects. Many of the objects provided in the class library are accessible in the IDE fro
9、m the Component palette. By convention, the names of objects in the class library begin with a T, such as TStatusBar. Names of objects that begin with a Q are based on the Qt library and are used for cross-platform applications.Some tools may not be in cluded in all editi ons of the product.A more c
10、omplete overview of the development environment is presentedin the Quick Start manual in cluded with the product .In additi on, the on li ne Help system provides help on all menus, dialog boxes, and win dows.Desig ning applicati onsYou can desig n any kind of 32-bit applicati on from gen eral-purpos
11、e utilities to sophisti ated data access programs or distributed applicati ons.As you visually desig n the user in terface for your applicati on, the Form Desig ner gen erates the un derly ing Delphi code to support the applicati on. As you select and modify the properties of comp onents and forms,
12、the results of those cha nges appear automatically in the source code, and vice versa. You can modify the source files directly with any text editor, including the built-in Code editor. The changesyou make are immediately reflected in the visual environmen t.cYou can create your own comp onents usin
13、g the Delphi la nguage. Most of the comp onents provided are written in Delphi. You can add components that you write to the Component palette and customize the palette for your use by including new tabs if needed.You can also desig n applicati ons that run on both Linux and Win dows by using CLXcom
14、p onen ts. CLX contains a set of classes that, if used in stead of those in the VCL, allows your program to port between Windows and Linux. Refer to Chapter 15,“ Developingcross-platform applicati onsfor details abcHplafm program ming and the differe ncesbetween the Windows and Linux environments. I
15、f you are using Kylix while developing cross-platform applications, Kylix also includes a Developer s Guide that is tailored forLinux environment. You can refer to the manual both in the Kylix online Help or the printed manual provided with the Kylix product.Chapter 8, “ Build ing applicatio ns, com
16、p onen ts, and libraries, in ”oduces support for differe nt types of applicati ons.Creati ng projectsAll applicatio n developme nt revolves around projects. Whe n you create an applicati on in Delphi you are creating a project. A project is a collection of files that make up an application. Some of
17、these files are created at desig n time. Others are gen erated automatically whe n you compile the project source code.You can view the contents of a project in a project managementtool called the Project Manager. The Project Manager lists, in a hierarchical view, the unit names, the forms contained
18、 in the unit (if there is on e), and shows the paths to the files in the project. Although you can edit many of these files directly, it is often easier and more reliable to use the visual tools.At the top of the project hierarchy is a group file. You can combine multiple projects into a project gro
19、up. This allows you to ope n more tha n one project at a time in the Project Man ager. Project groups let you organize and work on related projects, such as applications that function together or parts of a multi-tiered application. If you are only working on one project, you do not need a project g
20、roup file to create an application.Project files, which describe in dividual projects, files, and associated opti ons, have a .dpr extension. Project files contain directions for building an application or shared object. When you add and remove files using the Project Manager, the project file is up
21、dated. You specify project options using a Project Options dialog which has tabs for various aspectsof your project such as forms, applicati on, and compiler. These project opti ons are stored in the project file with the project.Un its and forms are the basic build ing blocks of an applicati on. A
22、project can share any existing form and unit file including those that reside outside the project directory tree. This in cludes custom procedures and fun cti ons that have bee n writte n as sta ndal one routi nes.If you add a shared file to a project, realize that the file is not copied into the cu
23、rrent project directory; it rema ins in its curre nt locati on. Add ing the shared file to the curre nt project registers the file name and path in the uses clause of the project file. Delphi automatically han dles this as you add un its to a project.When you compile a project, it does not matter wh
24、ere the files that make up the project reside. The compiler treats shared files the same as those created by the project itself.Edit ing codeThe Code editor is a full-featured ASCII editor. If using the visual programming environment, a form is automatically displayed as part of a new project. You c
25、an start desig ning your applicati on in terface by placi ng objects on the form and modifyi ng how they work in the Object In spector. But other program ming tasks, such as writ ing eve nt han dlers for objects, must be done by typ ing the code.The contents of the form, all of its properties, its c
26、omponents, and their properties can be viewed and edited as text in the Code editor. You can adjust the gen erated code in the Code editor and add more components within the editor by typing code. As you type code into the editor, the compiler is constantly scanning for changes and updating the form
27、 with the new layout. You can then go back to the form, view and test the changes you made in the editor, and con ti nue adjust ing the form from there.The code gen erati on and property stream ing systems are completely ope n to in spect ion. The source code for everything that is included in your
28、final executable file all of the VCL objects, CLX objects, RTL sources, and project filescan be viewed and edited in the Code editor.Compili ng applicati onsWhe n you have fini shed desig ning your applicati on in terface on the form and writ ing additional code so it does what you want, you can com
29、pile the project from the IDE or from the comma nd line.All projects have as a target a single distributable executable file. You can view or test your application at various stages of development by compiling, building, or running it:? When you compile, only units that have changed since the last c
30、ompile are recompiled.? When you build, all units in the project are compiled, regardless of whether they have cha nged since the last compile. This tech nique is useful whe n you are un sure of exactly which files have or have not been changed, or when you simply want to ensure that all files are c
31、urre nt and synchroni zed. Its also importa nt to build whe n youve cha nged global compiler directives to ensure that all code compiles in the proper state.You can also test the validity of your source code without attempt ing to compile the project.? When you run, you compile and then execute your
32、 application. If you modified the source code since the last compilati on, the compiler recompiles those cha nged modules and reli nks your applicati on.If you have grouped several projects together, you can compile or build all projects in a single project group at once. Choose Project|Compile All
33、Projects or Project|Build All Projects with the project group selected in the Project Man ager.Note To compile a CLX application on Linux, you need Kylix.Debugg ing applicati onsWith the integrated debugger, you can find and fix errors in your applications. The in tegrated debugger lets you con trol
34、 program executi on, mon itor variable values and items in data structures, and modify data values while debugg ing.The in tegrated debugger can track dow n both run time errors and logic errors. By running to specific program locations and viewing the variable values, the functions on the call stac
35、k, and the program output, you can mon itor how your program behaves and find the areas where it is not behav ing as desig ned. The debugger is described in on li ne Help.You can also use excepti on han dli ng to recog ni ze, locate, and deal with errors. Excepti ons are classes, like other classes
36、in Delphi, except, by conven ti on, they beg in with an in itial E rather tha n a T.Deplo ying applicati onsDelphi includes add-on tools to help with application deployment. For example, In stallShield Express (not available in all editi ons) helps you to create an in stallati on package for your ap
37、plication that includes all of the files needed for running a distributed application. TeamSource software (not available in all editi ons) is also available for track ing applicati on updates.To deploy a CLX application on Linux, you need Kylix.Note Not all editi ons have deployme nt capabilities.发
38、展中的应用软件 DelphiDelphi是一个目标导向,可视化编程环境,来扩展 32位的,使用Delhi,你可以用 最少量的手工译码创建高效的应用。Delphi提供了一系列的RAD的设计工具,包括程序压缩和应用和形成模板,并用 层次比较高的图书馆来支持目标导向程序。 VCL ,可以把WindowsAPL和其他有用的编 程工具压缩CLX,可以把Qt library压缩。本片文章简要地描述了 Delphi运行环境和它是怎样适合发展的周期循环。其余提供 了一般目的,数据库,因特网和互连网应用,创造 ActiveX and COM控制的技术详细资 料,并写下你自己的见解。完整的发展环境当你使用Delp
39、hi的时候,你应该立即投入到完整的发展环境,也叫作 IDE,IDE可 以提供给你在设计、发展、测试、调试、配置应用中所需要的所有工具,并提供了快速 的原型和更短的发展时间。IDE包括了开始设计应用的所必须的工具,例如:架构设计,或者形成一个可以在上面设计用户界面的空白窗口。组成画板,展示可视和非可视部分,你可以使用它们来设计你的用户界面。目标检测,检查和改变目标的属性和事件。目标树型图,显示和改变组件的逻辑关系。代码编辑器,编写和编辑基本程序逻辑。项目管理器,管理组成一个或多个项目的文件。综合调试器,找出和修改编码中的错误。许多其他工具,如;属性编辑器改变目标属性值。命令行工具,包括编译器,目
40、标代码连接器,和其他用途。大量的类库包括许多可再度利用的对象。类库中提供的许多对象可以从IDE中的组成画板获得。通过协定,类库中对象的名字以T开头,例如TStatusBar,以Q字母开头的对象的名字是基于 Qt库的,并被用于交叉平台的应用。一些工具不可能在产品的所有版本中包括。发展环境的更完整的看法在快速启动中提出包括产物。还有,在线帮助系统可以提 供所有的菜单,对话框,和窗口的帮助。设计应用你可以设计任何种的32位应用程序一一从普通目的的用途到精密的数据获得程序 或者分布应用。当你设计为了你应用的用户界面,架构设计器产生隐藏的Delph编码来支持应用当你选择和修改组成和架构的属性,改变的结果
41、可以在源代码中自动出现,反之依然。 你可以直接使用任何文本编辑器来修改源文件,包括内置代码编辑器。你做的任何改变 可以立即在可视环境中反映。使用Delphi语言,你可以创造你自己的架构。大部分的架构可以写在Delphi中如果需要,你可以为你的使用增加组成画板和定制颜料。你也可以使用CLX组件,自己设计在Linux and Windows中都能运行的应用软件。 CLX包含一系列分类,如果在VCL中代替那些而被使用,可以允许你的程序在 Windows 和Linux转换。15章中提到“发展中的交叉平台”详细的介绍了交叉平台程序和在 Windows和Windows环境中的区别。如果你在使用 Kylix
42、而在运行交叉平台应用程序, Kylix也包括开发者的向导来把你带到Linux环境中。你也可以参考 Kylix产品提供的Kylix在线帮助。创建对象所有的应用软件发展包括项目。当你在Delphi中创建一个应用软件,你正在创建一 个项目。项目是组成项目的文件的收集。一些这样的设计文件在设计时间被创建。其他 的是在当你编译项目源代码时自动产生。你可以在项目管理工具叫做项目管理器中来观看项目的内容。项目管理器分类列 表,单元名称,单元中包含的窗体(如果是一个),并且显示项目中文件的路径。虽然你可以直接编辑许多这些文件,但是使用可视化工具会更简单和更可靠。项目等级的顶部是一组文件。你可以把多个项目合成一
43、个项目组。这样可以允许你 在项目管理器中一次打开多个项目。项目组让你组织和工作在相关的项目,例如一起运 行或者部分多层应用程序的应用。如果你只工作在一个项目中,你不必需要一个项目组 来创建一个应用程序。描述单个项目,文件和相关的选择的项目文件有一个外延的拨号脉冲接收机。项目文件包括建一个应用程序的的导向或者可以共享的对象。当你使用对象管理器来增加和移动文件时,项目文件被矫正了。你可以使用项目选项对话框来详细说明项目选项,项 目选项对话框有你的项目的各方面的制表符,例如窗体,应用程序,编译器。这些项目 选项被保存在和项目一起的项目文件中。单位和窗体是应用程序的最基本的建设结构。一个项目可以分享任
44、何现有的窗体和单位文件包括项目目录树外的那些。这包括已经被作为标准规范中的海关程序和职责。如果你要加一个分享文件到项目中,必须认识到文件没有在当前项目目录中被复 制,仍然在当前的位置中。增加分享文件到当前的项目中要在项目文件的使用条款中注 册文件名和路径。当你加单元到项目中时 Delphi会自动处理这个问题。当你编译项目时,构成项目的文件放在哪里都时无所谓的。编译器会追踪和项目本 身产生的那些一样的文件。编辑代码代码编辑器是一个ASCII编辑器。如果使用可视化程序环境,窗体会自动作为新项 目的部分来展示。你可以通过把项目放在窗体开始设计你的应用界面并且在对象检测器 修改他们的工作。但是其他的设
45、计任务必须由键入代码来完成,例如为项目写事件的处 理人。窗体的内容,所有的属性,它的组成和它们的属性可以作为代码编辑器的文本被可 视和编辑。你可以调整代码编辑器中的产生代码并且通过键入代码把更多的成分加入到 编辑器中。当你把代码键入编辑器中时,编译器可以不断地扫描变化和更新新设计的窗体。然 后你可以回到窗体中,观察和测试你在编辑器中所作的改变,并连续调整窗体。代码产 生器和属性流动系统完全对检查公开。包含在你最后的执行文件中的所有文件的源代码 可以在代码编辑器观察和编辑一一 VCL对象,CLX对象,RTL源,和项目文件。编辑应用当你已经完成了在窗体中的应用界面的设计和写辅助码,你想要的等等,你
46、可以编 译IDE的项目或者命令行的项目。所有的项目作为对象都由一个单一分配可执行文件。你也可以通过编译,建造或者 启动它来观察或者测试在各运行的阶段的应用文件。当你编译的时候,从最后的编译已经改变的单一单元被再编译。当你建造的时候,项目中所有的单元都被编译了,无论他们是否在最后的编译中被改变。当你在不确定文件改或没改的精确性,或者当你只想确保所有的文件是通用的和同步的时候,这项技术是十分有用的。当你已经改变了全球的编 译指示来确保恰当的状态下所有的代码编译器,它也对构建是十分重要的。当你运行的时候,你编译然后执行你的应用程序。如果你自从最后的编译救修改了源代码,编译器会重新编译那些已经改变的模
47、块和重新连接你的应用程 序。如果你已经把几个项目组在一起,你就可以立刻编译或者构建所有的项目在一个项目组 中。选择在项目管理器选择的项目组中的项目编译或者项目构建。Note为了在Linux编译一个CLX应用程序,你需要 Kylix.。调试应用软件用综合调试,你可以在你的应用软件中找到错误并修改。综合调试器让你控制程序 执行,监视数据结构中的可变值和条款,并在调试过程中修改数值。综合调试器可以追踪运行时间错误和逻辑错误。通过运行专业程序位置和观察可变 值,命令行的函数,和程序输出,你可以检测你的程序是怎么样运行的和找出设计中没 被运行的区域。调试器在在线帮助中被描述。你也可以使用例额外命令处理认
48、识,定位,和处理错误。额外命令是分等级的,像 Delphi中的其他等级,除了,通过协定,他们开始用E开头而不是用T开头。配置应用软件Delphi包括增加工具来帮助应用配置。例如,InstallShield Express (不是所有的版 本都可用)帮助你为你的应用软件(包括所有驱动一个分布应用软件的所有文件)创造一 个安装包。TeamSource software (不是所有的版本都可用)也对跟踪应用软件更新材料 利用。为了在Linux配置一个CLX应用软件,你需要Kylix。Note不是所有的版本都有配置功能。Delphi是一个目标导向,可视化编程环境,来扩展 32位的,使用Delhi,你可
49、以用 最少量的手工译码创建高效的应用。Delphi提供了一系列的RAD的设计工具,包括程序压缩和应用和形成模板,并用 层次比较高的图书馆来支持目标导向程序。VCL ,可以把WindowsAPL和其他有用的编程工具压缩CLX,可以把Qt library压缩。本片文章简要地描述了 Delphi运行环境和它是怎样适合发展的周期循环。其余提供 了一般目的,数据库,因特网和互连网应用,创造 ActiveX and COM控制的技术详细资 料,并写下你自己的见解。完整的发展环境当你使用Delphi的时候,你应该立即投入到完整的发展环境,也叫作 IDE,IDE可 以提供给你在设计、发展、测试、调试、配置应用
50、中所需要的所有工具,并提供了快速 的原型和更短的发展时间。IDE包括了开始设计应用的所必须的工具,例如:架构设计,或者形成一个可以在上面设计用户界面的空白窗口。组成画板,展示可视和非可视部分,你可以使用它们来设计你的用户界面。目标检测,检查和改变目标的属性和事件。目标树型图,显示和改变组件的逻辑关系。代码编辑器,编写和编辑基本程序逻辑。项目管理器,管理组成一个或多个项目的文件。综合调试器,找出和修改编码中的错误。许多其他工具,如;属性编辑器改变目标属性值。命令行工具,包括编译器,目标代码连接器,和其他用途。大量的类库包括许多可再度利用的对象。类库中提供的许多对象可以从IDE中的组成画板获得。通
51、过协定,类库中对象的名字以T开头,例如TStatusBar,以Q字母开头的对象的名字是基于 Qt库的,并被用于交叉平台的应用。一些工具不可能在产品的所有版本中包括。发展环境的更完整的看法在快速启动中提出包括产物。还有,在线帮助系统可以提 供所有的菜单,对话框,和窗口的帮助。设计应用你可以设计任何种的32位应用程序一一从普通目的的用途到精密的数据获得程序 或者分布应用。当你设计为了你应用的用户界面,架构设计器产生隐藏的Delph编码来支持应用 当你选择和修改组成和架构的属性,改变的结果可以在源代码中自动出现,反之依然。 你可以直接使用任何文本编辑器来修改源文件,包括内置代码编辑器。你做的任何改变
52、 可以立即在可视环境中反映。使用Delphi语言,你可以创造你自己的架构。大部分的架构可以写在Delphi中如果需要,你可以为你的使用增加组成画板和定制颜料。你也可以使用CLX组件,自己设计在Linux and Windows中都能运行的应用软件。 CLX包含一系列分类,如果在VCL中代替那些而被使用,可以允许你的程序在 Windows 和Linux转换。15章中提到“发展中的交叉平台”详细的介绍了交叉平台程序和在Windows和Windows环境中的区别。如果你在使用 Kylix而在运行交叉平台应用程序,Kylix也包括开发者的向导来把你带到Linux环境中。你也可以参考 Kylix产品提供的Kylix在线帮助。创建对象所有的应用软件发展包括项目。当你在Delphi中创建一个应用软件,你正在创建一 个项目。项目是组成项目的文件的收集。一些这样的设计文件在设计时间被创建。其他 的是在当你编译项目源代码时自动产生。你可以在项目管理工具叫做项目管理器中来观看项目的内容。项目管理器分类列 表,单元名称,单元中包含的窗体(如果是一个),并且显示项目中文件的路径。虽然你可以直接编辑许多这些文件,但是使用可视化工具会更简单和更可靠。项目等级的顶部是一组文件。你可以把多个项目合成一个
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 工程劳务分工合同
- 展览展厅租赁服务合同书
- 培训学校服务合同
- 实习协议没到期劳动合同
- 汽车合同变更协议
- 汽车城物业服务协议合同
- 户内穿线协议合同
- 厨房出租合同协议书模板
- 合同终止签收协议
- 会计人员聘用合同协议书
- 康复评定-常用康复评定项目课件
- 半导体物理与器件(第4版)尼曼课后答案【半导体物理与器件】【尼曼】课后小结与重要术语解
- 北师大版三年级数学下册 (什么是面积)面积教学课件
- 建筑工程材料测试题及参考答案
- 医院检查报告单模板
- 《洗红领巾》(教学设计)-一年级下册劳动浙教版
- 有偿借用乡村道路协议书
- 酶免疫技术(免疫学检验课件)
- 教育经济与管理院校排名
- 基本农田划定技术规程(TDT1032-2011)
- 围术期支气管痉挛
评论
0/150
提交评论