Code explorer in Delphi

Source: Internet
Author: User

Code Explorer (code browser) is one of the features of Delphi IDE, which is very popular among users. As its name indicates, code explorer is used to quickly browse source code units. Code explorer is usually on the left of code editor, as shown in.

Code Explorer displays the list of all classes, functions, procedures, variables, and uses of a unit. Class nodes are extended to display all attributes, variables, fields, and methods of a class. For example:

When switching a unit in code editor, the content page displayed by code explorer changes accordingly.

1. Code explorer shortcut menu

New] Adds a new variable, method, function, or process to the Unit. You can also add a unit to the uses list.

Rename] Rename an identifier (variable, method, function, process, and so on ).

View Editor] When code explorer is positioned in the code editor window, the code editor window is displayed at the top.

Dockable] Specifies whether code Explorer can be used as a berth

Properties] Open the code explorer Properties dialog box (Explorer options ).

2. Add code using code Explorer

To navigate to a method, function, or process, simply double-click its identifier name in code explorer and code editor will jump to the location of the method in the source file. To locate the data field of the class or a unit variable declaration, locate the variable identifier in the Code Explorer window and double-click the identifier. The Code Editor displays the declaration of the variable.

You can use code explorer to add methods and variable declarations to the source file. For example, to add a field variable to the class, you can select the [new] menu item from the code explorer shortcut menu and enter the variable declaration to be added.

To add an integer variable X, enter the following content:

X: integer;

After you press enter, the variable is added to the class.

You can also simply add methods to the class. The following exercises describe the process.

1) Start a new application and switch to the code editor window.

2) Right-click the tform1 node in the Code Explorer window and select the new menu item from the shortcut menu.

3) enter the following code in the edit box of the Code Explorer window and press enter to end the process.

procedure Test;

4) Delphi adds a public node under the tform1 class node and adds the test process under the Public node. For example:

5) on the tform1 node, select the new menu item again, enter the following code in the editing box, and press enter to end.

function GetSomething: Byte;

6) insert another item as follows:

AVariable: integer;

7) You may not have noticed that Delphi is busy modifying the unit while adding various items.

8) the modified unit list is as follows:

Code explorer is both a unit browser and a production tool. When writing code, you can use it to navigate units. But for this purpose, it is extremely useful. You can also use code explorer to add code to a cell. Code Explorer is a powerful "Booster" and its ease of use is also a major advantage.

3. Code explorer options

The "Explorer" page of the "Environment options" dialog box provides the "Code Explorer" display options (select 【Tools | environment OPTIONS...Can call up this dialog box), as shown in.

The options on this page are used to set and control the action and display information of code explorer. For more detailed settings, see Delphi online help.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.