Difference between revisions of "Lazarus Tutorial/zh CN"

From Lazarus wiki
Jump to navigationJump to search
 
(74 intermediate revisions by 9 users not shown)
Line 1: Line 1:
 
{{Lazarus Tutorial}}
 
{{Lazarus Tutorial}}
  
''这是Lazarus教程的起点。你可以自由地把自己的体会添加到这里。'
+
''这是Lazarus教程的起点。你可以自由地把自己的体会添加到这里。''
 
== 概述 ==
 
== 概述 ==
 
Lazarus是一个自由并且开源的RAD(快速应用开发)开发工具,它基于同样自由开源的FreePascal(object pascal)编译器。Lazarus IDE([http://lazarus-ccr.sourceforge.net/kbdata/lazide.jpg screenshot])可以创建独立的(原文是self-standing,我不确认是否准确)的图形或控制台程序,同时稳定并且富于特色.目前可以运行在Linux, FreeBSD和Win32平台下,同时提供可自定义的源代码编辑器,包含包管理器的可视化GUI设计环境,以及完整地集成在GUI环境中的调试器和FreePascal编译器。
 
Lazarus是一个自由并且开源的RAD(快速应用开发)开发工具,它基于同样自由开源的FreePascal(object pascal)编译器。Lazarus IDE([http://lazarus-ccr.sourceforge.net/kbdata/lazide.jpg screenshot])可以创建独立的(原文是self-standing,我不确认是否准确)的图形或控制台程序,同时稳定并且富于特色.目前可以运行在Linux, FreeBSD和Win32平台下,同时提供可自定义的源代码编辑器,包含包管理器的可视化GUI设计环境,以及完整地集成在GUI环境中的调试器和FreePascal编译器。
Line 9: Line 9:
 
(感谢[[User:Kirkpatc]])
 
(感谢[[User:Kirkpatc]])
  
首先,安装([[Installing Lazarus]])然后运行Lazarus,当然还要确定你有可以使用的FreePascal编译器。
+
首先,[[Installing Lazarus/zh_CN|安装Lazarus]],然后运行Lazarus,当然还要确定你有可以使用的FreePascal编译器。
  
 
桌面上将出现很多窗口:顶部是主菜单,左面是对象观察器,Lazarus源代码编辑器将占据大部分的桌面,而一个预置的Form1窗体将覆盖在源代码编辑器的上面。
 
桌面上将出现很多窗口:顶部是主菜单,左面是对象观察器,Lazarus源代码编辑器将占据大部分的桌面,而一个预置的Form1窗体将覆盖在源代码编辑器的上面。
  
首先,如果你的Lazarus是全英文的,那么你可以通过主菜单上的Environment -> Environment Options打开环境设置窗口,在Desktop标签下有Language选项,改成Chinese (zh_CN),确定后重新启动下Lazarus,大部分界面就是中文的了。
+
首先,如果你的Lazarus是全英文的,那么你可以通过主菜单上的Environment -> Environment Options打开环境设置窗口,在Desktop标签下有Language选项,改成Chinese (zh_CN),确定后重新启动下Lazarus,绝大部分界面就是中文的了。
  
 
注:对于linux用户,Lazarus的默认编译/安装很大可能是使用GTK1库(非常容易辩认...因为非常丑...),GTK1对于Unicode的支持不完善,无法显示中文,你可以使用GTK2重新编译Lazarus,具体方法请参照[[Quick start: Recompile the IDE]]。
 
注:对于linux用户,Lazarus的默认编译/安装很大可能是使用GTK1库(非常容易辩认...因为非常丑...),GTK1对于Unicode的支持不完善,无法显示中文,你可以使用GTK2重新编译Lazarus,具体方法请参照[[Quick start: Recompile the IDE]]。
Line 23: Line 23:
 
   procedure TForm1.Button1Click(Sender: TObject);
 
   procedure TForm1.Button1Click(Sender: TObject);
 
   begin
 
   begin
     {你的光标将位于这里,请输入后面的代码:}   Button1.caption := 'Press again';
+
     {你的光标将位于这里,请输入后面的代码:}
 +
    Button1.caption := 'Press again';
 
     {源代码编辑器已经自动完成了这个过程的其他部分}
 
     {源代码编辑器已经自动完成了这个过程的其他部分}
 
   end;
 
   end;
Line 33: Line 34:
 
   procedure TForm1.Button2Click(Sender: TObject);
 
   procedure TForm1.Button2Click(Sender: TObject);
 
   begin
 
   begin
  {输入:}   Close;
+
    {输入:}
 +
    Close;
 
   end;
 
   end;
  
 
再次按下F12选中Form1窗体。现在可以尝试编译这个程序了。最简单的方法是在顶部主菜单中选择"运行",在弹出的子菜单中选择"运行"(你也可以使用快捷键F9)。如果一切顺利,你的程序将被编译执行。
 
再次按下F12选中Form1窗体。现在可以尝试编译这个程序了。最简单的方法是在顶部主菜单中选择"运行",在弹出的子菜单中选择"运行"(你也可以使用快捷键F9)。如果一切顺利,你的程序将被编译执行。
  
所有的编辑信息都会出现在底部的"消息"窗口中。最终,一个没有刻度标记(编辑状态下才会出现)的Form1窗口将出现在屏幕上。这是你的应用程序的主窗口,它正等着你去按按钮(以及其他操作)。
+
所有的编译信息都会出现在底部的"消息"窗口中。最终,一个没有刻度标记(编辑状态下才会出现)的Form1窗口将出现在屏幕上。这是你的应用程序的主窗口,它正等着你去按按钮(以及其他操作)。
  
 
尝试下点击Press按钮,你会发现按钮的标签变成了"Press again"。之后你再怎么按,它依然显示"Press again"。
 
尝试下点击Press按钮,你会发现按钮的标签变成了"Press again"。之后你再怎么按,它依然显示"Press again"。
Line 76: Line 78:
 
如果你准备编写控制或者基于文本的Pascal程序(例如你正在使用一份基本的Pascal指南,准备编写在控制台环境下运行的程序,以及为系统底层编程等等),你依然可以使用Lazarus编写,编译并且运行你的程序。Lazarus是一个理想的Pascal开发环境。具体请参照[[Console Mode Pascal]].
 
如果你准备编写控制或者基于文本的Pascal程序(例如你正在使用一份基本的Pascal指南,准备编写在控制台环境下运行的程序,以及为系统底层编程等等),你依然可以使用Lazarus编写,编译并且运行你的程序。Lazarus是一个理想的Pascal开发环境。具体请参照[[Console Mode Pascal]].
  
== Lazarus编辑器 ==
+
===第三步 常用调试方法===
 +
新人学习不少需要调试的内容
 +
 
 +
所以需要一些直接有效的打印出调试内容.
 +
 
 +
比如像VB 下的 Debug.print 可直接在立即窗口中打印出调试内容
 +
 
 +
其实可以使用
 +
 
 +
  WriteLn('XXXX ', XXX);
 +
 
 +
  Write('XXXXXX'); 
 +
 
 +
但是在网上发现不少新人使用会弹出: '''project project1 raised exception class 'EInOutError' with message:file not open'''
 +
 
 +
异常通知
 +
 
 +
只需要在文件头部加入预编译指令
 +
 
 +
  {$APPTYPE CONSOLE}
 +
 
 +
这样调试时会弹出一个类dos对话框,输出调试的内容
 +
 
 +
 
 +
===第四步 常用技巧===
 +
lazaurs的编辑器蛮强大的,支持代码补全,自动完成,模板编辑,多行缩进注释,选定代码后批量更改里面的单词!
 +
 
 +
1.代码补全
 +
 
 +
按下键盘的Ctrl+W键!输入变量后按下这个键就OK啦~
 +
 
 +
2.自动完成
 +
 
 +
自动完成的快捷键大多数都冲突了,解决方法是打开 工具(T)->选项...->编辑器->键盘映射->CodeTools命令->标识符自动完成 上右键 编辑 ,然后根据实际情况修改吧,我的是再勾选Alt,也就是说,我的热键是Ctrl+Alt+Space!不懂的看图
 +
 
 +
3.模板编辑
 +
 
 +
这个也蛮简单,按下键盘的Ctrl+J,然后输入class,回车!是不是很酷!
 +
 
 +
4.多行缩进注释
 +
 
 +
缩进的:向左 -> Ctrl+U
 +
 
 +
向右 -> Ctrl+I(选中多行代码更爽)
 +
 
 +
多行注释:Ctrl+/
 +
 
 +
5.选定代码后批量更改里面的单词
 +
先选中一行代码,然后点击编辑器左边显示行号左边的那支笔,看看图哦。
 +
 
 +
这个时候你可以输入b,变量a就全部改为b,还可以按下tab跳到下一个单词。
 +
 
 +
6.编辑器的高亮
 +
 
 +
<?xml version="1.0"?>
 +
<CONFIG>
 +
  <EditorOptions Version="9">
 +
    <Display DoNotWarnForFont="Ubuntu Mono" EditorFont="Ubuntu Mono" EditorFontSize="13">
 +
      <MarkupCurrentWord NoKeyword="False"/>
 +
    </Display>
 +
    <KeyMapping>
 +
      <default Count="1">
 +
        <Version Value="6"/>
 +
        <Item1 Name="Identifier completion">
 +
          <KeyA Default="False" Key1="32" Shift1="5"/>
 +
        </Item1>
 +
      </default>
 +
    </KeyMapping>
 +
    <CodeTools CodeTemplateFileName="/home/lht/.lazarus/lazarus.dci" CompletionLongLineHintTypeCompletionLongLineHintType="sclpExtendRightOnly" AutoDelayInMSec="104"/>
 +
    <Mouse>
 +
      <Default Version="1"/>
 +
    </Mouse>
 +
    <Color Version="9">
 +
      <LangObjectPascal Version="9">
 +
        <ColorScheme Value="Twilight"/>
 +
        <SchemeTwilight>
 +
          <Space Background="1973790" FrameColor="5000268" FrameStyle="slsDotted" FrameEdges="sfeBottom"/>
 +
          <Number Foreground="7434751"/>
 +
          <String Foreground="7337839"/>
 +
          <Symbol Foreground="clYellow"/>
 +
          <Comment Foreground="clSkyBlue" Style="fsItalic"/>
 +
          <Assembler Foreground="11715098"/>
 +
          <Directive Foreground="22015"/>
 +
          <Case_label Foreground="16541892"/>
 +
          <IDE_Directive Foreground="1478752"/>
 +
          <Reserved_word Foreground="1023473"/>
 +
        </SchemeTwilight>
 +
      </LangObjectPascal>
 +
      <Globals Version="9">
 +
        <SchemeTwilight>
 +
          <ahaDefault Background="1973790"/>
 +
        </SchemeTwilight>
 +
      </Globals>
 +
      <LangPython Version="9">
 +
        <SchemeTwilight>
 +
          <Float Foreground="8345087"/>
 +
          <Octal Foreground="16755455"/>
 +
          <Number Foreground="8345087"/>
 +
          <String Foreground="8388522"/>
 +
          <Symbol Foreground="clYellow"/>
 +
          <Comment Foreground="clSkyBlue"/>
 +
          <Hexadecimal Foreground="8345087"/>
 +
          <SyntaxError Foreground="16755285"/>
 +
          <Documentation Foreground="16755370"/>
 +
          <Reserved_word Foreground="43775"/>
 +
          <Non_reserved_keyword Foreground="8366847"/>
 +
        </SchemeTwilight>
 +
      </LangPython>
 +
    </Color>
 +
    <Misc PasExtendedKeywordsMode="True"/>
 +
    <General>
 +
      <Editor TabIndent="True" TabWidth="2"/>
 +
    </General>
 +
    <DividerDraw>
 +
      <LangObjectPascal>
 +
        <TypeSect>
 +
          <TopColor Value="9157119"/>
 +
        </TypeSect>
 +
        <TypeGVar>
 +
          <TopColor Value="9157119"/>
 +
        </TypeGVar>
 +
        <TypeGStruct>
 +
          <TopColor Value="9157119"/>
 +
        </TypeGStruct>
 +
        <TypeProc>
 +
          <TopColor Value="9157119"/>
 +
        </TypeProc>
 +
        <TypeLStruct>
 +
          <MaxDepth Value="1"/>
 +
          <TopColor Value="9157119"/>
 +
        </TypeLStruct>
 +
      </LangObjectPascal>
 +
    </DividerDraw>
 +
  </EditorOptions>
 +
</CONFIG>
 +
 
 +
== IDE窗口 ==
 
当你第一次运行Lazarus时,一系列独立的浮动窗口将出现在你的桌面上。
 
当你第一次运行Lazarus时,一系列独立的浮动窗口将出现在你的桌面上。
  
首先,在桌面顶部有一个窗口,标题是'''Lazarus 编辑器 vxxxx - project'''(这会随着你当前打开的工程名字而改变)。这是你工程的主要控制窗口,包括主菜单和组件面板。
+
首先,在桌面顶部有一个窗口,标题是'''Lazarus vxxxx - project'''。这是你工程的主要控制窗口,包括主菜单和组件面板。
  
<center>[[image:Screenshot-Lazarus_编辑器_v0.9.24_测试版_-_project1.png]]</center>
+
<center>[[image:Lazarus IDE 2.0.0- project1.png]]</center>
  
 
标题栏下面是包括"文件""编辑""查找"等常见项目(以及Lazarus特有的一些项目)的主菜单。
 
标题栏下面是包括"文件""编辑""查找"等常见项目(以及Lazarus特有的一些项目)的主菜单。
Line 87: Line 225:
 
主菜单下面,组件面板的左侧是一组按钮,包括了主菜单中的常用项目,例如新建文件,保存等等。
 
主菜单下面,组件面板的左侧是一组按钮,包括了主菜单中的常用项目,例如新建文件,保存等等。
  
在这个窗口下面,左边是'''对象观察器'''
+
在这个窗口下面,左边是'''对象查看器'''
  
<center>[[image:Screenshot-对象观察器.png]]</center>
+
<center>[[image:对象查看器.png]]</center>
  
 
右边是'''源代码编辑器'''
 
右边是'''源代码编辑器'''
  
<center>[[image:Screenshot-Lazarus_源代码编辑器2.png]]</center>
+
<center>[[image:源代码编辑器.png]]</center>
  
 
也许会有一个小窗口覆盖在源代码编辑器上,是Lazarus预置的一个Form1窗体
 
也许会有一个小窗口覆盖在源代码编辑器上,是Lazarus预置的一个Form1窗体
  
<center>[[image:Screenshot-Form1.png]]</center>
+
<center>[[image:Form1.png]]</center>
  
 
如果你没有看见它,可以按下F12在源代码编辑器和窗体预览间来回切换。
 
如果你没有看见它,可以按下F12在源代码编辑器和窗体预览间来回切换。
Line 107: Line 245:
 
在你工作的时候,其他一些窗口也会出现:
 
在你工作的时候,其他一些窗口也会出现:
  
包含你工程的一些细节,并且允许你从工程中添加或删除文件的'''工程浏览'''窗口
+
包含你工程的一些细节,并且允许你从工程中添加或删除文件的'''工程查看器'''窗口
  
<center>[[image:Screenshot-工程浏览_-_project1.png]]</center>
+
<center>[[image:工程查看器.png]]</center>
  
以及显示编译信息,错误以及运行报告的'''消息'''窗口
+
以及显示编译信息,错误以及运行报告的'''信息'''窗口
  
<center>[[image:Screenshot-消息.png]]</center>
+
<center>[[image:信息.png]]</center>
  
 
如果你从一个终端窗口中运行Lazarus,那么这个原始的终端窗口将被保留,编译信息也会显示在这个终端窗口中。
 
如果你从一个终端窗口中运行Lazarus,那么这个原始的终端窗口将被保留,编译信息也会显示在这个终端窗口中。
  
=== 主菜单 ===
+
== 主菜单 ==
 +
主菜单内容仔细的说明在这里:[[Main menu/zh CN]]
 +
 
 +
== IDE选项 ==
 +
 
 +
在Lazarus 1.0.14版中,通过"工具"->"选项",可以打开IDE设置窗口。
 +
在这里你可以对环境、编译器、JCF格式设置、代码工具、代码管理器、调试器、帮助等信息配置。
 +
 
 +
[[File:IDE选项.png|right]]
 +
 
 +
* '''环境'''
 +
** '''文件''':最大记录工程数、文件数及设置Lazarus目录、编译器路径、FPC源代码目录、Make文件目录等等。
 +
** '''桌面''':设置IDE语言、自动保存信息等等。
 +
** '''窗口''':可对窗口位置、终端输出进行相应设置。
 +
** '''窗体编辑器''':对颜色、风格等设置。
 +
** '''对象查看器''':对颜色、速度等设置。
 +
** '''备份''':工程文件备份设置,其他文件备份设置。
 +
** '''命名''':对Pascal后缀、可疑文件动作、自动重命名Pascal文件为小写、单元被重命名,更新引用等等配置。
 +
** '''FPDoc编辑器''':配置FPDoc。
 +
** '''文件筛选''':对单元、工程、窗体、包、其他文件设置筛选器。
 +
 
 +
* '''编辑器'''
 +
** '''普通''':允许设置撤销/重做次数、滚动方式、缩进与制表符、光标等设置。
 +
** '''显示''':设置边界和边缝及默认编辑器字体。
 +
** '''键盘映射''':快捷键设置。
 +
** '''鼠标''':对鼠标操作进行相应设置。
 +
** '''自动化功能''':对自动补充信息进行设置。
 +
** '''代码折叠''':对代码折叠相关进行配置。
 +
** '''隔离区绘制''':代码块间线条设置。
 +
** '''页和Windows''':暂无。
 +
 
 +
* '''JCF格式设置'''
 +
** '''文件格式''':暂无。
 +
** '''obfuscate''':暂无。
 +
** '''clarify''':暂无。
 +
** '''preprocessor''':暂无。
 +
 
 +
* '''代码工具'''
 +
** '''普通''':方法跳转、工程附加源文件路径等设置、pascal源文件缩进设置。
 +
** '''类完成''':类、方法部分插入方式及属性自动完成配置。
 +
** '''创建代码''':插入过程策略、新单元添加到uses部分等配置。
 +
** '''单词''':设置关键字策略、标识符规则及例外等。
 +
** '''分割行''':可设置最大行宽、不拆分前面、后面行的条件。
 +
** '''空格''':空格插入方式,在关键字、标识符等前或后插入空格。
 +
** '''标识符自动完成''':设置标识符自动完成条件,如添加分号时。
 +
 
 +
* '''代码管理器'''
 +
** '''更新''':设置优先表现模式(分类、源代码),自动刷新条件及跟随光标。
 +
** '''种类''':设置只在类模式中使用变量、常量、引入、定义等。
 +
** '''代码观察器''':对代码观察器进行一些配置。
 +
 
 +
* '''调试器'''
 +
** '''普通''':可设置调试器类型和路径调试器特殊选项等。
 +
** '''事件日志''':对消息窗口进行设置,如错误时显示的颜色等。
 +
** '''语言异常''':设置忽略哪些异常,如 中止、代码工具错误、Fopen错误。并允许添加忽略。
 +
** '''操作系统异常''':设置操作系统异常处理方式。
 +
 
 +
* '''帮助'''
 +
** '''帮助选项''':设置FPC HTML文件路径、默认查看器等。
 +
** '''外部''':对外部程序进行配置,如Windows、PostgreSQL、Gtk2配置名称、单元文件及位置。并允许添加外部程序。
 +
 
 +
== 按钮栏 ==
 +
 
 +
<div class="floatright"> [[Image:按钮.png]] </div>
 +
 
 +
在主编辑器窗口左侧小工具栏位置,(主菜单下方与左侧组件面板中),包含一组按钮:
 +
 
 +
“新建单元”、“新建窗体”、“打开”、“保存”、“保存所有”、“新窗体”、“切换窗体/单元”、
 +
 
 +
“查看单元”、“查看窗体”、“运行”、“暂停”、“步进”、“下一步”、“运行,直到函数返回”。
 +
 
 +
== 组件面板 ==
 +
 
 +
标签式工具栏里显示常用组件图标。
 +
 
 +
每个选项卡使用一组不同的图标显示,选项卡组最左边的第一个图片(指向箭头),称为选择工具。
 +
 
 +
如果你将鼠标悬停在组件面板中的图标上,将会显示该组件的提示信息。T意味着,Type类型,或者是Class组件。在窗体中,使用组件时,类将会添加到类型和接口处(通常作为TForm1一部分)。实例化处,添加到VAR部分(通常作为Form1变量)。任何方法,设计时要使用窗体或组件(程序或函数),将被放置在implementation部分。如果你要找出某一特定组件的属性,可以看组件的继承,之后检查其派生的基类型的属性。例如,你要了解TMaskEdit,可以查看TcustomMaskEdit。
 +
 +
'''选项卡'''(通过名称可以了解的其包含了哪些组件):
 +
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=StdCtrls 标准组件]'''
 +
<center>[[Image:standard.png]]</center>
 +
:''通常使用的组件:'' [http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tmainmenu.html TMainMenu], [http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tpopupmenu.html TPopupMenu], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tbutton.html TButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlabel.html TLabel], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tedit.html TEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tmemo.html TMemo], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/ttogglebox.html TToggleBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcheckbox.html TCheckBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tradiobutton.html TRadioButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlistbox.html TListBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcombobox.html TComboBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tscrollbar.html TScrollBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tgroupbox.html TGroupBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tstatictext.html TStaticText], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tradiogroup.html TRadioGroup], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tcheckgroup.html TCheckGroup], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpanel.html TPanel], [http://lazarus-ccr.sourceforge.net/docs/lcl/actnlist/tactionlist.html TActionList]
 +
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls 更多组件]'''
 +
<center>[[Image:additional.png]]</center>
 +
:''更多经常使用的组件:'' [http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tbitbtn.html TBitBtn], [http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tspeedbutton.html TSpeedButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/timage.html TImage], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tshape.html TShape], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tbevel.html TBevel], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpaintbox.html TPaintBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tnotebook.html TNotebook], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tlabelededit.html TLabeledEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tsplitter.html TSplitter], [http://lazarus-ccr.sourceforge.net/docs/lcl/maskedit/tmaskedit.html TMaskEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/checklst/tchecklistbox.html TCheckListBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tscrollbox.html TScrollBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tapplicationproperties.html TApplicationProperties], [http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tstringgrid.html TStringGrid], [http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tdrawgrid.html TDrawGrid], [http://lazarus-ccr.sourceforge.net/docs/lcl/pairsplitter/tpairsplitter.html TPairSplitter]
 +
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=ComCtrls 公共组件]'''
 +
<center>[[Image:commoncontrols.png]]</center>
 +
: TTrackBar, TProgressBar, TTreeView, TListView, TStatusBar, TToolBar, TUpDown, TPageControl, TImageList
 +
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogsTxt 对话框组件]'''
 +
