Show: Object Pascal C++
Display Preferences

Code Editor Context Menu

From Appmethod Topics
Jump to: navigation, search

Go Up to Code Editor


Right-click the Code Editor window to display and select from the following context menu of commands:

Item Description

Find Declaration

Opens the source file for the selected symbol and highlights the declaration. Appears in the context menu only when you right-click a symbol in the Code Editor.

This command invokes Code Browsing, and searches the following paths:

  • For Object Pascal:
    • The project search path (Project > Options > Object Pascal Compiler)
    • The global browsing path (Tools > Options > Environment Options > Object Pascal Options > Library)
  • For C++:

Open Source/Header File (C++ only)

Does either of the following:

  • If the implementation file (.cpp) is displayed in the Code Editor, opens the header file (.h).
  • If the header file (.h) is displayed in the Code Editor, opens the implementation file (.cpp).

Close Page

Closes the current source file. If there is only one source file currently open, the Code Editor window is closed as well, but the project remains open.

Open File at Cursor

Searches for and attempts to open a source file whose name matches the text currently under the cursor. Then either:

  • Opens the source file by that name (if one exists).
  • Displays the Open dialog (if a file by that name does not exist in the search path), so that you can browse to the location of a file you want to open.

The file is opened in a new Code Editor page.

Unit scope names are now used to help locate the correct file. Every project has a set of default unit scopes that the IDE can use to search for units if the unqualified unit name is not found. For example, if you point to FMX.Controls.pas and select Open File at Cursor, the IDE searches for the unit-scoped name first (FMX.Controls.pas) and then looks for the unscoped unit name (Controls.pas). Then the IDE takes all the unit scopes defined for the project and prepends each unit scope to the unit name, until either the file is found or there are no more unit scopes: for example, Rtl.Controls.pas, Fmx.Controls.pas, and so on.

New Edit Window

Opens a separate full-screen window containing the same contents as the original Code Editor window.

File Format

Specifies the format to be used to store files, as follows:

  • Text Form
  • Binary Form
  • Binary
  • Big Endian UCS-2
  • Little Endian UCS-2
  • Big Endian UCS-4
  • Little Endian UCS-4
  • UTF8
  • ANSI

Topic Search

Invokes the help system and requests the help topic that matches the currently selected item in the Code Editor.

Add to Repository

Opens the Add to Repository dialog box, which enables you to add forms and templates to the New Items dialog box in the IDE.

Increase Font Size

Increases the font size of the Code Editor.

Decrease Font Size

Decreases the font size of the Code Editor.

Complete Class at Cursor

Generates skeleton code for the class members that you declare. See Code Editor for details.

Add To-Do Item

Opens the Add To-Do Item dialog box so that you can create a To-Do item and add it to the To-Do list.

Cut

Removes the current selection and stores it to the clipboard. Cut works with text when using the Code Editor and with components when using the Form Designer.

Copy

Copies the current selection to the clipboard. Copy works with text when using the Code Editor and with components when using the Form Designer.

Paste

Inserts the contents of the clipboard (previously captured using the Cut or Copy command). Paste works with text when using the Code Editor and with components when using the Form Designer.

Toggle Bookmarks

Sets a new bookmark or removes an existing one (using the bookmark number you select from the submenu). See Using Bookmarks.

Goto Bookmarks

Moves the Code Editor focus to the line marked with the bookmark whose number you select from the submenu. See Using Bookmarks.

Clear Bookmarks

Clears all bookmarks currently set. Only enabled when at least one bookmark is set.

Debug

Toggle Breakpoint

Alternately sets or clears a breakpoint on the current line. See Setting and Modifying Breakpoints.

Evaluate/Modify

Opens the Evaluate/Modify dialog box:

  • If you right-clicked an editor token, the selected token is evaluated in the Evaluate/Modify dialog box.
  • If you right-clicked whitespace, the Evaluate/Modify dialog box is empty.

Add Watch at Cursor

Set Next Statement

Changes the location of the instruction pointer (that is, the value of EIP register, indicated by CPUStackArrow.bmp in the left gutter) to the current line in the Code Editor. Use this command when you want to skip certain source statements. When you resume program execution, execution starts at this statement. Set Next Statement is not the same as stepping through instructions; the debugger does not execute any instructions that you might skip.

Enabled only when the current source line has generated machine code (as indicated by a blue dot BlueDot.bmp in the left-hand gutter of the Code Editor).

