分享
 
 
 

2004.11.29.Code Editor

王朝delphi·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

Code Editor

The Code Editor provides a convenient to view and modify your source code. It is a full-featured, customizable, ANSI editor that provides syntax highlighting, multiple undo capability, and context-sensitive Help for language elements. As you design the user interface for your application, Delphi 2005 generates the underlying code. When you modify object properties, your changes are automatically reflected in the source files. Because all your programs share common characteristics, Delphi 2005 auto-generates code to get you started. Do not modify the auto-generated code for the Initialize Components method. Doing so will cause your form to disappear when you click the Design tab. You can think of the auto-generated code as an outline that you can examine to create your program. The Code Editor provides the following features to help you write code:

Refactoring

Code Insight

Sync Edit

Class completion

Code browsing

Code snippets

Code folding

To-Do Lists

Keystroke macros

Bookmarks

Block comments

Refactoring

Refactoring is the process of improving your code without changing its external functionality. For example, you can turn a selected code fragment into a method by using the extract method refactoring. Delphi 2005 moves the extracted code outside of the current method, determines the needed parameters, generates local variables if necessary, determines the return type, and replaces the code fragment with a call to the new method. Several other refactorings, such as renaming a symbol and declaring a variable, are also available.

Sync Edit

The Sync Edit feature lets you simultaneously edit duplicate identifiers in code. If you select a block of code that contains duplicate identifiers, for example, label1, and click the Sync Edit Mode icon that appears in the left gutter, all of the duplicated identifiers are highlighted and the cursor is positioned to the first identifier. As you change the first identifier, the same change is performed automatically on the other identifiers.

Code Insight

Code Insight refers to a subset of features embedded in the Code Editor that aid in the code writing process. These features display context-sensitive pop-up windows and provide the following services:

Help identify common statements you wish to insert into your code.

Assist in the selection of properties and methods.

Display events available for a particular class.

Provide view declaration information for identifiers.

To enable and configure Code Insight features, choose Tools Options and click Code Insight.

Class Completion

Class completion simplifies the process of defining and implementing new classes by generating skeleton code for the class members that you declare. By positioning the cursor within a class declaration in the interface section of a unit and pressing CTRL+SHIFT+C, any unfinished property declarations are completed. For any methods that require an implementation, empty methods are added to the implementation section.

Code Browsing

While using the Code Editor to edit a VCL Form application, you can hold down the CTRL key while passing the mouse over the name of any class, variable, property, method, or other identifier. The mouse pointer turns into a hand and the identifier appears highlighted and underlined; click on it, and the Code Editor jumps to the declaration of the identifier, opening the source file if necessary. You can do the same thing by right-clicking on an identifier and choosing Find Declaration. Code browsing can find and open only units in the project Search path or Source path, or in the product Browsing or Library path. Directories are searched in the following order:

1. The project Search path ( Project Options Directories/Conditionals).

2. The project Source path (the directory in which the project was saved).

3. The global Browsing path ( Tools Options Library).

4. The global Library path ( Tools Options Library).

The Library path is searched only if there is no project open in the IDE. Code browsing cannot find identifiers declared in new, unsaved unit files, and it does not work in package projects.

Code Snippets

Code snippets are commonly used programming statements, such as if, while, and for statements, that you can insert into your code. When the Code Editor is open, you can double-click a code snippet on the Tool Palette to add it to your code. You can also create your own code snippets by selecting code in the Code Editor, pressing the ALT key, and dragging the code to the Tool Palette.

Code Folding

Code folding lets you collapse sections of the code to create a hierarchal view of your code and to make it easier to read and navigate. The collapsed code is not deleted, but hidden from view. To use code folding, click the plus and minus signs next to the code.

To-Do Lists

A To-Do List records tasks that need to be completed for a project. After you add a task to the To-Do List, you can edit the task, add it to your code as a comment, indicate that it has been completed, and remove it from the list. You can filter the list to display only those tasks that interest you.

Keystroke Macros

You can record a series of keystrokes as a macro while editing code. After you record a macro, you can play it back to repeat the keystrokes during the current IDE session. Recording a macro replaces the previously recorded macro.

Bookmarks

Bookmarks provide a convenient way to navigate long files. You can mark a location in your code with a bookmark and jump to that location from anywhere in the file. You can use up to ten bookmarks, numbered 0 through 9, within a file. When you set a bookmark, a book icon is displayed in left gutter of the Code Editor.

Block Comments

You can comment a section of code by selecting the code in the Code Editor and pressing CTRL+/ (slash). Each line of the selected code is prefixed with // and will be ignored by the compiler. Pressing CTRL+/ will add or remove the slashes, based on whether the first line of the code is prefixed with //. When using the Visual Studio or Visual Basic key mappings, use CTRL+K+C to add and remove comment slashes.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有