<center>[[Image:dialogs.png]]</center>
 +
: TOpenDialog, TSaveDialog, TSelectDirectoryDialog, TColorDialog, TFontDialog, TOpenPictureDialog, TSavePictureDialog, TCalendarDialog, TCalculatorDialog
 +
 
 +
有几个有用的'''[http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogExamples 对话框]''',它不在组件面板中显示,但在你可在过程函数中直接调用。
 +
 
 +
有关组件使用的例子,请参看$LazarusPath/lazarus/examples目录。许多程序不使用IDE组件而直接使用对话框或其他组件的调色板,或者有一个单独的窗体定义文件:所有组件中,在Pascal主程序部分定义使用。
 +
 
 +
 
 +
一些示例,不马上使用的:你可能需要调整路径和文件(目录)的执行权限。如果你想直接编译示例,请确保对文件(目录)具有读取/写入/执行权限。
 +
 
 +
请尝试运行'''testall程序''',以查看可用组件和示例菜单,大多数的测试,可以确定你的环境是否能够正常使用这些组件!
 +
 
 +
* '''杂项组件'''
 +
<center>[[Image:misc.png]]</center>
 +
: [http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogsTxt TColorButton], TSpinEdit, TArrow, TCalendar, TEditButton, TFileNameEdit, TDirectoryEdit, TDateEdit, TCalcEdit, TFileListBox
 +
* '''数据组件'''
 +
<center>[[Image:datacontrols.png]]</center>
 +
: ''数据组件,通常用于数据库:'' TDBNavigation, TDBText, TDBEdit, TDBMemo, TDBImage, TDBListBox,TDBComboBox, TDBCheckBox, TDBRadioGroup, TDBCalendar, TDBGroupBox, TdbGrid
 +
* '''数据访问组件'''
 +
<center>[[Image:dataaccess.png]]</center>
 +
: TDatasource
 +
* '''系统组件'''
 +
<center>[[Image:system.png]]</center>
 +