Caution: Use this command with extreme care; it is easy to place your system in an unstable state when you skip over program instructions.

Goto Address

Opens the Enter Address to Position to dialog box, which allows you to enter or select a symbol, and then opens the Disassembly Pane to the associated location.

View CPU

Opens the CPU Windows.

  • If you right-clicked a source line that generated code (a line with a blue dot BlueDot.bmp), then the selected address in the CPU stack view will be the address that corresponds to that source line.
  • If you right-clicked a line without a blue dot, then the selected address will be EIP (the location of the instruction pointer, indicated by CPUStackArrow.bmp).

Inspect

  • If you right-clicked an editor token, the Debug Inspector opens and focuses on the selected token.
  • If you right-clicked whitespace, the Inspect dialog opens, allowing you to type the expression that you want to inspect in the Debug Inspector.

Run to Cursor

Executes the current active program to the line containing the cursor.

Read Only

Toggles the Code Editor's read-only mode. When this option is enabled, keyboard input is ignored.

View Messages

Toggles the display of the Messages View.

Fold

Collapses one or more blocks of code (functions, type declarations, preprocessor region directives, XML Doc comments, and so on). Use Ctrl+Shift+K+O to disable (and enable) the Fold command. You can choose the following types of code blocks to fold:

Nearest

Collapses the nearest block to the location of the cursor.

Namespace

Collapses all C++ namespaces or Object Pascal units in the current source file.

Types

Collapses all type declarations.

Methods

Collapses all method definitions.

Regions

Collapses all preprocessor regions. For Object Pascal, see Regions; for C++, see #pragma region and #pragma end_region.

Nested Methods

Collapses all nested methods.

Doc Comments

Collapses all XML Documentation comments (triple-slash comments) in Object Pascal source code. For more information about XML Doc comments, see XML Documentation Comments.

For more information about code folding, see Using Code Folding.

Unfold

Expands one or more collapsed blocks of code (functions, type declarations, preprocessor region directives, XML DOC comments, and so forth).

Nearest

Expands the nearest collapsed block to the location of the cursor.

All

Expands all the collapsed blocks of code in the current source file.

See Using Code Folding.

Toggle Comment