: [http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls#TTimer TTimer], TIdleTimer, [[doc:fcl/process/tprocess.html|TProcess]]
 +
* '''SynEdit(<strike>编辑器组件</strike>)'''
 +
<center>[[Image:synedit.png]]</center>
 +
 
 +
: ''SynEdit是一个高级的文本编辑器控制,对Borland的Delphi,Kylix、C++Builder等支持语法高亮和代码自动完成,并支持输出为HTML、Tex和RTF。这是一个VCL/CLX控件,意味着,适用于Microsoft的Windows,没有信赖的运行库,SynEdit作为跨平台组件,也是Lazarus IDE中的编辑器组件。'' 查看 [http://synedit.sourceforge.net sourceforge上的synedit]. TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynMultiSyn
 +
 
 +
要使用调色板,必须存在窗体(如果没有,选择文件->新建窗体)。单击调色板中需要使用的控件,在窗体上单击,这时候,窗体上,将显示出来调色板组件;你可以调整它到合适的位置,通过属性可以显示外观。
 +
 
 +
如果你想安装额外的组件,无论是你自己编写的,还是第三方的;完成后,将在组件面板中显示出来。
 +
 
 +
== 如何使用通用控件 ==
 +
'''StdCtrls'''、'''ComCtrls'''和'''ExtCtrls'''包含了常用控件的构建形式及Lazarus应用程序中常用对象。
 +
 
 +
许多控件应用程序开发人员都要使用,如'''TButton'''、'''TMemo'''、'''TScrollBar'''等等。声明的控件都<b>继承</b>自父类。
  
主菜单包括如下内容:
+
使用这些控件时,你可以选择相应控件,在窗体上拖放就可以了。也可以使用代码创建,但是,在你不需要时,你需要销毁它。
<u>F</u>ile(文件)  <u>E</u>dit(编辑)  <u>S</u>earch(查找)  <u>V</u>iew(查看)  <u>P</u>roject(项目)  <u>R</u>un(运行)  <u>C</u>omponents(构件)  <u>T</u>ools(工具)  E<u>n</u>vironment(环境)  <u>W</u>indows(窗口)  <u>H</u>elp(帮助)
 
  
通常情况下,你可以通过鼠标左键来点击相应的菜单功能,也可以通过热键Alt+相应热键字母(如果焦点不在菜单上,你可以使用Alt键和方向键选择菜单)
+
==== 设置属性 ====
 +
在窗体设计器上放置控件后,在对象检查器中,你可以设置控件属性或编写相应事件代码。
  
==== 文件子菜单====
+
如,你在窗体上放置了一个按钮(TButton),选择它,并移动它以改变位置,你会可以看到它的top和left值的变化。在对象观察器中Height、Width值分别代表其大小高度和宽度。
<div class="floatright"> [[Image:FileMenu.png]] </div>
 
* '''新建单元''': 创建一个新的单元文件(Pascal 源代码).
 
* '''新建窗体''': 创建一个新的窗体:  提供可视化窗口以及Pascal源代码.
 
* '''新建 ...''': 弹出一个对话框,([http://lazarus-ccr.sourceforge.net/kbdata/menu-new.jpg screenshot]) 可以选择各种类型的文档进行创建。
 
* '''打开''': 弹出一个对话框,可以浏览文件,并选择文件打开。
 
* '''重新打开''': 放弃你对打开文件所进行的编辑,恢复到该文件的初始状态。
 
* '''打开最近的文件''': 列出你最近编辑的文件, 让你从中选择一个。
 
* '''保存''': 保存当前文件, 使用其当前文件名,如果该文件未命名, 系统将提示你取一个(类似于另存为)。
 
* '''另存为''': Allows you to choose a directory and filename for saving the current file.
 
* '''Save All''': Saves all the files attached to the editor, not just the current one selected.
 
* '''Close''': 关闭当前文件, prompting whether to save all editor changes.
 
* '''Close all editor files''': 关闭当前文件编辑器中所有的文件.  Prompt for saving changes.
 
* '''Clean directory''': Offers a dialog with a series of editable filters for removing files from the current directory.  Useful for removing .bak files and remnants of former Delphi projects.
 
* '''Print''': Uses the system printer to print the selected file. This menu item does not appear by default; you need to install $Lazdir/components/printers/design/printers4lazide.pas and re-compile the IDE
 
* '''Restart''': Re-start Lazarus - useful if files have got hopelessly scrambled!
 
* '''Quit''': Exit Lazarus, after prompting for saving all edited files.
 
<div style="clear:both;"></div>
 
  
==== 编辑子菜单 ====
+
此外,你可以使用代码来改变对象属性:
<div class="floatright"> [[Image:EditMenu.png]] </div>
 
* '''Undo''': Undo the last edit action, leaving the Editor in the state just before the last action.
 
* '''Redo''': Re-instates the last action that was reversed by Undo.
 
* '''Cut''': Remove the selected text or other item and place it on the Clipboard.
 
* '''Copy''': Make a copy of the selected text, leaving the original in place, and placing the copy on the Clipboard.
 
* '''Paste''': Places the contents of the Clipboard at the cursor position. If text has been selected at the cursor position, the contents of the Clipboard will replace the selected text.
 
* '''Indent selection''': Move the selected text to the right by the amount specified in Environment -> Editor options -> General -> Block indent.  This feature is useful for formatting your Pascal source code to show the underlying Block structure.
 
* '''Unindent selection''': Removes one level of indenting, moving the text to the left by the amount specified in Block indent.
 
* '''Enclose selection''': Provides a pop-up menu with a number of options for logically enclosing the selected text (begin ... end; try ... except; try ... finally; repeat ... until; { ... } etc).
 
* '''Uppercase selection''': Convert selected text to uppercase.
 
* '''Lowercase selection''': Convert selected text to lowercase.
 
* '''Tabs to spaces in selection''': Converts any tabs in the selected text to the number of spaces specified by Environment -> Editor options -> General -> Tab widths.  The number of spaces is not a fixed quantity, but is the number needed to fill the remaining width of the tab.
 
* '''Break lines in selection''': If any lines in the selected text are longer than 80 characters or the number specified in Environment -> Editor options -> Display -> Right Margin, then the line is broken at a word boundary and continued on the next line.
 
* '''Comment selection''': Makes the selected text into comments  by inserting // on each line.
 
* '''Uncomment selection''': Removes comment marks.
 
* '''Sort selection''': Sort lines (or words or paragraphs) alphabetically;  options for ascending or descending order, case sensitive or insensitive.  In the middle of program source code, of course, it makes no sense, but if you have a list you need to have sorted this will do the trick.
 
* '''Select''': Allows selection of blocks of text.  Options include select all, select to brace, select paragraph or line etc.
 
* '''Insert from character map''': Allows insertion of non-keyboard symbols such as accented characters, picked from a pop-up character map.
 
* '''Insert text''': Displays pop-up menu to allow insertion of standard text such as CVS keywords (Author, Date, Header etc) or GPL notice, username or Current date and time.
 
* '''Complete code''': Completes the code at the cursor. It is context sensitive and saves you a lot of time. For example: it completes classes, by adding private variables, Get and Set property access methods and adding method bodies. On variable assignments (e.g. i:=3;) it adds the variable declarations. On forward defined procedures it adds the procedure bodies. On event assignments (OnClick:=) it adds the method definition and the method body. See [[Lazarus IDE Tools]].
 
* '''Extract procedure''': Uses the selected text (a statement or series of statements) to build a new procedure.
 
<div style="clear:both;"></div>
 
  
==== The Search sub-menu ====
+
<code>Form1.Button1.Height := 48;</code>
<div class="floatright"> [[Image:SearchMenu.png]] </div>
 
* '''Find''': Similar to the facility in almost all graphic text editors:  a pop-up dialog box appears allowing entry of a search text string, with options such as case sensitivity, whole words, origin, scope and direction of search.
 
* '''Find Next, Find previous''': Search again for the previously entered text string, in the specified direction.
 
* '''Find in files''': Search for text string in files:  pop-up dialog with options all open files, all files in project, or all directories;  masks available for selecting file types.
 
* '''Replace''': Similar to '''Find''';  shows pop-up dialog with place to enter search text string and replacement text, and options for case sensitivity, direction etc.
 
* '''Incremental find''': Search for the string while you are entering the search string. Example: after you choose "Incremental Find" if you press "l" the first "l" will be highlighted. If then you press "a", the editor will find the next "la" and so on.
 
* '''Goto line''': Move editing cursor to specified line in file.
 
* '''Jump back''': Jump to previous position. Everytime jumping to an error or find declaration the IDE saves the current source position. With this function you can jump back in the history.
 
* '''Jump forward''': Jump to next position. Undoes a Jump back.
 
* '''Add jump point to history''': Add the current source position to the jump hsitory.
 
* '''View Jump-History''': Look at list of jump points: '''Not implemented yet'''.
 
* '''Jump to next error''', '''Jump to previous error''': Jump to the positions in the source file of the next or previous reported error.
 
* '''Set a free bookmark''': mark the current line where the cursor is located with the next available (free) numbered bookmark, and add this to the list of bookmarks. Note that a pop-up menu (obtained by right-clicking with the mouse on the appropriate line of the source file) gives a larger range of Bookmark options, allowing the number of a bookmark to be specified, or allowing the user to jump to a numbered bookmark, not just the next or previous ones.
 
* '''Jump to next bookmark''', '''Jump to previous bookmark''': Jump to next or previous bookmark in the numerical sequence.
 
* '''Find other end of code block''': If positioned on a '''begin''', finds the corresponding '''end''' or vice versa.
 
* '''Find code block start''': Moves to the '''begin''' of the procedure or function in which the cursor is placed.
 
* '''Find Declaration at cursor''': Finds the place at which the selected identifier is declared.  This may be in the same file or another file already open in the Editor;  if the file is not open, it will be opened (so if a procedure or function is declared, for example, in <u>classesh.inc </u>, this will be opened in the Editor).
 
* '''Open filename at cursor''': Opens the file whose name is selected at the cursor.  Useful for looking at <u>Include </u> files or the files containing other <u>Units </u> used in the project.
 
* '''Goto include directive''': If the cursor is positioned in a file which is <u>Included</u> in another file, goes to the place in the other file that called the <u>Include</u> file.
 
'''<div style="clear:both;"></div>
 
* '''Find Identifier References''': Produces a list of all the lines in the current file, or the current project or all attached files, in which an identifier is mentioned.
 
* '''Rename Identifier''': Allows developer to rename an identifier. A pop-up menu asks the developer to specify whether renaming is to occur in the current file only, or throughout the project, or in all open or attached files etc. You can even rename the identifier if it occurs in comments. You would use this feature, for example, if the compiler told you that an identifier already existed, so you need a new name for your own identifier.
 
* '''Procedure List''': Produces a list of all Procedures and Functions in the current file, with the line numbers where they are defined.
 
  
==== The View sub-menu ====
+
在FormCreate过程中书写上面的代码,程序运行时,将看到效果。
<div class="floatright"> [[Image:ViewMenu.png]] </div>
 
Controls the display of various windows and panels on the screen.
 
* '''Object Inspector''': The window that usually occupies the left side of the Desktop, and displays the features of the Form which is on the desktop.  Clicking with the mouse on any component of the form will cause the details of that component to be displayed in the Object Inspector.  There is a panel at the top which shows the tree-structure of the current project, and the components of the form may optionally be selected in this panel:  this will also cause the corresponding details to be displayed in the Object Inspector.  The main lower panel has two tabs which allow selection of either '''Properties''' or '''Events''' to be displayed.  Selection of '''Properties''' causes features such as name, color, caption, font, size etc to be displayed:  there are two columns, the left showing the property, and the right showing the value associated with that property. Selection of '''Events''' displays two columns:  the left lists the possible events such as MouseClick or KeyDown associated with that component, and the right shows the action that results from that event.  If there is no action defined, then clicking in the appropriate box or on the <div class="box">...</div> button causes the Source Editor to be displayed, with the cursor already positioned in a dummy Procedure declaration, waiting for event-defining code to be typed in.
 
* '''Source Editor''': The main window in which source code is edited.  Its behaviour is very like that of most other graphical text editors, so that the mouse can move the cursor over the displayed text, and clicking with the left mouse button while dragging the mouse will select and highlight text.  Right clicking with the mouse displays a pop-up menu, it includes the usual Edit Cut, Copy or Paste functions, ''Find Declaration'' and ''Open File at Cursor''.  The top of the Source Editor window has a number of tabs, corresponding to the files that are open for the current project;  clicking on any tab makes that file visible, and you can move easily from file to file, copying and pasting between files and performing most of the normal editing functions.  The Source Editor performs color syntax highlighting on the code, with different colors for punctuation marks, comments, string constants etc.  It will also maintain the level of indentation from line to line as you type in code, until you change the indentation.  The function and appearance of the Source Editor are very configurable from the Main Menu by selecting Environment -> Editor options and then selecting one of several tabs in the pop-up dialog box.
 
* '''Code Explorer''': A window usually placed on the right of the Desktop which displays, in tree form, the structure of the code in the current unit or program.  It usually opens with just the Unit name and branches for Interface and Implementation sections, but clicking on the <div class="box">+</div> box to the left of any branch will open up its sub-branches or twigs, in more and more detail until individual constants, types and variables are displayed as well as procedure and function declarations.  If you change the file displayed in the main Source Editor window, you need to click on the Refresh button of the Code Explorer to display the structure of the new file.
 
* '''Units...''': Opens a pop-up dialog window with a list of the unit files in the current project.Clicking with the mouse on a filename selects that file; click on Open to display that file in the Source Editor.  Checking the Multi box allows several files to be selected simultaneously, and they will all be opened in the Source Editor (but only one at a time will be displayed).  This Menu Option is rather like the Project -> Project Inspector option, but only displays the list of Unit files and allows them to be opened.
 
* '''Forms...''': Opens a pop-up dialog window with a list of the Forms in the current project, and allows the selection of one or more of them for display.
 
* '''View Unit Dependencies''': Opens a pop-up dialog window that shows, in a tree-like manner, the structure of dependencies of the currently open unit file. Most of the files listed as dependencies will have their own <div class="box">+</div> boxes, which allow the dependencies of the individual files to be explored, often in a highly recursive manner.
 
* '''Toggle form / unit view  F12''': Toggles whether the Source Editor or the current Form is placed on the top layer of the Desktop, and given focus.  If the Source Editor has focus, then you can edit the source code;  if the Form is given focus, you can manipulate the components on the desktop and edit the appearance of the Form.  The easiest way to toggle the display between Editor and Form is to use the F12 key on the keyboard, but the same effect is achieved by selecting this option on the Main Menu.
 
* '''Messages''': A window that displays compiler messages, showing the progress of a successful compilation or listing the errors found.
 
* '''Search Results''': A window that displays the results of find in files.
 
* '''Debug windows''': Opens a pop-up menu with several options for operating and configuring the Debugger.  See below where the [[#The_Debugger|debugger]] is described.
 
<div style="clear:both;"></div>
 
  
==== The Project sub-menu ====
+
总之,有三种方法,可以设置对象的属性:
<div class="floatright"> [[Image:ProjectMenu.png]] </div>
 
* '''New Project''': Create a new project.  A pop-up dialog window appears offering a choice of types of project to create.
 
* '''New Project from file''': A Navigation dialog window appears, alowing selection of a file from which to create a new project.
 
* '''Open Project''' Open a project which has already been created and saved.  A navigation dialog appears with a list of Lazarus Project Information (.lpi) files from which a project may be chosen.
 
* '''Open Recent Project''': Displays a pop-up list of recent projects on which you have been working, and allows selection of one of these.
 
* '''Save Project''': Similar to File -> Save:  all the files of the current project are saved;  if they have not previously been saved, there is a prompt for filename(s)-  similar to Save Project As...
 
* '''Save Project As...''': Prompts for filename to save project.  A default filename of Project1.lpi is offered, but you should choose your own filename.  Lazarus will not permit you to use the same name for the Project file and the Unit File (see [[Lazarus Tutorial#The_Lazarus_files| below]]).
 
* '''Publish Project''': Creates a copy of the whole project. If you want to send someone just the sources and compiler settings of your code, this function is your friend. A normal project directory contains a lot of information. Most of it is not needed to be published: the .lpi file contains session information (like caret position and bookmarks of closed units) and the project directory contains a lot of .ppu, .o files and the executable. To create a lpi file with only the base information and only the sources, along with all sub directories use "Publish Project". In the dialog you can setup the exclude and include filter, and with the command after you can compress the output into one archive. See [[Lazarus IDE Tools]]
 
* '''Project Inspector''': Opens a pop-up dialog with a tree-like display of the files in the current project.  Allows you to add, remove or open selected files, or change options of the project.
 
* '''Project Options...''': Opens a pop-up dialog window with tabs for setting options for Application (Title, Output Target file name), Forms (allowing you to select among the available forms, make them Auto-create at start of application) and Info (specifying whether editor information should be saved for closed files, or only for project files).
 
* '''Compiler options ...''': (Recently moved here from the Run Menu). Opens a multi-page tabbed window which allows configuration of the compiler.  Tabs include '''Paths''' which allows definition of search paths for units, include files, libraries etc, as well as allowing choice of widget type for the forms (gtk, gnome, win32); '''Parsing''' which allows choice of rules for parsing source programs, '''Code''' which allows choice of optimisation for faster or smaller programs, choice of target processor, types of checks, heap size etc; '''Linking''' allowing choice of whether or how to use debugging, static or dynamic libraries, and whether to pass options through to the linker; '''Messages''' to define what type of messages should be generated during error conditions; '''Other''' which allows decision to use default configuration file (fpc.cfg) or some other file; '''Inherited''' which shows a tree structure diagram to indicate how options have been inherited from units already incorporated; '''Compilation''' which allows definition of commands to be executed before or after the compiler is launched and can allow use of Make files.
 
* '''Add editor file to Project''': Add the file currently being edited to the Project
 
* '''Remove from Project''': Gives a pop-up menu of files available for removal from project.
 
* '''View Source''': No matter which file you are editing, takes you back to the main program file (.lpr)or the main .pas file if there is no .lpr.
 
* '''View ToDo List''':Opens a dialog box with a list of ToDo items associated with this project. This will list any ToDo comments in your project (lines commencing //TODO), and any others in the Lazarus units you have used. You need to Refresh the ToDo items in the dialog (using arrow symbol button of toolbar) before new 'ToDos' appear. The first column of the ToDo list contains numbers you have allocated to your ToDo comments; a simple //TODO comment will appear as a zero, but a comment of //TODO999 (for example) will place the number 999 in the first column. Remember there should be no spaces on the line before //TODO and ToDo comments added after the last save will not be shown!
 
  
==== The Run sub-menu ====
+
<ul>
<div class="floatright"> [[Image:RunMenu.png]] </div>
+
  <li>通过鼠标在窗体上调整</li>
* '''Build''': Causes Lazarus to build (ie compile) any files in the project that have been changed since the last build.
+
  <li>通过设置对象观察器中的值</li>
* '''Build all''': Builds all files in the project, whether or not there have been any changes.
+
  <li>通过代码来设置属性</li>
* '''Abort build''': Stop the build process once it is running - either you have remembered that you did something silly and want to stop the build, or the system seems to be taking far too long and something is obviously wrong.
+
</ul>
  
* '''Run''': This is the usual way to  launch the compiler and, if compilation is successful, to start execution of the application.  What actually happens is that Lazarus saves a copy of your files, then starts the compiler and linker, then begins execution of the final linked binary program.
+
==== 公共属性 ====
* '''Pause''': Suspend execution of the currently running program.  This may allow you to inspect any output that has been generated; execution may be resumed by selecting '''Run''' again.
 
* '''Step into''': Used in conjunction with the debugger, causes execution of the program    one step at a time up to a bookmarked point in the source.
 
* '''Step over''': Causes stepwise execution up to the statement marked, then skips the marked statement, and continues execution at normal speed. Useful in trying to isolate a statement that introduces a logical error.
 
* '''Run to cursor''': Causes execution at normal speed (ie NOT one statement at a time) until the statement is reached where the cursor is located;  then stops.  Resume execution at normal speed by selecting '''Run'''.
 
* '''Stop''': Cease execution of the running program.  Cannot be resumed by selecting '''Run''';  this will start the program again from the beginning (re-compiling if necessary).
 
  
* '''Run Parameters''': Opens a multi-page pop-up window which allows command-line options and parameters to be passed to the program to be executed;  allows selection of display to run program (eg a remote X terminal may be used in Linux);  some system Environment variables may be overridden.
+
每个组件(控件)都有不同的属性,有某些是相同的,常见的,下面这介绍这些常用属性:
: One very important use of this sub-menu is to activate a terminal window in which conventional Pascal console input/output is displayed.  If you are developing a console-mode Pascal program (ie one that doesn't use the Graphical User Interface with its forms, buttons and boxes) then you should check the box for "Use launching application". The first time you do this and try the Compile/Run sequence, you will probably get a rude message to say
 
"xterm: Can't execvp /usr/share/lazarus//tools/runwait.sh: Permission denied". 
 
: If this happens, you need to change the permissions on the appropriate file (for example using chmod +x ''filename'', or using the Windows utility for changing permissions); you might have to do this as root. After this, each time you launch you program, a console box will appear and all your text i/o (readln, writeln etc) will appear in it.
 
: After your program has finished execution, a message "Press enter" appears on the screen.  Thus any output your program generated will remain on the screen until you have had a chance to read it;  after you press 'enter' the console window closes.
 
: '''Note:''' as for the current version, there is no prepared console command for Windows users. Until the Lazarus team adressess that, the following line should work (on WinXP -- someone please update for other Windowses)
 
C:\Windows\system32\cmd.exe /C ${TargetCmdLine}
 
: See the separate tutorial on [[Console Mode Pascal]] programming.
 
* '''Reset debugger''': Restores the debugger to its original state, so that breakpoints and values of variables etc are forgotten.
 
  
* '''Build file''': Compile (build) just the file that is currently open in the Editor.
+
通过选择属性或关键字,在对象观察器或源代码编辑器中按{{keypress|F1}}来获得帮助。
* '''Run file''': Compile, link and execute just the currently open file.
 
* '''Configure Build + Run File''': Opens a multi-page tabbed window with options to allow for build of just this file when '''Build Project''' is selected, allows selection of the working directory, the use of various Macros, etc.  Then Builds and Runs the file.
 
:These last three options enable you to open (and maintain) a test project. Use File -> Open to open an .lpr file, pressing cancel on the next dialog to open this file as "normal source" file.
 
  
<div style="clear:both;"></div>
+
如果该页面上的属性描述不够,您可以通过选择继承列表中的链接或在对象声明中选择祖先类型来导航到相应的祖先类别描述。
  
==== The Components sub-menu ====
+
<table>
* '''Open Package''': Displays a [http://lazarus-ccr.sourceforge.net/kbdata/OpenPackageSnapshot.png list of installed packages], with an invitation to [http://lazarus-ccr.sourceforge.net/kbdata/PackageContentsSnapshot.png open one or more of them], or to select various general or compiler options.
+
  <caption><b>常用属性</b></caption>
* '''Open Package File''': Open one of the files in the selected package.
+
  <tr><td><b>属性</b></td><td><b>说明</b></td><td><b>介绍</b></td></tr>
* '''Open Recent Package''': Open a package that was opened recently.
+
  <tr>
* '''Add Active Unit to Package''': Place the unit file (currently in the editor) into a package.
+
    <td>Action</td>
* '''Package Graph''': Displays a [http://lazarus-ccr.sourceforge.net/kbdata/PackageGraphSnapshot.png graph] showing the relationships of the packages currently being used (if you aren't using any other packages, the Lazarus package and the FCL and LCL will be displayed).
+
    <td>行动</td>
* '''Configure custom components''': If you have created some components, allows you to configure them.
+
    <td>与对象关联的主要动作或事件。如,在选择“退出”时,会导致“关闭”。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Align</td>
 +
    <td>对齐</td>
 +
    <td>定义与父对象对齐方式。alTop:顶对齐;alBottom:底对齐;alLeft、alRight:左对齐和右对齐;alNone:无;alClient:占用父对象所有空间。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Anchor</td>
 +
    <td>锚</td>
 +
    <td>用于保持控件的父控件;当父控件调试大小将调整与其距离。<b>[akBottom,akRight]</b>将保持固定在父控制右下角距离。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>AutoSelect</td>
 +
    <td>自动选择</td>
 +
    <td>为True时,控件在获取到焦点,或当按下{{keypress|Enter}}键时选择所有文本。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>AutoSelected</td>
 +
    <td>自动选中</td>
 +
    <td>True表示编辑框或组合框控件刚刚执行了“自动选择”操作,因此随后的鼠标点击和按键操作将正常进行而不会选中文本。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>BorderSpacing</td>
 +
    <td>边框间距</td>
 +
    <td>'''锚定'''控件与其父级之间的边缘空间。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Caption</td>
 +
    <td>标题</td>
 +
    <td>设置显示内容,如按钮标题为“关闭”或“执行”。默认情况下,标题名称与Name属性值相同。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>CharCase</td>
 +
    <td>字符显示</td>
 +
    <td>设置字母在编辑控件中显示方式:Normal:正常(不改变字母大小写);ecLowerCase:转换为小写;ecUppercase:转换为大写。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Constraints</td>
 +
    <td>限制</td>
 +
    <td>设置控件最大、小、高、宽度。如果调整控件大小,新的大小将在此范围内。You should take care when setting these options that they do not conflict with the Anchors and Align settings.</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Color</td>
 +
    <td>颜色</td>
 +
    <td>设置控件的文本颜色。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Enabled</td>
 +
    <td>启用</td>
 +
    <td>设置控制是否可用,如果为False,在窗体上<b>显示为灰色</b>。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Font</td>
 +
    <td>字体</td>
 +
    <td>设置对象的字体信息,通常(+)号展开详细,如字体、字号、颜色等。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Hint</td>
 +
    <td>提示</td>
 +
    <td>鼠标悬停在控件上时,弹出的提示信息。请注意ShowHint属性为True时才显示。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Items</td>
 +
    <td>项目</td>
 +
    <td>包含的数据信息,如果文本行等。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Lines</td>
 +
    <td>列表</td>
 +
    <td>字符串数组,包含单个数据,数组为索引从0开始,即[0..numLines-1]。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Name</td>
 +
    <td>名称</td>
 +
    <td>设置控件的标识符。如TBitButton的实例,为Form1.BitBitton1、Form1.BitButton2等等,程序员应该使用见名真义的名称,如ExitButton(退出按钮)或OKButton(确定按钮)。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>PopUpMenu</td>
 +
    <td>弹出式菜单</td>
 +
    <td>设置在控件上右击时,弹出的菜单。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Position (or Top, Left)</td>
 +
    <td>位置</td>
 +
    <td>设置控件位置。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>ReadOnly</td>
 +
    <td>只读</td>
 +
    <td>为True时,控件只能被读取,不能被更改。如Edit。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>ShowHint</td>
 +
    <td>显示提示</td>
 +
    <td>设置鼠标'悬停'在控件上时,是否显示提示信息。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Size (or Height and Width)</td>
 +
    <td>大小</td>
 +
    <td>设置控件尺寸。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Style</td>
 +
    <td>样式</td>
 +
    <td>样式的选项取决于所考虑的控件类型:例如,样式可以由TFormStyle、TBorderStyle、TButtonStyle等定义。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>TabOrder</td>
 +
    <td>Tab键顺序</td>
 +
    <td>输入整数,设置{{keypress|Tab}}的顺序。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>TabStop</td>
 +
    <td>制表位</td>
 +
    <td>为False时,{{keypress|Tab}}将无法选中此控件,否则可以。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Text</td>
 +
    <td>文本</td>
 +
    <td>字符串文本,表示该控件包含的数据。适用于Text、Memo、StringList类型。Most of the editing operations (such as '''Select''', '''Clear''', '''Cut''', '''Copy''') are performed in this part of the object, which holds the actual string being edited. If the control contains more than a single line of text, for example '''TMemo''' or '''TComboBox''', then the textual elements are arranged as an array of strings (zero-indexed, ie numbered from [0..numLines-1]) in '''Lines'''.</td>
 +
  </tr>
 +
  <tr>
 +
    <td>Visible</td>
 +
    <td>可见</td>
 +
    <td>为True,在窗体中可以看到此控件,否则将隐藏。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>WordWrap</td>
 +
    <td>自动换行</td>
 +
    <td>为True时,文本内容将自动换行。</td>
 +
  </tr>
 +
</table>
  
==== The Tools sub-menu ====
+
==== 事件动作 ====
<div class="floatright"> [[Image:ToolsMenu.png]] </div>
 
* '''Configure custom tools''': Allows the user to add various external tools (usually macros) to the toolkit
 
* '''Quick syntax check''': Perform a quick check of the syntax in your source file without actually compiling anything.  Essential step in developing long or complicated programs, where you don't want to waste time compiling if the code is wrong.
 
* '''Guess unclosed block''': useful utility if you have a complex nested block structure and you have left out an 'end' somewhere
 
* '''guess misplaced IFDEF/ENDIF''': useful if there is a complex or nested macro structure and you think you have left out an ENDIF directive
 
* '''Make resource string''': Makes the selected string a resource string by placing it in the resourcestrings section. An advantage of resource strongs is you can change them without the need to recompile your project!
 
* '''Diff''': Allows comparison between two files (or, usually, two versions of the same file) to find differences.  Options to ignore white space at beginning or end of lines or differences in line termination:  CR+LF versus LF).  Useful for checking if there have been changes since last CVS update etc.
 
* '''Check LFM file in editor''': Allows inspection of the LFM file which contains the settings that describe the current form
 
* '''Convert Delphi unit to Lazarus unit''': Helps in porting Delphi applications to Lazarus;  makes the necessary changes to the source file.  See [[Lazarus For Delphi Users]] and [[Code Conversion Guide]].
 
* '''Convert DFM file to LFM''': For porting from Delphi to Lazarus:  converts the Form Description files from Delphi to Lazarus.  See [[Lazarus For Delphi Users]] and [[Code Conversion Guide]].
 
* '''Build Lazarus''': Launches a re-build of Lazarus from the most recently downloaded or updated SVN files.  Hit the button and sit back to watch it happen! (track the process on your '''Messages''' window).
 
* '''Configure "Build Lazarus"''': Allows the user to determine which parts of Lazarus should be re-built, and how.  For example, you could select to have just the LCL re-built, or to have everything except the examples built;  you can select which LCL interface to use (ie which set of widgets), and you can select the target operating system and specify a different target directory.
 
<div style="clear:both;"></div>
 
  
==== The Environment sub-menu ====
+
许多行动通常列在“对象观察器”中的“事件”选项卡里。在列表中选择相应事件,在下拉列表中将会显示你已经定义的方法,并允许你对其关联。点击旁边的"..."按钮,将跳到源代码编辑器里,你在那里可以编写相应程序。
<div class="floatright"> [[Image:EnvironmentMenu.png]] </div>
 
* '''Environment options''': Displays a multi-page window with tabs for
 
** '''Files''' - allowing the user to specify path to default directory, compiler, source directory and temporary directory for compilation;
 
** '''Desktop''' - options for Language, Auto save behaviour, saving desktop properties, hints for component palette and speed buttons;
 
** '''Windows''', to allow specification of size and behaviour of the various windows;
 
** '''Form Editor''' - choose colours for editing forms;
 
** '''Object Inspector''' - choose colour and height of items;
 
** '''Backup''' - specify how to backup files when editing;
 
** '''Naming''' - specify pascal文件使用哪种扩展名('.pp' or '.pas'), whether to save files with names in lowercase, whether to perform auto-delete or auto-rename.
 
* '''Editor options''': Multi-page window, with tabs for
 
** '''General''' - determines behaviour like auto-indent, bracket highlighting, drag-drop editing, scrolling, syntax highlighting, showing hints, size of block indent and tabs, limit of Undo;
 
** '''Display''' - options for showing line numbers, presence of gutters, size and type of font for editor, and contains a preview panel showing the colours of the various syntax features such as comments, directives, punctuation, errors and breakpoints; 
 
** '''Key Mappings''' - options to select Lazarus or Turbo Pascal scheme;
 
** '''Color''' - allows choice of colour scheme for text features, for a number of language types such as Object Pascal, C++, Perl, HTML, XML and shell scripts. It shows preview panel again (for whichever language is selected);
 
** '''Code Tools''' - allows selection of features like Identifier Completion, tooltips, specification of template file names, specific templates for code completion.
 
* '''Debugger Options''': Multi-page window with tabs for
 
** '''General''' - choose debugger: none, GNU debugger (gdb) or gdb through SSH, specify search paths for debuggers,and specific options for chosen debugger;
 
** '''Event log''' - specify whether to clear log on run, and which messages to display;
 
** '''Language Exceptions''' - select which exceptions can be ignored;
 
** '''OS Exceptions''' - allows user to add certain signals which apply to current operating system (not implemented).
 
* '''Code Tool Options''': Multi-page window, tabs for 
 
** '''General''' - Allows entry of additional source search paths, specify Jumping Method;
 
** '''Code Creation''' - determines whether created code is added before or after certain features;
 
** '''Words''' - determines whether Pascal keywords are to be entered in upper or lower case, or as Capitalised Words;
 
** '''Line Splitting''' - establish rules about where lines are allowed to be split (before or after punctuation, after keywords etc);
 
** '''Space''' - decide whether a space is to be added automatically before or after certain syntactic features such as keywords or punctuation marks.
 
* '''Code Tools Defines Editor''': Here you can see all IDE internal definitions to parse sources. You will see all the defines, unit, source, include paths for all source directories. Beginning with the settings of the current FPC, the defines for the Lazarus Source directory, all package directories and project directories.
 
Most of these settings are auto generated and read only.
 
  
 +
“事件“选项卡中,显示了当前控件支持的事件,像OnClick事件:鼠标点击事件;OnEntry:当获得焦点时;OnExit:当失去焦点时;或者你可以编写:OnChange:内容改变时;或OnScroll:在滚动条上操作时等等,根据你的需要来选择使用哪些事件进行哪些操作。
  
* '''Re-scan FPC Source directory''' Looks through the directory again. Lazarus uses the fpc sources to generate correct event handlers and while looking for declarations. If somebody changes the directory in the environment options, then this directory is rescanned, to make sure lazarus uses the version stored in that location. But if this directory has changed without lazarus noticing, then you may get some errors when designing forms or doing "Find declaration". If you get such an error, you can do two things:
+
在窗体设计器上右击控件 ,“创建默认的事件“也有相同的效果,通常是OnClick(点击)事件。之后在源代码编辑器里编写相应操作。
*# Check the fpc source directory setting in the environment option.
 
*# Re-scan FPC source directory.
 
  
==== The Windows sub-menu ====
+
在面向对象程序设计中,使用 TActionList 组件是为了集中处理许多常用的操作,把用户界面和应用逻辑分开,减少程序的代码行数,方便程序的维护和调试。它用于维护一系列动作列表,以供其他组件或控制所使用,如菜单和按钮。
<div class="floatright"> [[Image:WindowsMenu.png]] </div>
 
Contains a list of the currently opened files and the available windows such as '''Source Editor''', '''Object Inspector''' and '''Project Inspector'''.  Clicking on the name of one of the windows brings it to the foreground and gives it focus.
 
<div style="clear:both;"></div>
 
  
==== 帮助子菜单 ====
+
<br/>
 +
<table>
 +
  <caption><b>常用事件</b></caption>
 +
  <tr>
 +
    <td><b>事件</b></td>
 +
    <td><b>说明</b></td>
 +
    <td><b>介绍</b></td>
 +
  <tr>
 +
    <td>OnChange</td>
 +
    <td>改变事件</td>
 +
    <td>当检测到任何更改(如鼠标移动、点击、按键、编辑文字、更改图片等)都将触发此事件。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnClick</td>
 +
    <td>点击事件</td>
 +
    <td>鼠标点击时触发此事件(点击,指的是鼠标左键点击),点击事件大多是控件默认的事件,如点击一个按钮、单选框或复选框。</td>
 +
  </tr>
 +
  <tr>单击方法
 +
    <td>Click</td>
 +
    <td>单击方法</td>
 +
    <td>单击方法,在代码中模拟点击控件。一个程序可以调用相同代码的OnClick事件,通过点击激活其他事件。这个方法可以在程序启动时使用,而不是用户点击后再进行某些操作。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnDragDrop</td>
 +
    <td>拖放事件</td>
 +
    <td>拖放操作之前,即当鼠标选中某些信息(如文本)要移动到新位置时。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnEditingDone</td>
 +
    <td>编辑完成事件</td>
 +
    <td>当用户完成编辑/修改时,通常用来验证输入内容,如检测输入的文本是不是有效的IP地址。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnEntry</td>
 +
    <td>获得焦点事件</td>
 +
    <td>当控件获取到焦点时,触发此事件。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnExit</td>
 +
    <td>移出事件</td>
 +
    <td>当鼠标移出控件区域时触发此事件。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnKeyPress</td>
 +
    <td>按键事件</td>
 +
    <td>按键事件,当按下某键时,将触发此事件。不同于OnKeyDown:当按下但不松开某键时触发此事件。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnKeyDown</td>
 +
    <td>按下键不松事件</td>
 +
    <td>如果一个键被按下,但不松开,将触发此事件。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnKeyUp</td>
 +
    <td>松开键事件</td>
 +
    <td>松开按键时触发此事件。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnMouseMove</td>
 +
    <td>鼠标移动事件</td>
 +
    <td>当鼠标在控件上移动时触发此事件。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnMouseDown</td>
 +
    <td>鼠标按下事件</td>
 +
    <td>鼠标按下但不松开时触发此事件。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnMouseUp</td>
 +
    <td>鼠标松开事件</td>
 +
    <td>鼠标按下并松开时触发此事件。</td>
 +
  </tr>
 +
  <tr>
 +
    <td>OnResize</td>
 +
    <td>改变大小事件</td>
 +
    <td>调整控件大小时触发此事件。</td>
 +
  </tr>
 +
</table>
  
At present this has three selections:
+
==== 构造和析构函数 ====
* '''Online Help''' which at present opens a browser window that contains a picture of the running cheetah and a few links to the Lazarus, FreePascal  and WiKi websites
 
* '''Reporting a bug''' opens the [[How_do_I_create_a_bug_report|wiki page]], which describe the bug reporting procedure
 
* '''Configure Help''' which opens a pop-up menu with options to select viewers and databases from which to read Help information.  This option allows the user to specify either the on-line documents section of the Lazarus-CCR website, some other website containing the documents, or a local store for the documentation (this would eventually become the default, when the Help system is fully developed).
 
At present by default, if you place your Editor cursor over any keyword from the FreePascal Components Library FCL, the RunTime Library RTL or the Lazarus Components Library LCL, and then press <<F1>> you will be taken by your default browser to the appropriate definition on the website. Be aware that your browser may be located on another desktop on your machine (eg in Linux), and you may not see the information immediately; of course if you are not connected to the internet you cannot get this information.  THIS SECTION STILL REPRESENTS WORK IN PROGRESS
 
  
* '''About Lazarus''' 显示一个弹出式窗口,里面有一些关于Lazarus的信息.
+
每个对象都有两个相关联的方法:
  
Eventually there will be a full on-line Help service, with information about Pascal syntax, the use of the IDE, how to use, modify or create Components, and hints on how to perform certain tasks.  This part of the Documentation section (the thing you are currently reading) represents the beginning of the process. '''We need contributions from anyone who feels able to provide them: the WiKi is very easy to edit.'''
+
* '''构造函数''':在创建时,即分配对象所需内存和资源时。
 +
* '''析构函数''':在删除时,即释放分配对象所需内存和资源时。
  
=== The Button bar ===
+
释放对象,你需要使用free方法,因为它会检测对象值是否为<b>nil</b>。如果你调用已经''销毁''的对象,它将产生一个错误。
A small toolbar area on the left of the main editor window, just below the Main Menu and to the left of the Component Palette, contains a set of buttons which replicate frequently-used Main Menu selections:
 
: '''New unit''',  '''Open''' (with a down-arrow to display a drop-down list of recently used files), '''Save''', '''Save all''', '''New Form''', '''Toggle Form/Unit''' (ie show either form or source code of Unit), '''View Units''', '''View Forms''', '''Run''' (ie compile and Run), '''Pause''', '''Step Into''', '''Step over''' (the last two are Debugger functions).
 
  
== The Component Palette ==
+
''销毁''时,注意以下:
A Tabbed toolbar which displays a large number of icons representing commonly used components for building Forms.
 
  
Each tab causes the display of a different set of icons, representing a functional group of components. The left-most icon in each tabbed group is an obliquely leftward-facing arrow, called the Selection Tool.
+
<ul>
 +
  <li>Declare '''Destroy''' with the <b>override</b> directive, because it is a <b>virtual</b> method.</li>
 +
  <li>Always call ''''inherited Destroy;'''' as the last thing on the destructor code.</li>
 +
  <li>Be aware that an '''exception''' may be raised on the '''constructor''' in case there is not enought memory to create an object, or something else goes wrong. If the '''exception''' is not handled inside the constructor, the object will be only partially built. In this case '''Destroy''' will be called when you weren't expecting it, so your destructor must check if the resources were really allocated before disposing of them.</li>
 +
  <li>Remember to call '''Free''' for all objects created on the constructor.</li>
 +
</ul>
  
If you allow the mouse cursor to hover over any of the icons on the Component Palette, without clicking on the icon, the title of that component will pop-up.  Note that each title begins with a 'T' - this signifies 'Type' or more accurately 'Class' of the component.  When you select a component for inclusion in a form, the Class is added to the '''type''' section of the '''interface''' part of the Unit (usually as part of the overall TForm1), and an '''instance''' of that class is added to the '''var''' section (usually as the variable Form1).  Any '''Methods''' that you design to be used by the Form or its Components (ie Procedures or Functions) will be placed in the '''implementation''' part of the Unit
+
== 为窗体创建菜单 ==
  
In the following list of the Components, you will find links to files that contain descriptions of the Units in which they are found.  If you want to find out about the properties of a particular component, it is often worth looking at the Inheritance of that component and then inspecting the properties of the base type from which it is derived.  For example, to understand TMaskEdit it is also useful to examine TCustomMaskEdit.
+
''TMainMenu''是大多都使用的;在窗体顶部会出现菜单栏,设计者可以定制不同的菜单项。''TPopupMenu''是一个与上下文相关的菜单。通常是在控件附近点击时弹出的。
+
 
'''TABS''' (the names are largely self-explanatory):
+
主菜单是非可视组件:也就是说,在组件面板中选择菜单图标,放置在窗体上,运行时不会被显示,你需要创建菜单项,像TPopupMenu菜单,你需要关联相应组件的PopupMenu属性。
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=StdCtrls Standard]'''
+
 
<center>[[Image:Component_Palette_Standart.png]]</center>
+
 
:''Frequently used components:'' [http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tmainmenu.html TMainMenu], [http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tpopupmenu.html TPopupMenu], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tbutton.html TButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlabel.html TLabel], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tedit.html TEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tmemo.html TMemo], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/ttogglebox.html TToggleBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcheckbox.html TCheckBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tradiobutton.html TRadioButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlistbox.html TListBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcombobox.html TComboBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tscrollbar.html TScrollBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tgroupbox.html TGroupBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tstatictext.html TStaticText], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tradiogroup.html TRadioGroup], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tcheckgroup.html TCheckGroup], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpanel.html TPanel], [http://lazarus-ccr.sourceforge.net/docs/lcl/actnlist/tactionlist.html TActionList]
+
若要使用菜单编辑器:右击窗体上的菜单控件,在弹出的菜单中选择''(Menu Editor)菜单编辑器'',在弹出的窗口中,对菜单进行设置。
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls Additional]'''
+
 
<center>[[Image:Component_Palette_Additional.png]]</center>
+
默认将显示一个NewItem1菜单项,右击它,弹出的菜单中,你可以继续在其上面或下面添加菜单,也可以子菜单。在对象观察器中,设置菜单项属性。
:''More, often-used components:'' [http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tbitbtn.html TBitBtn], [http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tspeedbutton.html TSpeedButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/timage.html TImage], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tshape.html TShape], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tbevel.html TBevel], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpaintbox.html TPaintBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tnotebook.html TNotebook], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tlabelededit.html TLabeledEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tsplitter.html TSplitter], [http://lazarus-ccr.sourceforge.net/docs/lcl/maskedit/tmaskedit.html TMaskEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/checklst/tchecklistbox.html TCheckListBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tscrollbox.html TScrollBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tapplicationproperties.html TApplicationProperties], [http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tstringgrid.html TStringGrid], [http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tdrawgrid.html TDrawGrid], [http://lazarus-ccr.sourceforge.net/docs/lcl/pairsplitter/tpairsplitter.html TPairSplitter]
+
 
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=ComCtrls Common Controls]'''
+
当然,你应该给菜单项起个有意义的名字,如File open(打开文件)、Close(关闭)等。 如果你想热键,即在菜单项后显示(&N),你只需要直接输入即可。当然,你也可以给菜单项关联快捷键,对象观察器中的ShortCut和ShortCutKey2属性,分别设置第1,2快捷键;如(复制,{{keypress|Ctrl}}+{{keypress|C}};粘贴,{{keypress|Ctrl}}+{{keypress|V}})。
<center>[[Image:Component_Palette_Common_Controls.png]]</center>
 
: TTrackBar, TProgressBar, TTreeView, TListView, TStatusBar, TToolBar, TUpDown, TPageControl, TImageList
 
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogsTxt Dialogs]'''
 
<center>[[Image:Component_Palette_Dialogs.png]]</center>
 
: TOpenDialog, TSaveDialog, TSelectDirectoryDialog, TColorDialog, TFontDialog, TOpenPictureDialog, TSavePictureDialog, TCalendarDialog, TCalculatorDialog
 
  
Several useful '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogExamples Dialog]''' procedures or functions don't appear on the Palette, but are easily used as direct calls from your source program.
+
另外,如需要在菜单项间插入一条分隔线,只需要设置菜单项的Caption属性为'''-'''即可。
  
For several good examples of the use of Components see the $LazarusPath/lazarus/examples subdirectory of your source installation.  Many of the programs show how to use dialogs and other components directly without using the IDE and component palette or having a separate form definition file:  all the components are fully and explicitly defined in the main Pascal program.  Other example programs make full use of the IDE.
 
  
Some examples don't work straight away: you may need to play about with paths and permissions of files or directories.  If you want to compile any of the examples, make sure that you have read/write/execute permissions for the files and directories, or copy the files to a directory where you do have the appropriate permissions.
+
你可以结合ActionList组件,对菜单各项的事件进行统一编写。
  