Toggles comment characters (//) at the beginning of the current line of code. This is an easy way to comment-out selected lines of code.

Properties

Opens the first Editor Options page of the Options dialog box (Tools > Options ). All the Editor Options pages pertain to the Code Editor.

Search for Usages

Opens the Search for Usages dialog box to find usages of classes, methods, variables, and overriding methods, derived classes and implemented interfaces in Object Pascal source code projects.

Format Source

Formats the Object Pascal or C/C++ source file being edited. To set formatting options, use the Formatter Options page of the Options dialog box (Tools > Options). The formatting options define indentation, spaces, line breaks, capitalization, and align parameters to be used for the code formatting. See Formatting Source Code.

Refactor

Rename

Opens either the Rename <symbol name> (Object Pascal) or the Rename Symbol (C++) dialog box. In C++, Rename is available only for the 32-bit Windows platform.

Declare Variable

Opens the Declare Variable dialog box.

Declare Field

Opens the Declare Field dialog box.

Extract Method

Opens the Extract Method dialog box.

Extract Resource String

Opens the Extract Resource String dialog box.

Find Unit

Opens the Find Unit dialog box.

Change Params

Opens the Change Parameters dialog box.

Move

Opens the Move dialog box.

Extract Interface

Opens the Extract Interface or Superclass dialog box. You must select one or more classes or class members.

Extract Superclass

Opens the Extract Interface or Superclass dialog box. You must select one or more classes with a common ancestor, or one or more class members.

Pull Members Up

Opens the Pull Members Up dialog box. You must select several class members.

Push Members Down

Opens the Push Members Down dialog box. You must select several class members.

Safe Delete

Opens the Safe Delete dialog box. You must select one or more classes or class members.

Inline Variable

Opens the Inline Variable dialog box. You must select a variable.

Introduce Field

Opens the Introduce Field dialog box. You must select a single complete expression.

Introduce Variable

Opens the Introduce Variable dialog box. You must select a single complete expression.

Find

For Object Pascal:

Find references to method/type <name>

Opens the Find References pane.

Find local references to method/type/unit <name>

Opens the Find References pane. See Find Local References.

Find declaration of method/type <name> in <source-file>

Highlights the declaration of the current method or type in the Code Editor.

For C++ (for 64-bit Windows, iOS, and Android target platforms):

Find Definition

Right-click a reference/symbol and select Find Definition to search for definitions in the code. If there is one definition it shows the result in the current file or opens the source file where the definition is. The line appears highlighted. For virtual methods, it opens the Find Definition pane. In this pane, you can click any entry to navigate to the source code of the selected method declaration. See Find Definition.

Find References

Right-click an object to find all the references. It opens the C++ Find References pane where you can click on any result to go to the source file. See Find References.

Show Base Types

Right-click a type to show in the Type Hierarchy pane the base class of the selected type. It highlights the result in the code editor. See Show Base Types.

Show Derived Types

Right-click a type to go to the derived class that inherited from the selected type. It highlights the result in the code editor. See Show Derived Types.

Show Type Hierarchy

It shows the type Hierarchy of a class in the Type Hierarchy pane. See Show Type Hierarchy.

Go to Type Declaration

Right-click a symbol or a type to go to the declaration of the type of the symbol. See Go to Type Declaration.

Header Dependency

When you right-click an include <header name> statement, it displays a tree view of all headers on which the selected header depends, in the Header Dependency pane. When you right-click any place in the Code Editor, it displays a tree view of all headers the current file includes. See Header Dependency.

Navigate To

This command displays the Navigate To dialog box that allows you to search your active project for identifiers and constants that meet the specified criteria.

Version Control

If the file in the Code Editor is under a version control system, displays additional commands.

  • Subversion:
    • Commit opens the Commit (SVN) pane and allows you to save your changes to the SVN repository.
    • Update refreshes the local working copy by pulling the latest version of the file from the SVN repository. Status messages appear in the Messages view. Best practice is to always Update your working copy before you start editing.
    • Browse Repository opens the Repository Browser, displaying the SVN tree structure that contains the file you are editing.
    • Revert reverts local changes to the previous revision of the file.
  • Git:
    • Revert reverts local changes to the previous revision of the file.
    • Commit opens the Commit (Git) pane and allows you to save your changes to the local Git repository.
  • Mercurial:
    • Revert reverts local changes to the previous revision of the file.
    • Commit opens the Commit (Mercurial) pane and allows you to save your changes to the local Mercurial repository.

Surround

Surrounds the highlighted element with the selected code template (logical code symbols or statements). Many of the elements in the Surround list are also code templates, listed in the Templates Window.

In the following descriptions, the ellipsis (...) represents the elements currently selected in the Code Editor:

For Object Pascal:

begin

Indents the selection and adds begin ... end; statements.

(*

Converts the selection into a comment surrounded by (* ... *).

{

Converts the selection into a comment surrounded by { ... }.

else

Adds else / begin ... end statements.

forb

Adds for I := 0 to List.Count -1 do / begin ... end;.

forin

Adds for MyElem in MyList do begin ... end;.

forr

Adds for I := List.Count - 1 downto 0 do / begin ... end; statements.

function

Adds function MyFunction() : Integer; begin ... end; statements.

ifb

Adds if True then begin ... end; statements.

ifeb

Adds if True then begin ... end / else / begin ... end; statements.

procedure

Adds procedure MyProcedure(); begin ... end; statements.

region

Adds {$REGION} 'MyRegion' ...{$ENDREGION}.

repeat

Adds repeat ... until (True);.

Surround Windows

Adds {$IFDEF MSWINDOWS} ... {$ENDIF}. See Conditional compilation (Object Pascal) and IFDEF directive (Object Pascal).

try

Adds MyClass := TComponent.Create(Self); try ... finally MyClass.Free end;.

trye

Adds try ... except on E: Exception do / end;.

tryf

Adds try ... finally / end;

whileb

Adds while True do / begin ... end;


For C++:

/*

Indents the selection and surrounds it with /* ... */ comment characters.

for

Adds for (i = 0; i < 10; i++) { ... }.

if

Adds if (true) { ... }.

ifeb

Adds if (true) { ... } else { }.

throw

Replaces selection with throw ExceptionType;.

try

Adds try { ... } catch (...) { }.

whileb

Adds while (1) { ... }.


Sync Prototypes

Synchronizes the interface and implementation copies of your procedure and function prototypes. See Synchronizing Prototypes for further details.

Topics

See Also

Personal tools
In other languages