Try running the 'testall' program to see a menu of the available components together with small example test forms for most of them;  then inspect the code to find out how they work!
+
By default, a number of standard actions are pre-loaded from ''StdActns'' or, if DataAware controls are used, from ''DBActns''. These actions can be chosen using the ActionList editor which appears when you right-click on the ActionList icon on the Form Designer.
* '''Misc'''
 
<center>[[Image:Component_Palette_Misc.png]]</center>
 
: [http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogsTxt TColorButton], TSpinEdit, TArrow, TCalendar, TEditButton, TFileNameEdit, TDirectoryEdit, TDateEdit, TCalcEdit, TFileListBox
 
* '''Data Controls'''
 
<center>[[Image:Component_Palette_DataControls.png]]</center>
 
: ''Data-aware components, which largely replicate the Standard and Additional groups but are applicable to Databases:'' TDBNavigation, TDBText, TDBEdit, TDBMemo, TDBImage, TDBListBox,TDBComboBox, TDBCheckBox, TDBRadioGroup, TDBCalendar, TDBGroupBox, TdbGrid
 
* '''Data Access'''
 
<center>[[Image:Component_Palette_DataAccess.png]]</center>
 
: TDatasource
 
* '''[[System]]'''
 
<center>[[Image:Component_Palette_System.png]]</center>
 
: [http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls#TTimer TTimer], TIdleTimer, [[doc:fcl/process/tprocess.html|TProcess]]
 
* '''SynEdit'''
 
<center>[[Image:Component_Palette_SynEdit.png]]</center>
 
: ''A group of components to help interfacing with other languages and software tools. SynEdit is an advanced multi-line edit control, for Borland Delphi, Kylix  and C++Builder. It supports Syntax Highlighting and code completion, and includes exporters for html, tex and rtf. It is a full-VCL/CLX control, meaning it is not a wrapper for Microsoft Windows controls, and no run-time library is required; this make SynEdit a crossplatform component. Compatibility with FreePascal is also planned, and SynEdit is the edit component in Lazarus IDE.'' see [http://synedit.sourceforge.net synedit at sourceforge]. TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynMultiSyn
 
  
To use the Palette, there must be an open form on view in the editor (if there isn't one, select File -> New Form). Click on the icon in the appropriate tab of the Palette for the component you want to use, then click on the Form, near where you want the component to appear.  When the desired component appears, you can select it by clicking with the mouse, then move it to the exact place on the Form where you want it and adjust its size.  Adjustments can be made to the appearance either by altering the picture itself on the Form using the mouse, or by changing the relevant Property in the Object Editor for that component.
+
== 调试器 ==
 +
''待写''
  
If you install additional components, either those you have written yourself, or some coming as a package from some other source, then extra tabs with the relevant icons will appear in your Component Palette. These new components can be selected and used on your forms in the same way as those supplied by default.
+
更多 [[:category: IDE Window - Debug]]
  
== The Debugger ==
+
== Lazarus 文件 ==
: ''Still to be written''.
+
    (感谢 Kevin Whitefoot.)
 +
    (Giuseppe Ridinò, [[User:Kirkpatc]] 和 Tom Lisjac 添加)
  
see also [[:category: IDE Window - Debug]]
+
当你保存时,实际上会保存两个文件:
  
== The Lazarus files ==
+
  xxx.pas 和 yyy.lpr
    (Thanks to Kevin Whitefoot.)
 
    (Additions by Giuseppe Ridinò, [[User:Kirkpatc]] and Tom Lisjac)
 
When you save you will actually be saving two files:
 
  
  xxx.pas and yyy.lpr
+
不止这些,还有项目文件(lpr)、单元文件(pas),名称不能相同,否则Lazarus会覆盖掉原文件,在编辑器会因为无法找到指定文件而报错。
(You save more than that but those are the ones you get to name). The project file (lpr) and the unit file (pas) must not have the same name because Lazarus will helpfully rename the unit (inside the source code) to the same as the unit file name and the program to the name of the project file (it needs to do this or the compiler will probably not be able to find the unit later when referred to in the project file). Of course to be consistent it changes all the occurrences of unit1 to xxx.
 
  
So if you are saving a project called '''again''', trying to save again.pas and again.lpr fails because unit names and program names are in the same name space resulting in a duplicate name error.
+
所以,你需要保存为一个不重名的项目。
  
So here is what I ended up with:
+
这是我最终的文件列表:
  
 
e:/lazarus/kj/lazhello:
 
e:/lazarus/kj/lazhello:
Line 411: Line 709:
 
  -rwxrwxrwx  1 kjwh    root      335 Mar 24 11:07 ppas.bat
 
  -rwxrwxrwx  1 kjwh    root      335 Mar 24 11:07 ppas.bat
  
Note that there are many more files than the two that I thought I was saving.
+
Note that there are many more files than the two that I thought I was saving.(<strike>注意,好像是多了两个文件,我想是我存的吧。</strike>)
  
Here is a brief note about each file:
+
下面是对每个文件的简短介绍:
  
 
'''again.exe:'''
 
'''again.exe:'''
The main program binary executable. Win32 adds an "exe" extension. Linux has none. This file will be huge on Linux due to the inclusion of debugging symbols.  Run the "strip" utility to remove them and substantially shrink the executable size.
+
二进制可执行文件,Win32中添加exe扩展名。linux没有。此文件在Linux上很大的原因是,加入了调试标记。
 +
注意:在1.0.14版,可以勾选,“工程”->“工程选项”中的“编译选项”->“链接”:“从可执行程序中除去符号,可以减少程序体积(Strip Symbol)”;以减少程序体积。
  
 
'''again.lpi:'''
 
'''again.lpi:'''
This is the main file of a Lazarus project (Lazarus Project Information); the equivalent Delphi main file of an application will be the .dpr file. It is stored in an XML format.
+
它以XML格式存储,是Lazarus项目的主要文件(项目信息);Delphi应用程序文件是.dpr。
  
 
'''again.lpr:'''
 
'''again.lpr:'''
The main program source file. Despite its lazarus specific extension it is in fact a perfectly normal Pascal source file. It has a uses clause that lets the compiler find all the units it needs. Note that the program statement does not have to name the program the same as the file name.
+
这是主程序的源代码文件,尽管使用了特定的扩展名,但它仍是正常的Pascal源文件。它有use部分,可以让编译器找到所需的单元。注意,程序名可以和该名称相同。
  
 
'''againu.lfm:'''
 
'''againu.lfm:'''
This is where Lazarus stores the layout of the form unit. Lazarus uses this to generate a resource file that is included in the initialisation section of the againu.pas unit. Delphi dfm files can be converted to lfm format in the Lazarus IDE using the Tools->Convert DFM file to LFM utility.
+
存储了Lazarus窗体布局信息;也包含了初始化部分的资源文件。Delphi的DFM文件可以转换为LFM格式:“工具“->“转换DFM文件为LFM文件”。
  
 
'''againu.lrs:'''
 
'''againu.lrs:'''
This is the generated resource file. Note that it is not a Windows resource file.
+
生成的资源文件。需要注意的是它不是Windows的资源文件。
  
 
'''againu.pas:'''
 
'''againu.pas:'''
 
The unit that contains the code for the form.
 
The unit that contains the code for the form.
 +
包含窗体代码的单元文件。
  
 
'''againu.ppu:'''
 
'''againu.ppu:'''
This is the compiled unit.
+
编译的单元文件。
  
 
'''ppas.bat:'''
 
'''ppas.bat:'''
This is a simple script that links the program to produce the executable. If compilation is successfull, it is deleted by the compiler.
+
一个简单的脚本,链接程序生成可执行文件。如果编译完成,将由编译器删除。
 +
 
 +
== 原作者和变化 ==
  
== Original contributors and changes ==
+
这个页面来自 <strike>[http://lazarus-ccr.sourceforge.net/index.php?wiki=LazarusTutorial 这里]</strike>(失效)。
This page has been imported from the epikwiki [http://lazarus-ccr.sourceforge.net/index.php?wiki=LazarusTutorial version].
 
 
* Created initial page and template. T. Lisjac - 11/04/2003 [[User:Tom | VlxAdmin]]
 
* Created initial page and template. T. Lisjac - 11/04/2003 [[User:Tom | VlxAdmin]]
 
* Inserted a note containing instructions for writing your first Lazarus Program. Suggest an administrator places it in the appropriate place on the Tutorial menu. 3/09/2004 [[User:Kirkpatc]]
 
* Inserted a note containing instructions for writing your first Lazarus Program. Suggest an administrator places it in the appropriate place on the Tutorial menu. 3/09/2004 [[User:Kirkpatc]]
Line 481: Line 782:
 
* Uploaded some more up-to-date screenshots and fixed links in descriptions of the Menus. 2 October 2007 [[User: Kirkpatc]]
 
* Uploaded some more up-to-date screenshots and fixed links in descriptions of the Menus. 2 October 2007 [[User: Kirkpatc]]
 
* Fixed links for component descriptions in Extra Controls section of Component Palette. 2 October 2007 [[User: Kirkpatc]]
 
* Fixed links for component descriptions in Extra Controls section of Component Palette. 2 October 2007 [[User: Kirkpatc]]
 
+
* Uploaded some more up-to-date screenshots,and fix some more up-to-date item. 12 October 2018 [[User: robsean]]
 +
* Uploaded some more up-to-date screenshots,and fix some more up-to-date item. 15 February 2019 [[User: robsean]]
 
[[Category:zh]]
 
[[Category:zh]]

Latest revision as of 05:27, 31 March 2023

Deutsch (de) English (en) español (es) suomi (fi) français (fr) magyar (hu) italiano (it) 日本語 (ja) македонски (mk) Nederlands (nl) português (pt) русский (ru) slovenčina (sk) shqip (sq) 中文(中国大陆)‎ (zh_CN) 中文(台灣)‎ (zh_TW)

这是Lazarus教程的起点。你可以自由地把自己的体会添加到这里。

概述

Lazarus是一个自由并且开源的RAD(快速应用开发)开发工具,它基于同样自由开源的FreePascal(object pascal)编译器。Lazarus IDE(screenshot)可以创建独立的(原文是self-standing,我不确认是否准确)的图形或控制台程序,同时稳定并且富于特色.目前可以运行在Linux, FreeBSD和Win32平台下,同时提供可自定义的源代码编辑器,包含包管理器的可视化GUI设计环境,以及完整地集成在GUI环境中的调试器和FreePascal编译器。

起点 - 你的第一个Lazarus程序!

(感谢User:Kirkpatc)

首先,安装Lazarus,然后运行Lazarus,当然还要确定你有可以使用的FreePascal编译器。

桌面上将出现很多窗口:顶部是主菜单,左面是对象观察器,Lazarus源代码编辑器将占据大部分的桌面,而一个预置的Form1窗体将覆盖在源代码编辑器的上面。

首先,如果你的Lazarus是全英文的,那么你可以通过主菜单上的Environment -> Environment Options打开环境设置窗口,在Desktop标签下有Language选项,改成Chinese (zh_CN),确定后重新启动下Lazarus,绝大部分界面就是中文的了。

注:对于linux用户,Lazarus的默认编译/安装很大可能是使用GTK1库(非常容易辩认...因为非常丑...),GTK1对于Unicode的支持不完善,无法显示中文,你可以使用GTK2重新编译Lazarus,具体方法请参照Quick start: Recompile the IDE

在顶部的主菜单上,菜单分隔线的下面有一排标签。如果Standard标签还未被选中,单击选中它。然后找到TButton图标(一个有OK字样的矩形),单击Tbutton图标,然后在Form1窗体上找个宽敞的地方单击一下。一个有着"Button1"标题的矩形按钮就出现了。重复一次,你将获得"Button2"按钮,建议你把它放到Button1的右面。

现在单击Button1选中它,左侧的对象观察器上将出现Button1对象的所有属性。找到名为Caption的属性(你可以在"收藏夹"标签下更方便地找到它),现在这个属性的值是"Button1"。单击显示着"Button1"的方格,把里面"Button1"文本改成"Press",当你按下Enter(或者单击别的方格)后,你会看见Form1窗体上的Button1按钮上的文本变成了"Press"。然后找到对象观察器上的"事件"标签,你会看见可以给Button1关联很多事件(Event),包括OnClick,OnEnter,OnExit等等。选择OnClick右边的空白方格,将出现一个显示"..."(三个点,也就是省略号)的小方格,在这个方格上单击,你将自动跳转到源代码编辑器,同时你的光标会处于一段过程(procedure)代码中:

 procedure TForm1.Button1Click(Sender: TObject);
 begin
   {你的光标将位于这里,请输入后面的代码:}
   Button1.caption := 'Press again';
   {源代码编辑器已经自动完成了这个过程的其他部分}
 end;

按下F12选中Form1窗体。

然后我们来编辑Button2的属性,将Caption修改为"Exit",然后选择OnClick事件,单击那个显示"..."的小方格,你又回到了源代码编辑器,光标位于另一段过程代码的中间:

 procedure TForm1.Button2Click(Sender: TObject);
 begin
   {输入:}
   Close;
 end;

再次按下F12选中Form1窗体。现在可以尝试编译这个程序了。最简单的方法是在顶部主菜单中选择"运行",在弹出的子菜单中选择"运行"(你也可以使用快捷键F9)。如果一切顺利,你的程序将被编译执行。

所有的编译信息都会出现在底部的"消息"窗口中。最终,一个没有刻度标记(编辑状态下才会出现)的Form1窗口将出现在屏幕上。这是你的应用程序的主窗口,它正等着你去按按钮(以及其他操作)。

尝试下点击Press按钮,你会发现按钮的标签变成了"Press again"。之后你再怎么按,它依然显示"Press again"。

现在点击Exit按钮,窗口将关闭,程序也就终止了。编辑状态下有着丑陋刻度标志的Form1又回到了屏幕上,准备接受更多的修改完善。

现在你应该保存你的工作了(你应该经常这么做!),选择顶部主菜单上的" 工程 > 保存工程 "来保存工程文件。

第二步

再次打开你保存的工程。

在Form1窗体上选择Press按钮("Button1")。

在"事件"标签中选择OnClick,点击出现的"..."方格,来回到源代码编辑器。

按照下面的文本编辑你的代码:

 procedure TForm1.Button1Click(Sender: TObject);
{这段代码使用了Button1的Tag属性,使Tag属性在0和1之间转换}
 begin
   if Button1.tag =0 then
   begin
     Button1.caption := 'Press again';
     Button1.tag := 1
   end else
   begin
     Button1.caption := 'Press';
     Button1.tag := 0
   end
 end;

保存你的工作,重新编译并且运行,Press按钮的标签将会在点击时,在两个不同的文本间来回变换了

然后,随便玩吧:]

如果你准备编写控制或者基于文本的Pascal程序(例如你正在使用一份基本的Pascal指南,准备编写在控制台环境下运行的程序,以及为系统底层编程等等),你依然可以使用Lazarus编写,编译并且运行你的程序。Lazarus是一个理想的Pascal开发环境。具体请参照Console Mode Pascal.

第三步 常用调试方法

新人学习不少需要调试的内容

所以需要一些直接有效的打印出调试内容.

比如像VB 下的 Debug.print 可直接在立即窗口中打印出调试内容

其实可以使用

 WriteLn('XXXX ', XXX); 
 Write('XXXXXX');   

但是在网上发现不少新人使用会弹出: project project1 raised exception class 'EInOutError' with message:file not open

异常通知

只需要在文件头部加入预编译指令

 {$APPTYPE CONSOLE}

这样调试时会弹出一个类dos对话框,输出调试的内容


第四步 常用技巧

lazaurs的编辑器蛮强大的,支持代码补全,自动完成,模板编辑,多行缩进注释,选定代码后批量更改里面的单词!

1.代码补全

按下键盘的Ctrl+W键!输入变量后按下这个键就OK啦~

2.自动完成

自动完成的快捷键大多数都冲突了,解决方法是打开 工具(T)->选项...->编辑器->键盘映射->CodeTools命令->标识符自动完成 上右键 编辑 ,然后根据实际情况修改吧,我的是再勾选Alt,也就是说,我的热键是Ctrl+Alt+Space!不懂的看图

3.模板编辑

这个也蛮简单,按下键盘的Ctrl+J,然后输入class,回车!是不是很酷!

4.多行缩进注释

缩进的:向左 -> Ctrl+U

向右 -> Ctrl+I(选中多行代码更爽)

多行注释:Ctrl+/

5.选定代码后批量更改里面的单词 先选中一行代码,然后点击编辑器左边显示行号左边的那支笔,看看图哦。

这个时候你可以输入b,变量a就全部改为b,还可以按下tab跳到下一个单词。

6.编辑器的高亮

<?xml version="1.0"?>
<CONFIG>
 <EditorOptions Version="9">
   <Display DoNotWarnForFont="Ubuntu Mono" EditorFont="Ubuntu Mono" EditorFontSize="13">
     <MarkupCurrentWord NoKeyword="False"/>
   </Display>
   <KeyMapping>
     <default Count="1">
       <Version Value="6"/>
       <Item1 Name="Identifier completion">
         <KeyA Default="False" Key1="32" Shift1="5"/>
       </Item1>
     </default>
   </KeyMapping>
   <CodeTools CodeTemplateFileName="/home/lht/.lazarus/lazarus.dci" CompletionLongLineHintTypeCompletionLongLineHintType="sclpExtendRightOnly" AutoDelayInMSec="104"/>
   <Mouse>
     <Default Version="1"/>
   </Mouse>
   <Color Version="9">
     <LangObjectPascal Version="9">
       <ColorScheme Value="Twilight"/>
       <SchemeTwilight>
         <Space Background="1973790" FrameColor="5000268" FrameStyle="slsDotted" FrameEdges="sfeBottom"/>
         <Number Foreground="7434751"/>
         <String Foreground="7337839"/>
         <Symbol Foreground="clYellow"/>
         <Comment Foreground="clSkyBlue" Style="fsItalic"/>
         <Assembler Foreground="11715098"/>
         <Directive Foreground="22015"/>
         <Case_label Foreground="16541892"/>
         <IDE_Directive Foreground="1478752"/>
         <Reserved_word Foreground="1023473"/>
       </SchemeTwilight>
     </LangObjectPascal>
     <Globals Version="9">
       <SchemeTwilight>
         <ahaDefault Background="1973790"/>
       </SchemeTwilight>
     </Globals>
     <LangPython Version="9">
       <SchemeTwilight>
         <Float Foreground="8345087"/>
         <Octal Foreground="16755455"/>
         <Number Foreground="8345087"/>
         <String Foreground="8388522"/>
         <Symbol Foreground="clYellow"/>
         <Comment Foreground="clSkyBlue"/>
         <Hexadecimal Foreground="8345087"/>
         <SyntaxError Foreground="16755285"/>
         <Documentation Foreground="16755370"/>
         <Reserved_word Foreground="43775"/>
         <Non_reserved_keyword Foreground="8366847"/>
       </SchemeTwilight>
     </LangPython>
   </Color>
   <Misc PasExtendedKeywordsMode="True"/>
   <General>
     <Editor TabIndent="True" TabWidth="2"/>
   </General>
   <DividerDraw>
     <LangObjectPascal>
       <TypeSect>
         <TopColor Value="9157119"/>
       </TypeSect>
       <TypeGVar>
         <TopColor Value="9157119"/>
       </TypeGVar>
       <TypeGStruct>
         <TopColor Value="9157119"/>
       </TypeGStruct>
       <TypeProc>
         <TopColor Value="9157119"/>
       </TypeProc>
       <TypeLStruct>
         <MaxDepth Value="1"/>
         <TopColor Value="9157119"/>
       </TypeLStruct>
     </LangObjectPascal>
   </DividerDraw>
 </EditorOptions>
</CONFIG>

IDE窗口

当你第一次运行Lazarus时,一系列独立的浮动窗口将出现在你的桌面上。

首先,在桌面顶部有一个窗口,标题是Lazarus vxxxx - project。这是你工程的主要控制窗口,包括主菜单和组件面板。

Lazarus IDE 2.0.0- project1.png

标题栏下面是包括"文件""编辑""查找"等常见项目(以及Lazarus特有的一些项目)的主菜单。

主菜单下面,组件面板的左侧是一组按钮,包括了主菜单中的常用项目,例如新建文件,保存等等。

在这个窗口下面,左边是对象查看器

对象查看器.png

右边是源代码编辑器

源代码编辑器.png

也许会有一个小窗口覆盖在源代码编辑器上,是Lazarus预置的一个Form1窗体

Form1.png

如果你没有看见它,可以按下F12在源代码编辑器和窗体预览间来回切换。

窗体预览展示了应用程序的图形界面,源代码编辑器则显示了应用程序所关联的Pascal代码。对象观察器则展示了组件的更多细节。

当你创建一个新工程时(或者第一次运行Lazarus时),一个默认的窗体将被创建。这个窗体包含了一个带有刻度标尺(帮助你定位放置到窗体上的组件)的区域,以及包含常见的"最小化""最大化""关闭窗口"按钮的顶部标签。用鼠标点击这个窗体,左侧的对象观察器将显示这个窗体的属性。

在你工作的时候,其他一些窗口也会出现:

包含你工程的一些细节,并且允许你从工程中添加或删除文件的工程查看器窗口

工程查看器.png

以及显示编译信息,错误以及运行报告的信息窗口

信息.png

如果你从一个终端窗口中运行Lazarus,那么这个原始的终端窗口将被保留,编译信息也会显示在这个终端窗口中。

主菜单

主菜单内容仔细的说明在这里:Main menu/zh CN

IDE选项

在Lazarus 1.0.14版中,通过"工具"->"选项",可以打开IDE设置窗口。 在这里你可以对环境、编译器、JCF格式设置、代码工具、代码管理器、调试器、帮助等信息配置。

IDE选项.png
  • 环境
    • 文件:最大记录工程数、文件数及设置Lazarus目录、编译器路径、FPC源代码目录、Make文件目录等等。
    • 桌面:设置IDE语言、自动保存信息等等。
    • 窗口:可对窗口位置、终端输出进行相应设置。
    • 窗体编辑器:对颜色、风格等设置。
    • 对象查看器:对颜色、速度等设置。
    • 备份:工程文件备份设置,其他文件备份设置。
    • 命名:对Pascal后缀、可疑文件动作、自动重命名Pascal文件为小写、单元被重命名,更新引用等等配置。
    • FPDoc编辑器:配置FPDoc。
    • 文件筛选:对单元、工程、窗体、包、其他文件设置筛选器。
  • 编辑器
    • 普通:允许设置撤销/重做次数、滚动方式、缩进与制表符、光标等设置。
    • 显示:设置边界和边缝及默认编辑器字体。
    • 键盘映射:快捷键设置。
    • 鼠标:对鼠标操作进行相应设置。
    • 自动化功能:对自动补充信息进行设置。
    • 代码折叠:对代码折叠相关进行配置。
    • 隔离区绘制:代码块间线条设置。
    • 页和Windows:暂无。
  • JCF格式设置
    • 文件格式:暂无。
    • obfuscate:暂无。
    • clarify:暂无。
    • preprocessor:暂无。
  • 代码工具
    • 普通:方法跳转、工程附加源文件路径等设置、pascal源文件缩进设置。
    • 类完成:类、方法部分插入方式及属性自动完成配置。
    • 创建代码:插入过程策略、新单元添加到uses部分等配置。
    • 单词:设置关键字策略、标识符规则及例外等。
    • 分割行:可设置最大行宽、不拆分前面、后面行的条件。
    • 空格:空格插入方式,在关键字、标识符等前或后插入空格。
    • 标识符自动完成:设置标识符自动完成条件,如添加分号时。
  • 代码管理器
    • 更新:设置优先表现模式(分类、源代码),自动刷新条件及跟随光标。
    • 种类:设置只在类模式中使用变量、常量、引入、定义等。
    • 代码观察器:对代码观察器进行一些配置。
  • 调试器
    • 普通:可设置调试器类型和路径调试器特殊选项等。
    • 事件日志:对消息窗口进行设置,如错误时显示的颜色等。
    • 语言异常:设置忽略哪些异常,如 中止、代码工具错误、Fopen错误。并允许添加忽略。
    • 操作系统异常:设置操作系统异常处理方式。
  • 帮助
    • 帮助选项:设置FPC HTML文件路径、默认查看器等。
    • 外部:对外部程序进行配置,如Windows、PostgreSQL、Gtk2配置名称、单元文件及位置。并允许添加外部程序。

按钮栏

按钮.png

在主编辑器窗口左侧小工具栏位置,(主菜单下方与左侧组件面板中),包含一组按钮:

“新建单元”、“新建窗体”、“打开”、“保存”、“保存所有”、“新窗体”、“切换窗体/单元”、

“查看单元”、“查看窗体”、“运行”、“暂停”、“步进”、“下一步”、“运行,直到函数返回”。

组件面板

标签式工具栏里显示常用组件图标。

每个选项卡使用一组不同的图标显示,选项卡组最左边的第一个图片(指向箭头),称为选择工具。

如果你将鼠标悬停在组件面板中的图标上,将会显示该组件的提示信息。T意味着,Type类型,或者是Class组件。在窗体中,使用组件时,类将会添加到类型和接口处(通常作为TForm1一部分)。实例化处,添加到VAR部分(通常作为Form1变量)。任何方法,设计时要使用窗体或组件(程序或函数),将被放置在implementation部分。如果你要找出某一特定组件的属性,可以看组件的继承,之后检查其派生的基类型的属性。例如,你要了解TMaskEdit,可以查看TcustomMaskEdit。

选项卡(通过名称可以了解的其包含了哪些组件):

standard.png
通常使用的组件: TMainMenu, TPopupMenu, TButton, TLabel, TEdit, TMemo, TToggleBox, TCheckBox, TRadioButton, TListBox, TComboBox, TScrollBar, TGroupBox, TStaticText, TRadioGroup, TCheckGroup, TPanel, TActionList
additional.png
更多经常使用的组件: TBitBtn, TSpeedButton, TImage, TShape, TBevel, TPaintBox, TNotebook, TLabeledEdit, TSplitter, TMaskEdit, TCheckListBox, TScrollBox, TApplicationProperties, TStringGrid, TDrawGrid, TPairSplitter
commoncontrols.png
TTrackBar, TProgressBar, TTreeView, TListView, TStatusBar, TToolBar, TUpDown, TPageControl, TImageList
dialogs.png
TOpenDialog, TSaveDialog, TSelectDirectoryDialog, TColorDialog, TFontDialog, TOpenPictureDialog, TSavePictureDialog, TCalendarDialog, TCalculatorDialog

有几个有用的对话框,它不在组件面板中显示,但在你可在过程函数中直接调用。

有关组件使用的例子,请参看$LazarusPath/lazarus/examples目录。许多程序不使用IDE组件而直接使用对话框或其他组件的调色板,或者有一个单独的窗体定义文件:所有组件中,在Pascal主程序部分定义使用。


一些示例,不马上使用的:你可能需要调整路径和文件(目录)的执行权限。如果你想直接编译示例,请确保对文件(目录)具有读取/写入/执行权限。

请尝试运行testall程序,以查看可用组件和示例菜单,大多数的测试,可以确定你的环境是否能够正常使用这些组件!

  • 杂项组件
misc.png
TColorButton, TSpinEdit, TArrow, TCalendar, TEditButton, TFileNameEdit, TDirectoryEdit, TDateEdit, TCalcEdit, TFileListBox
  • 数据组件
datacontrols.png
数据组件,通常用于数据库: TDBNavigation, TDBText, TDBEdit, TDBMemo, TDBImage, TDBListBox,TDBComboBox, TDBCheckBox, TDBRadioGroup, TDBCalendar, TDBGroupBox, TdbGrid
  • 数据访问组件
dataaccess.png
TDatasource
  • 系统组件
system.png
TTimer, TIdleTimer, TProcess
  • SynEdit(编辑器组件
synedit.png
SynEdit是一个高级的文本编辑器控制,对Borland的Delphi,Kylix、C++Builder等支持语法高亮和代码自动完成,并支持输出为HTML、Tex和RTF。这是一个VCL/CLX控件,意味着,适用于Microsoft的Windows,没有信赖的运行库,SynEdit作为跨平台组件,也是Lazarus IDE中的编辑器组件。 查看 sourceforge上的synedit. TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynMultiSyn

要使用调色板,必须存在窗体(如果没有,选择文件->新建窗体)。单击调色板中需要使用的控件,在窗体上单击,这时候,窗体上,将显示出来调色板组件;你可以调整它到合适的位置,通过属性可以显示外观。

如果你想安装额外的组件,无论是你自己编写的,还是第三方的;完成后,将在组件面板中显示出来。

如何使用通用控件

StdCtrlsComCtrlsExtCtrls包含了常用控件的构建形式及Lazarus应用程序中常用对象。

许多控件应用程序开发人员都要使用,如TButtonTMemoTScrollBar等等。声明的控件都继承自父类。

使用这些控件时,你可以选择相应控件,在窗体上拖放就可以了。也可以使用代码创建,但是,在你不需要时,你需要销毁它。

设置属性

在窗体设计器上放置控件后,在对象检查器中,你可以设置控件属性或编写相应事件代码。

如,你在窗体上放置了一个按钮(TButton),选择它,并移动它以改变位置,你会可以看到它的top和left值的变化。在对象观察器中Height、Width值分别代表其大小高度和宽度。

此外,你可以使用代码来改变对象属性:

Form1.Button1.Height := 48;

在FormCreate过程中书写上面的代码,程序运行时,将看到效果。

总之,有三种方法,可以设置对象的属性:

  • 通过鼠标在窗体上调整
  • 通过设置对象观察器中的值
  • 通过代码来设置属性

公共属性

每个组件(控件)都有不同的属性,有某些是相同的,常见的,下面这介绍这些常用属性:

通过选择属性或关键字,在对象观察器或源代码编辑器中按F1来获得帮助。

如果该页面上的属性描述不够,您可以通过选择继承列表中的链接或在对象声明中选择祖先类型来导航到相应的祖先类别描述。

常用属性
属性说明介绍
Action 行动 与对象关联的主要动作或事件。如,在选择“退出”时,会导致“关闭”。
Align 对齐 定义与父对象对齐方式。alTop:顶对齐;alBottom:底对齐;alLeft、alRight:左对齐和右对齐;alNone:无;alClient:占用父对象所有空间。
Anchor 用于保持控件的父控件;当父控件调试大小将调整与其距离。[akBottom,akRight]将保持固定在父控制右下角距离。
AutoSelect 自动选择 为True时,控件在获取到焦点,或当按下 Enter键时选择所有文本。
AutoSelected 自动选中 True表示编辑框或组合框控件刚刚执行了“自动选择”操作,因此随后的鼠标点击和按键操作将正常进行而不会选中文本。
BorderSpacing 边框间距 锚定控件与其父级之间的边缘空间。
Caption 标题 设置显示内容,如按钮标题为“关闭”或“执行”。默认情况下,标题名称与Name属性值相同。
CharCase 字符显示 设置字母在编辑控件中显示方式:Normal:正常(不改变字母大小写);ecLowerCase:转换为小写;ecUppercase:转换为大写。
Constraints 限制 设置控件最大、小、高、宽度。如果调整控件大小,新的大小将在此范围内。You should take care when setting these options that they do not conflict with the Anchors and Align settings.
Color 颜色 设置控件的文本颜色。
Enabled 启用 设置控制是否可用,如果为False,在窗体上显示为灰色
Font 字体 设置对象的字体信息,通常(+)号展开详细,如字体、字号、颜色等。
Hint 提示 鼠标悬停在控件上时,弹出的提示信息。请注意ShowHint属性为True时才显示。
Items 项目 包含的数据信息,如果文本行等。
Lines 列表 字符串数组,包含单个数据,数组为索引从0开始,即[0..numLines-1]。
Name 名称 设置控件的标识符。如TBitButton的实例,为Form1.BitBitton1、Form1.BitButton2等等,程序员应该使用见名真义的名称,如ExitButton(退出按钮)或OKButton(确定按钮)。
PopUpMenu 弹出式菜单 设置在控件上右击时,弹出的菜单。
Position (or Top, Left) 位置 设置控件位置。
ReadOnly 只读 为True时,控件只能被读取,不能被更改。如Edit。
ShowHint 显示提示 设置鼠标'悬停'在控件上时,是否显示提示信息。
Size (or Height and Width) 大小 设置控件尺寸。
Style 样式 样式的选项取决于所考虑的控件类型:例如,样式可以由TFormStyle、TBorderStyle、TButtonStyle等定义。
TabOrder Tab键顺序 输入整数,设置Tab 的顺序。
TabStop 制表位 为False时,Tab 将无法选中此控件,否则可以。
Text 文本 字符串文本,表示该控件包含的数据。适用于Text、Memo、StringList类型。Most of the editing operations (such as Select, Clear, Cut, Copy) are performed in this part of the object, which holds the actual string being edited. If the control contains more than a single line of text, for example TMemo or TComboBox, then the textual elements are arranged as an array of strings (zero-indexed, ie numbered from [0..numLines-1]) in Lines.
Visible 可见 为True,在窗体中可以看到此控件,否则将隐藏。
WordWrap 自动换行 为True时,文本内容将自动换行。

事件动作

许多行动通常列在“对象观察器”中的“事件”选项卡里。在列表中选择相应事件,在下拉列表中将会显示你已经定义的方法,并允许你对其关联。点击旁边的"..."按钮,将跳到源代码编辑器里,你在那里可以编写相应程序。

“事件“选项卡中,显示了当前控件支持的事件,像OnClick事件:鼠标点击事件;OnEntry:当获得焦点时;OnExit:当失去焦点时;或者你可以编写:OnChange:内容改变时;或OnScroll:在滚动条上操作时等等,根据你的需要来选择使用哪些事件进行哪些操作。

在窗体设计器上右击控件 ,“创建默认的事件“也有相同的效果,通常是OnClick(点击)事件。之后在源代码编辑器里编写相应操作。

在面向对象程序设计中,使用 TActionList 组件是为了集中处理许多常用的操作,把用户界面和应用逻辑分开,减少程序的代码行数,方便程序的维护和调试。它用于维护一系列动作列表,以供其他组件或控制所使用,如菜单和按钮。


单击方法
常用事件
事件 说明 介绍
OnChange 改变事件 当检测到任何更改(如鼠标移动、点击、按键、编辑文字、更改图片等)都将触发此事件。
OnClick 点击事件 鼠标点击时触发此事件(点击,指的是鼠标左键点击),点击事件大多是控件默认的事件,如点击一个按钮、单选框或复选框。
Click 单击方法 单击方法,在代码中模拟点击控件。一个程序可以调用相同代码的OnClick事件,通过点击激活其他事件。这个方法可以在程序启动时使用,而不是用户点击后再进行某些操作。
OnDragDrop 拖放事件 拖放操作之前,即当鼠标选中某些信息(如文本)要移动到新位置时。
OnEditingDone 编辑完成事件 当用户完成编辑/修改时,通常用来验证输入内容,如检测输入的文本是不是有效的IP地址。
OnEntry 获得焦点事件 当控件获取到焦点时,触发此事件。
OnExit 移出事件 当鼠标移出控件区域时触发此事件。
OnKeyPress 按键事件 按键事件,当按下某键时,将触发此事件。不同于OnKeyDown:当按下但不松开某键时触发此事件。
OnKeyDown 按下键不松事件 如果一个键被按下,但不松开,将触发此事件。
OnKeyUp 松开键事件 松开按键时触发此事件。
OnMouseMove 鼠标移动事件 当鼠标在控件上移动时触发此事件。
OnMouseDown 鼠标按下事件 鼠标按下但不松开时触发此事件。
OnMouseUp 鼠标松开事件 鼠标按下并松开时触发此事件。
OnResize 改变大小事件 调整控件大小时触发此事件。

构造和析构函数

每个对象都有两个相关联的方法:

  • 构造函数:在创建时,即分配对象所需内存和资源时。
  • 析构函数:在删除时,即释放分配对象所需内存和资源时。

释放对象,你需要使用free方法,因为它会检测对象值是否为nil。如果你调用已经销毁的对象,它将产生一个错误。

销毁时,注意以下:

  • Declare Destroy with the override directive, because it is a virtual method.
  • Always call 'inherited Destroy;' as the last thing on the destructor code.
  • Be aware that an exception may be raised on the constructor in case there is not enought memory to create an object, or something else goes wrong. If the exception is not handled inside the constructor, the object will be only partially built. In this case Destroy will be called when you weren't expecting it, so your destructor must check if the resources were really allocated before disposing of them.
  • Remember to call Free for all objects created on the constructor.

为窗体创建菜单

TMainMenu是大多都使用的;在窗体顶部会出现菜单栏,设计者可以定制不同的菜单项。TPopupMenu是一个与上下文相关的菜单。通常是在控件附近点击时弹出的。

主菜单是非可视组件:也就是说,在组件面板中选择菜单图标,放置在窗体上,运行时不会被显示,你需要创建菜单项,像TPopupMenu菜单,你需要关联相应组件的PopupMenu属性。


若要使用菜单编辑器:右击窗体上的菜单控件,在弹出的菜单中选择(Menu Editor)菜单编辑器,在弹出的窗口中,对菜单进行设置。

默认将显示一个NewItem1菜单项,右击它,弹出的菜单中,你可以继续在其上面或下面添加菜单,也可以子菜单。在对象观察器中,设置菜单项属性。

当然,你应该给菜单项起个有意义的名字,如File open(打开文件)、Close(关闭)等。 如果你想热键,即在菜单项后显示(&N),你只需要直接输入即可。当然,你也可以给菜单项关联快捷键,对象观察器中的ShortCut和ShortCutKey2属性,分别设置第1,2快捷键;如(复制,Ctrl+C;粘贴,Ctrl+V)。

另外,如需要在菜单项间插入一条分隔线,只需要设置菜单项的Caption属性为-即可。


你可以结合ActionList组件,对菜单各项的事件进行统一编写。

By default, a number of standard actions are pre-loaded from StdActns or, if DataAware controls are used, from DBActns. These actions can be chosen using the ActionList editor which appears when you right-click on the ActionList icon on the Form Designer.

调试器

待写

更多 category: IDE Window - Debug

Lazarus 文件

   (感谢 Kevin Whitefoot.)
   (Giuseppe Ridinò, User:Kirkpatc 和 Tom Lisjac 添加)

当你保存时,实际上会保存两个文件:

  xxx.pas 和 yyy.lpr

不止这些,还有项目文件(lpr)、单元文件(pas),名称不能相同,否则Lazarus会覆盖掉原文件,在编辑器会因为无法找到指定文件而报错。

所以,你需要保存为一个不重名的项目。

这是我最终的文件列表:

e:/lazarus/kj/lazhello:

total 4740  free 76500
-rwxrwxrwx   1 kjwh     root  4618697 Mar 24 11:19 again.exe
-rw-rw-rw-   1 kjwh     root     3002 Mar 24 11:21 again.lpi
-rw-rw-rw-   1 kjwh     root      190 Mar 24 11:18 again.lpr
-rw-rw-rw-   1 kjwh     root      506 Mar 24 11:08 againu.lfm
-rw-rw-rw-   1 kjwh     root      679 Mar 24 11:08 againu.lrs
-rw-rw-rw-   1 kjwh     root      677 Mar 24 11:08 againu.pas
-rw-rw-rw-   1 kjwh     root     2124 Mar 24 11:08 againu.ppu
-rwxrwxrwx   1 kjwh     root      335 Mar 24 11:07 ppas.bat

Note that there are many more files than the two that I thought I was saving.(注意,好像是多了两个文件,我想是我存的吧。)

下面是对每个文件的简短介绍:

again.exe: 二进制可执行文件,Win32中添加exe扩展名。linux没有。此文件在Linux上很大的原因是,加入了调试标记。 注意:在1.0.14版,可以勾选,“工程”->“工程选项”中的“编译选项”->“链接”:“从可执行程序中除去符号,可以减少程序体积(Strip Symbol)”;以减少程序体积。

again.lpi: 它以XML格式存储,是Lazarus项目的主要文件(项目信息);Delphi应用程序文件是.dpr。

again.lpr: 这是主程序的源代码文件,尽管使用了特定的扩展名,但它仍是正常的Pascal源文件。它有use部分,可以让编译器找到所需的单元。注意,程序名可以和该名称相同。

againu.lfm: 存储了Lazarus窗体布局信息;也包含了初始化部分的资源文件。Delphi的DFM文件可以转换为LFM格式:“工具“->“转换DFM文件为LFM文件”。

againu.lrs: 生成的资源文件。需要注意的是它不是Windows的资源文件。

againu.pas: The unit that contains the code for the form. 包含窗体代码的单元文件。

againu.ppu: 编译的单元文件。

ppas.bat: 一个简单的脚本,链接程序生成可执行文件。如果编译完成,将由编译器删除。

原作者和变化

这个页面来自 这里(失效)。

  • Created initial page and template. T. Lisjac - 11/04/2003 VlxAdmin
  • Inserted a note containing instructions for writing your first Lazarus Program. Suggest an administrator places it in the appropriate place on the Tutorial menu. 3/09/2004 User:Kirkpatc
  • Per above, moved Chris's writeup to the main body of the tutorial VlxAdmin
  • Began to insert text describing the Lazarus Editor - more to follow! 24 Mar 2004 User:Kirkpatc
  • Added some more to Lazarus Editor section of Tutorial. 25 Mar 2004 User:Kirkpatc
  • Added screenshots and revised some of the page formatting VlxAdmin 3/25/2004
  • Moved some of kwhitefoot's comments into Tutorial section. Formatting not quite right, but have to go to bed now! 26 Mar 2004 User:Kirkpatc
  • Formatted, added credits and comments. Removed original notes. VlxAdmin 3/26/2004
  • More material added to Editor section of tutorial. 26 Mar 2004 User:Kirkpatc
  • More material added describing the Main Menu. Renamed 'Hello World' to 'Getting Started' and moved it to nearer the top. 31 March 2004 User:Kirkpatc
  • Inserted section on Run sub-menu. Some general editing (eg ended each entry with a period to ensure consistency). 9 Apr 2004 User:Kirkpatc
  • Inserted a new section on How to get started with MySQL in FPC/Lazarus. 13 Apr 2004 User:Kirkpatc
  • Deleted the section on MySQL from here: it has been copied to Lazarus Database section of tutorial. 14 Apr 2004 User:Kirkpatc
  • Added some more to the description of the Editor Main Menu. 18 Apr 2004 User:Kirkpatc
  • Added section on Environment sub-menu. 19 Apr 2004 User:Kirkpatc
  • Added section on Components sub-menu. 4 May 2004 User:Kirkpatc
  • Adding Tools sub-menu description (incomplete). 7 May 2004 User:Kirkpatc
  • Added some screenshots to Menu descriptions. 9 May 2004 User:Kirkpatc
  • Fixed a bit in Environment Options - thanks VincentSnijders. 14 May 2004 User:Kirkpatc
  • More additions to Tools sub-menu. 19 May 2004 User:Kirkpatc
  • Added a section on the Button Bar and started work on The Component Palette. 20 May 2004 User:Kirkpatc
  • Posted a description file for the StdCtrls unit of the LCL, in the hope that people will add comments. 26 May 2004 User:Kirkpatc
  • Edited the StdCtrls file, removing a lot of repetitive material and doing some formatting. It is still far too long. 28 May 2004 User:Kirkpatc
  • Expanding on the Components Palette. 5 June 2004 User:Kirkpatc
  • Added a lot to the DialogExamples page. 10 June 2004 User:Kirkpatc
  • Considerable revision of the StdCtrls page, hopefully making it clearer and encouraging people to contribute - particularly in the 'Description' sections. 14 June 2004 User:Kirkpatc
  • Added pages for Menus and Dialogs units (linked to Component Palette description) - please feel free to add to these pages. 14 June 2004 User:Kirkpatc
  • Added page for Common Controls (linked to Component Palette). 16 June 2004 User:Kirkpatc
  • Added MaskEdit page (linked to Component Palette). 17 June 2004 User:Kirkpatc
  • Added Buttons, ExtCtrls pages (linked to Component Palette). 17 June 2004 User:Kirkpatc
  • Edited MainMenu component description page. 23 June 2004 User:Kirkpatc
  • Some additions to Common Controls. 28 June 2004 User:Kirkpatc
  • A new tutorial on Text-mode Pascal programming has been added. 5 July 2004 User:Kirkpatc
  • Minor changes to ComCtrls, ExtCtrls, Environment Menu. 10 July User:Kirkpatc
  • Added FormsTxt, component description page for Component Palette. 20 July 2004 User:Kirkpatc
  • Some corrections to ConsoleModePascal. 21 July 2004 User:Kirkpatc
  • Some small changes to ComponentPalette. 22 July 2004 User:Kirkpatc
  • Returned after a long absence! Changed link for component descriptions in StdCntls group of ComponentPalette to point directly at the Lazarus on-line help html pages. 25 Sept 2007 User: Kirkpatc
  • Uploaded some more up-to-date screenshots and fixed links in descriptions of the Menus. 2 October 2007 User: Kirkpatc
  • Fixed links for component descriptions in Extra Controls section of Component Palette. 2 October 2007 User: Kirkpatc
  • Uploaded some more up-to-date screenshots,and fix some more up-to-date item. 12 October 2018 User: robsean
  • Uploaded some more up-to-date screenshots,and fix some more up-to-date item. 15 February 2019 User: robsean