Dev Common
Dev Common
Table of Contents
Concepts 1
Compiling, Building, and Running Applications 2
Compiling, Building, and Running Applications 2
MSBuild Overview 4
Build Configurations Overview (Delphi) 5
Build Configurations Overview (C++) 6
Named Option Sets Overview 7
Targets files 8
Debugging Applications 10
Overview of Debugging 10
Overview of Remote Debugging 12
General Concepts 14
Managing the Development Cycle Overview 14
Designing User Interfaces 15
Using Source Control 16
Localizing Applications 18
Deploying Applications 19
Getting Started 22
What is RAD Studio? 23
What's New in RAD Studio (Delphi for Microsoft .NET) 24
What's New in RAD Studio (C++Builder) 28
What's New in RAD Studio (Delphi) 32
Tour of the IDE 34
IDE on Windows Vista 40
Tools Overview 41
Code Editor 42
Form Designer 46
Starting a Project 47
Template Libraries 50
Overview of Virtual Folders 50
Help on Help 51
Code Completion 53
Refactoring Applications 55
Add Namespace 57
iii
RAD Studio (Common)
Refactoring Overview 57
Change Parameters 58
Symbol Rename Overview (Delphi, C#, C++) 59
Add or Edit Parameter 60
Extract Method Overview (Delphi) 60
Declare Field 61
Extract Resource String (Delphi) 62
Declare Variable and Declare Field Overview (Delphi) 62
Declare Variable 64
Extract Method 64
Find References Overview (Delphi, C#, C++) 65
Change Parameters Overview (Delphi) 66
Extract Resource String 66
Find Unit 66
Sync Edit Mode (Delphi, C#, C++) 67
Refactorings 67
Undoing a Refactoring (Delphi, C#) 67
Rename Symbol (C++) 68
Rename <symbol name> (C#) 68
Rename <symbol name> (Delphi) 69
Testing Applications 70
Unit Testing Overview 70
DUnit Overview 72
NUnit Overview 76
iv
RAD Studio (Common)
Procedures 103
Compiling and Building Procedures 104
Applying the Active Build Configuration for a Project 104
Building Packages 105
Compiling C++ Design-Time Packages That Contain Delphi Source 106
Creating Build Events 107
Creating Named Build Configurations for C++ 107
Creating Named Build Configurations for Delphi 108
Building a Project Using an MSBuild Command 108
Using Targets Files 109
Installing More Computer Languages 110
Linking Delphi Units Into an Application 111
Previewing and Applying Refactoring Operations 111
Renaming a Symbol 112
Working with Named Option Sets 113
v
RAD Studio (Common)
vi
RAD Studio (Common)
vii
RAD Studio (Common)
viii
RAD Studio (Common)
ix
RAD Studio (Common)
x
RAD Studio (Common)
xi
RAD Studio (Common)
Reference 279
Delphi Reference 280
Delphi Compiler Directives (List) 280
Delphi compiler directives 282
Align fields (Delphi) 283
Application type (Delphi) 283
Assert directives (Delphi) 284
Autoboxing (Delphi for .NET) 284
Boolean short-circuit evaluation (Delphi compiler directive) 285
Conditional compilation (Delphi) 285
Debug information (Delphi) 287
DEFINE directive (Delphi) 287
DENYPACKAGEUNIT directive (Delphi) 287
Description (Delphi) 288
DESIGNONLY directive (Delphi) 288
ELSE (Delphi) 288
ELSEIF (Delphi) 289
ENDIF directive 289
Executable extension (Delphi) 289
Export symbols (Delphi) 290
Extended syntax (Delphi) 290
External Symbols (Delphi) 290
Floating Point Exception Checking (Delphi) 291
Hints (Delphi) 291
HPP emit (Delphi) 292
IFDEF directive (Delphi) 292
IF directive (Delphi) 292
IFEND directive (Delphi) 293
IFNDEF directive (Delphi) 294
IFOPT directive (Delphi) 294
Image base address 294
Implicit Build (Delphi) 295
Imported data 295
Include file (Delphi) 295
Input output checking (Delphi) 296
Compiler directives for libraries or shared objects (Delphi) 296
xii
RAD Studio (Common)
xiii
RAD Studio (Common)
xiv
RAD Studio (Common)
xv
RAD Studio (Common)
Redo 759
Select All Controls 759
Error Messages 760
Data Breakpoint is set on a stack location 762
Misaligned Data Breakpoint 762
Error address not found 762
Another file named <FileName> is already on the search path 763
Could not stop due to hard mode 763
Error creating process: <Process> (<ErrorCode>) 763
A component class named <name> already exists 763
A field or method named <name> already exists 763
The project already contains a form or module named <Name> 763
Incorrect field declaration in class <ClassName> 763
Field <Field Name> does not have a corresponding component. Remove the declaration? 764
Field <Field Name> should be of type <Type1> but is declared as <Type2>. Correct the declaration? 764
Declaration of class <ClassName> is missing or incorrect 764
Module header is missing or incorrect 764
IMPLEMENTATION part is missing or incorrect 765
Insufficient memory to run 765
Breakpoint is set on line that contains no code or debug information. Run anyway? 765
<IDname> is not a valid identifier 765
<Library Name>is already loaded, probably as a result of an incorrect program termination. Your system 765
may be unstable and you should exit and restart Windows now.
Incorrect method declaration in class <ClassName> 765
Cannot find implementation of method <MethodName> 766
The <Method Name> method referenced by <Form Name>.<Event Name> has an incompatible parameter 766
list. Remove the reference?
The <Method Name> method referenced by <Form Name> does not exist. Remove the reference? 766
No code was generated for the current line 766
Property and method <MethodName> are not compatible 767
Cannot find <FileName.PAS> or <FileName.DCU> on the current search path 767
Source has been modified. Rebuild? 767
Symbol <BrowseSymbol> not found. 767
Debug session in progress. Terminate? 767
Uses clause is missing or incorrect 767
Invalid event profile <Name> 768
File 768
Active Form Wizard 771
Active Server Object wizard 772
Add 773
xvi
RAD Studio (Common)
xvii
RAD Studio (Common)
xviii
RAD Studio (Common)
xix
RAD Studio (Common)
xx
RAD Studio (Common)
xxi
RAD Studio (Common)
xxii
RAD Studio (Common)
xxiii
RAD Studio (Common)
xxiv
RAD Studio (Common)
Index a
xxv
1 RAD Studio (Common)
1 Concepts
The application development life cycle involves designing, developing, testing, debugging, and deploying applications. RAD
Studio provides powerful tools to support this iterative process, including form design tools, the Delphi for compiler, an integrated
debugging environment, and installation and deployment tools.
Topics
Name Description
Compiling, Building, and Running Applications ( see page 2) This section describes essential information about compiling, building, and
running applications. As of 2007, the new build engine in the IDE is MSBuild.exe.
You can now create and manage build configurations, named option sets, and
targets files that enhance your ability to control your development environment.
Debugging Applications ( see page 10) Many of the same techniques are used for debugging applications in different
environments. RAD Studio provides an integrated debugging environment that
enables you to debug Win32 application and .NET applications. In addition, you
can use the debugger to debug an application running on a remote machine that
does not have RAD Studio installed.
General Concepts ( see page 14) This section provides an overview of basic concepts.
Getting Started ( see page 22) The RAD Studio integrated development environment (IDE) provides many tools
and features to help you build powerful applications quickly. Not all features and
tools are available in all editions of RAD Studio. For a list of features and tools
included in your edition, refer to the feature matrix on http://www.codegear.com.
Refactoring Applications ( see page 55) Refactoring is a technique you can use to restructure and modify your code in
such a way that the intended behavior of your code stays the same. RAD Studio
provides a number of refactoring features that allow you to streamline, simplify,
and improve both performance and readability of your application code.
Testing Applications ( see page 70) Unit testing is an integral part of developing reliable applications. The following
topics discuss unit testing features included in RAD Studio.
Modeling Applications with Together ( see page 81) This section provides an overview of the features provided by Together.
Note: The product version you have determines which Together features are
available.
1
Compiling, Building, and Running RAD Studio (Common) 1.1 Compiling, Building, and Running
Topics
Name Description
Compiling, Building, and Running Applications ( see page 2) As you develop your application in the IDE, you can compile (or make), build, and
run the application in the IDE. All three operations can produce an executable
(such as .exe, .dll, .obj, or .bpl). However, the three operations differ
slightly in behavior:
2
1.1 Compiling, Building, and Running RAD Studio (Common) Compiling, Building, and Running
operations can produce an executable (such as .exe, .dll, .obj, or .bpl). However, the three operations differ slightly in
behavior:
• Compile (Project Compile) or, for C++, Make ( Project Make) compiles only those files that have changed since the last
build as well as any files that depend on them. Compiling or making does not execute the application (see Run).
• Build (Project Build) compiles all of the source code in the current project, regardless of whether any source code has
changed. Building is useful when you are unsure which files have changed, or if you have changed project or compiler
options.
• Run (Run Run (F9) compiles any changed source code and, if the compile is successful, executes your application, allowing 1
you to use and test it in the IDE .
To delete all the generated files from a previous build, use the Clean command, available on the context menu of the project
node in the Project Manager.
Compiler Options
You can set many of the compiler options for a project by choosing Project Options and selecting a compiler-related page.
For example, most of the options on both the Delphi Delphi Compiler page and the C++ Compiler page correspond to compiler
options that are described in the online Help for that page.
To specify additional compiler options, you can invoke the compiler from the command line. For a complete list of the Delphi
compiler options and information about running the Delphi compiler from the command line, see Delphi Language Guide in the
Contents pane.
After you compile a project, you can display information about it by choosing Project Information. The resulting Information
dialog box displays the number of lines of source code compiled, the byte size of your code and data, the stack and file sizes,
and the compile status of the project.
Compiler Errors
As you compile a project, compiler messages are displayed in the Messages window. For an explanation of a message, select
the message and press F1.
Build Configurations
You can save certain project options as a named build configuration. You can specify the active build configuration for each of
your projects, and you can change the active build configuration during project development. For example, you can set project
options specific to debugging your project, save the options as the Debug build configuration, and then apply them as the active
configuration while you debug the project.
The options in a build configuration are available on the Compiler, Compiler Messages, Linker, and Conditionals/Directories
pages of the Project Options dialog box.
By default, the IDE includes a Debug configuration and a Release configuration. You can modify the options in both of these
default configurations, and you can create new build configurations of your own. To apply a selected build configuration to
specific projects or project groups, use the Build Configuration Manager.
3
MSBuild Overview RAD Studio (Common) 1.1 Compiling, Building, and Running
See Also
MSBuild Overview ( see page 4)
For more information about MSBuild, see the Microsoft documentation at http://msdn.microsoft.com.
Project groups are also converted to MSBuild and given the project-group extension .groupproj.
Building Projects
You can build projects without knowing anything about MSBuild because the IDE handles all the details for you. The
Project Compile and Project Build commands both invoke MSBuild, but the scope of each command is different.
You can also explicitly build projects from the command line by running MSBuild.exe with your .dproj file.
To invoke MSBuild in a custom command environment, choose Start menu RAD Studio Command Prompt. This command
window automatically sets both the path to the executable and the variable for your installation directory.
If you want to use MSBuild from the command line outside of the RAD Studio Command Prompt, you should set the following
environment variables yourself:
BDS=c:\program files\CodeGear\RAD Studio\5.0 FrameworkDir=c:\Windows\Microsoft.NET\Framework
FrameworkVersion=v2.0.50727
4
1.1 Compiling, Building, and Running RAD Studio (Common) Build Configurations Overview (Delphi)
and post-build events using the Project Options Build Events dialog box (C++Builder supports pre-link events as well). If
you specify build events, the commands you specified and their results also appear in the Messages window. To control the
level of output from MSBuild, use the Verbosity field on the Tools Options Environment Options page.
1. .RC files
2. .ASM files 1
3. .PAS files
4. .CPP files
The build proceeds downward through the directory or folder nodes in the Project Manager. Within each folder, files are built in
order according to their file type. You can control build order by placing files within different folders or within virtual folders in
the Project Manager.
See Also
Compiling ( see page 2)
You can change option values in any configuration, including Base. You can delete the Debug and Release configurations, but
you cannot delete the Base configuration.
You can change the options for the three default configurations, and you can create and name your own custom build
configurations on numerous build-related pages of the Project Options dialog box.
5
Build Configurations Overview (C++) RAD Studio (Common) 1.1 Compiling, Building, and Running
The active build configuration is used in Compile and Build commands for the project. Use the Build Configuration Manager to
specify the active configuration for a selected project or project group (choose Project Configuration Manager).
See Also
MSBuild Overview ( see page 4)
You can change option values in any configuration, including Base. You can delete the Debug and Release configurations, but
you cannot delete the Base configuration.
You can change option values in any configuration, including Base. You can delete the Debug and Release configurations, but
you cannot delete the Base configuration.
The active build configuration is used in Compile and Build commands for the project. Use the Build Configuration Manager to
specify the active configuration for a selected project or project group (choose Project Configuration Manager).
Build Configurations
Each configuration, except Base, is based on another configuration from which it inherits its values. The Debug and Release
configurations inherit their values from Base.
You can, in turn, create a new configuration based on any configuration, and the new configuration inherits values from its
parent. After creating a configuration, you can change its values to whatever you want, and you can make it the active
configuration for a project or projects. You can also delete any configuration except Base.
Unless it is changed, a configuration inherits its option values from its parent configuration. This inheritance is not static: if the
parent configuration changes, so do its children for all inherited values.
The default value of an option is its value in its parent configuration. You can revert an option to its default value.
Note that a configuration is different from an option set, though they are related. Both consist of sets of option values. The main
distinction is that configurations are associated with projects, whereas option sets are saved in files independent of projects.
Build configuration values are stored in the project file, so saving a project saves changes to configurations, but option sets are
6
1.1 Compiling, Building, and Running RAD Studio (Common) Named Option Sets Overview
unaffected. Changing a project's configurations and adding or deleting configurations does not affect option sets. Similarly,
saving option sets does not change configurations.
The Build Configuration drop-down menu lists configurations for that project—not option sets. Each project has its own list of
configurations, independent of other projects. However, you can access any option set from any project.
For instance, if a configuration inheritance chain does not include a value for a particular compiler option, the default value is
specified by the compiler itself. When you save a configuration or option set, only its values are saved--not values for every
option.
If Merge is checked, the IDE merges the option's list with that of its immediate ancestor's configuration's list for that option. Note
that the IDE does not actually change the contents of the option, but acts as if the list included the ancestor's list. If the
ancestor's Merge check box is also checked, the IDE merges this ancestor's list for that option, and so on up the inheritance
chain.
If Merge is unchecked, the IDE uses only the items in the option.
See Also
MSBuild Overview ( see page 4)
7
Targets files RAD Studio (Common) 1.1 Compiling, Building, and Running
For instance, suppose you had a project open in the IDE and the active configuration was the Base configuration. You change
one option and then save the option set. The only option values saved in the option set file are the one option value you changed
plus the option values in the Base configuration that are different from the defaults.
• Overwrite replaces the current configuration with the values from the option set entirely; values not in the option set get their
default values.
• Replace writes all the values from the option set to the current configuration, but no other values are changed.
• Preserve writes only the values from the option set that are not already set in the active configuration.
See Also
Working With Named Option Sets ( see page 113)
You can also add or modify project property values with a .targets file. You can leverage the large variety of MSBuild tasks
available in the .NET Framework SDK and on the internet, such as "Zip", "SVNCheckout", and "Mail", or write custom tasks
yourself.
In summary:
• A .targets file is an XML file with <Target> nodes that contain MSBuild scripts with lists of tasks to perform.
• You can create, add, enable, or remove .targets files in a project with the IDE.
Adding .targets files
You create and add a .targets file to the project using either menu commands or the Project Manager context menu. The IDE
generates a minimal .targets file containing only the <Project> root node and namespace attribute. You can then add MSBuild
8
1.1 Compiling, Building, and Running RAD Studio (Common) Targets files
By default, .targets files are added to the project but not used by it. You enable a .targets file with the Project Manager, which
adds the .targets file as an MSBuild <Import> to your project. All .targets files must contain valid MSBuild scripts free of errors. If
the file has any errors, you are notified and, if the project references the invalid .targets file, it is disabled and cannot be
re-enabled until the errors are corrected. Because MSBuild can only read <Import>s directly from disk, the .targets file must be
saved to disk before a Make, Build, or invoking any of its targets.
The .targets file can declare its own properties, targets, and item groups for use by its targets and tasks. It can also refer to
properties and item groups in the project file, including those imported from the standard Codegear .targets file in the Windows
directory at microsoft.net\Framework\v2.0.xxx\Borland.Cpp.Targets. You should not modify any .targets files in this directory,
since improper edits may cause the IDE to stop functioning correctly.
See Also
Using Targets Files ( see page 109)
9
Overview of Debugging RAD Studio (Common) 1.2 Debugging Applications
Topics
Name Description
Overview of Debugging ( see page 10) RAD Studio includes both the CodeGear .NET Debugger and CodeGear Win32
Debugger. The IDE automatically uses the appropriate debugger based on the
active project type. Cross-platform debugging within a project group is supported
and, where possible, the debuggers share a common user interface.
The integrated debuggers let you find and fix both runtime errors and logic errors
in your RAD Studio application. Using the debuggers, you can step through code,
set breakpoints and watches, and inspect and modify program values. As you
debug your application, the debug windows are available to help you manage the
debug session and provide information... more ( see page 10)
Overview of Remote Debugging ( see page 12) Remote debugging enables you to debug one or more applications on a remote
machine when the IDE is running only on your local machine. This allows
debugging on a machine where it is impractical to install the entire IDE and
rebuild a project. Remote debugging is useful for applications that run differently
on your local machine than on an end user's machine.
The integrated debuggers let you find and fix both runtime errors and logic errors in your RAD Studio application. Using the
debuggers, you can step through code, set breakpoints and watches, and inspect and modify program values. As you debug
your application, the debug windows are available to help you manage the debug session and provide information about the
state of your application.
The Debug Inspector enables you to examine various data types such as arrays, classes, constants, functions, pointers, scalar
variables, and interfaces. To use the Debug Inspector, select Run Inspect.
The Run menu provides the Trace Into and Step Over commands. Both commands tell the debugger to execute the next line of
code. However, if the line contains a function call, Trace Into executes the function and stops at the first line of code inside the
function. Step Over executes the function, then stops at the first line after the function.
Evaluate/Modify
The Evaluate/Modify functionality allows you to evaluate an expression. You can also modify a value for a variable and insert
that value into the variable. The Evaluate/Modify functionality is customized for the language you are using:
• For a C++ project, the Evaluate/Modify dialog accepts only C++ expressions.
10
1.2 Debugging Applications RAD Studio (Common) Overview of Debugging
Debug Windows
The following debug windows are available to help you debug your program. By default, most of the windows are displayed
automatically when you start a debugging session. You can also view the windows individually by selecting View Debug
Windows.
Each window provides one or more right-click context menus. The F1 Help for each window provides detailed information about
the window and the context menus.
Remote Debugging
Remote debugging lets you debug an application running on a remote computer. Your computer must be connected to the
remote computer through TCP/IP and the remote debugger must be installed on the remote machine. After you create and copy
the required application files to the remote computer, you can connect to that computer and begin debugging.
11
Overview of Remote Debugging RAD Studio (Common) 1.2 Debugging Applications
See Also
Overview of Remote Debugging ( see page 12)
Inspecting and Changing the Value of Data Elements ( see page 122)
• Source files
• Executable files
• Symbol files
Source files are compiled using the IDE on the local machine. The executable files and symbol files produced after compilation
must be copied to the remote machine.
Source Files
When you debug a project on a remote machine, the source files for the project must be open on the local machine. The source
files display in the editor window to show a program's current execution point. You do not use source files on the remote
machine.
12
1.2 Debugging Applications RAD Studio (Common) Overview of Remote Debugging
Executable Files
Executable files are the .dll files and .exe files that are mapped into the application's address space. You generate these files on
the local machine, then copy them to the remote machine.
Symbol Files
Symbol files are generated on the local machine at compile time. These are used by the debugger to get information such as the
mapping of machine instructions to source line numbers or the names and types of variables declared in the source files. The 1
extension for the symbol files depends on the language, as shown in the following table:
You must set up specific options to generate symbol files on the local machine, then copy the files to the remote machine.
Note: The remote debugger does not provide a mechanism for interacting with an application on the remote machine. If you
need to interact with the application, you must establish a remote desktop connection.
See Also
Debugging a Remote Application ( see page 125)
13
Managing the Development Cycle Overview RAD Studio (Common) 1.3 General Concepts
1 Topics
Name Description
Managing the Development Cycle Overview ( see page 14) The development cycle as described here is a subset of Application Lifecycle
Management (ALM), dealing specifically with the part of the cycle that includes
the implementation and control of actual development tasks. The development
cycle described here does not include such things as modeling applications.
The tools of ALM include:
• Requirements management
• Source control
• User interface design
• Code visualization capabilities
• Project building, compilation, and debugging capabilities
Designing User Interfaces ( see page 15) A graphical user interface (GUI) consists of one or more windows that let users
interact with your application. At designtime, those windows are called forms.
RAD Studio provides a designer for creating Windows Forms, Web Forms, VCL
Forms, and HTML pages. The Designer and forms help you create
professional-looking user interfaces quickly and easily.
Using Source Control ( see page 16) This topic provides an overview of general source control concepts that are
consistent among a number of source control systems, also known as automated
change and software configuration management (SCM) systems. .
Localizing Applications ( see page 18) RAD Studio includes a suite of Translation Tools to facilitate localization and
development of .NET and Win32 applications for different locales. The
Translation Tools include the following:
14
1.3 General Concepts RAD Studio (Common) Designing User Interfaces
• Requirements management
• Source control
• User interface design
• Code visualization capabilities
1
• Project building, compilation, and debugging capabilities
Requirements Management
Requirements management tools enable you to add, remove, and update requirements for your software project. A fully
integrated tool also enables you to create links between the requirement specification and the portions of the code within your
software project that fulfill the requirement.
Source Control
A source control system allows you to manage versions or renditions of your project files. Most source control systems maintain
a central repository of code and allow you to check-in, check-out, update, commit, and otherwise manage your source files.
The IDE also includes a VCL.NET Forms design tool, which allows you to build .NET applications using VCL components. The
Designer offers a variety of alignment tools, font tools, and visual components for building many types of applications, including
MDI and SDI applications, tabbed dialogs, and data aware applications.
Code Visualization
The Code Visualization feature of RAD Studio provides the means to document and debug your class designs using a visual
paradigm. As you load your projects and code files, you can use the Model View to get both a hierarchical graphical view of all
of the objects represented in your classes, as well as a UML-like model of your application objects. This feature can help you
visualize the relationships between objects in your application, and can assist you in developing and implementing.
The integrated debugger allows you to set watches and breakpoints, and to step through, into, and over individual lines of code.
A set of debugger windows provides details on variables, processes, and threads, and lets you drill down deeply into your code
to find and fix errors.
See Also
Compiling ( see page 2)
15
Using Source Control RAD Studio (Common) 1.3 General Concepts
those windows are called forms. RAD Studio provides a designer for creating Windows Forms, Web Forms, VCL Forms, and
HTML pages. The Designer and forms help you create professional-looking user interfaces quickly and easily.
The Tool Palette provides dozens of controls to simplify the creation of Windows Forms, Web Forms, and HTML pages. When
creating a Windows Form, for example, you can use the MainMenu component to create a customized main menu in minutes.
After placing the component on a Windows Form, you type the main menu entries and commands in the boxes provided. The
ContextMenu component provides similar functionality for creating context menus. There are also several dialog box
components for commonly performed functions, such as opening and saving files, setting fonts, selecting colors, and printing.
Using these components saves time and provides a consistent look and feel for the dialogs in your application.
As you design your user interface, you can undo and repeat previous changes to a form by choosing Edit Undo and
Edit Redo. When you are satisfied with the appearance of the form, you can lock the components and form to prevent
accidental changes by right-clicking the form and choosing Lock Controls.
You can set properties to specify the distance between controls, shortcuts, focus labels, tab order, and maximum number of
items (listboxes, menus).
The Code Developer can then use these components to create forms. when the Use Designer Guidelines option is enabled. If
the Snap to Grid option is enabled, and Use Designer Guidelines is also enabled, the designer guidelines will take precedence.
See the Creating Designer Guidelines link at the end of this topic, to view the procedure for setting these guidelines.
See Also
ASP .NET Overview
16
1.3 General Concepts RAD Studio (Common) Using Source Control
Most source control systems adhere to a concept of a logical project, within which files are stored, usually in one or more tree
directory structures. A source control system project might contain one or many RAD Studio projects in addition to other
documents and artifacts. The system also enforces its own user authentication or, very often, takes advantage of the
authentication provided by the underlying operating system. Doing so allows the source control system to maintain an audit trail 1
or snapshot of updates to each file. These snapshots are typically referred to as diffs, for differences. By storing only the
differences, the source control system can keep track of all changes with minimal storage requirements. When you want to see a
complete copy of your file, the system performs a merge of the differences and presents you with a unified view. At the physical
level, these differences are kept in separate files until you are ready to permanently merge your updates, at which time you can
perform a commit action.
This approach allows you and other team members to work in parallel, simultaneously writing code for multiple shared projects,
without the danger of an individual team member's code changes overwriting another's. Source control systems, in their most
basic form, protect you from code conflicts and loss of early sources. Most source control systems give you the tools to manage
code files with check-in and check-out capabilities, conflict reconciliation, and reporting capabilities. Most systems do not include
logic conflict reconciliation or build management capabilities. For details about your particular source control system capabilities,
refer to the appropriate product documentation provided by your source control system vendor.
Commonly, source control systems only allow you to compare and merge revisions for text-based files, such as source code
files, HTML documents, and XML documents. Some source control systems allow you to include binary files, such as images or
compiled code, in the projects you place under control. You cannot, however, compare or merge revisions of binary files. If you
need to do more than store and retrieve specific revisions of of these types of files, you might consider creating a manual system
for keeping tracking of the changes you make to binary files.
Repository Basics
Source control systems store copies of source files and difference files in some form of database repository. In some systems,
such as CVS or VSS, the repository is a logical structure that consists of a set of flat files and control files. In other systems, the
repositories are instances of a particular database management system (DBMS) such as InterBase, Microsoft Access, MS SQL
Server, IBM DB2, or Oracle.
Repositories are typically stored on a remote server, which allows multiple users to connect, check files in and out, and perform
other management tasks simultaneously. You need to make sure that you establish connectivity not only with the server, but also
with the database instance. Check with your network, system, and database administrators to make sure your machine is
equipped with the necessary drivers and connectivity software, in addition to the client-side source control software.
Some source control systems allow you to create a local repository in which you can maintain a snapshot of your projects. Over
time the local image of your projects differs from the remote repository. You can establish a regular policy for merging and
committing changes from your local repository to the remote repository.
Generally, it is not safe to give each member of your team a separate repository on a shared project. If you are each working on
completely separate projects and you want to keep each project under source control locally, you can use individual local
repositories. You can also create these multiple repositories on a remote server, which provides centralized support, backup,
and maintenance.
17
Localizing Applications RAD Studio (Common) 1.3 General Concepts
Most source control systems consider development environment project files to be binary, whether they are actually binary files
or not. As a consequence, when you check a project file into a source control system repository, the source control system
overwrites older versions of the file with the newer one without attempting to merge changes. The same is true when you pull a
project, or check out the project file; the newer version of the project file overwrites the older version without merging.
1 The file is the lowest-level object that you can manage in a source control system. Any code you want to maintain under source
control must be contained in a file. Most source control systems store files in a logical tree structure. Some systems, such as
CVS, actually use terms like branch, to refer to a directory level. You can create files in a RAD Studio project and include them in
your source control system, or you can pull existing files from the source control system. You can put an entire directory into the
source control system, then you can check out individual files, multiple files, or entire subdirectory trees. RAD Studio gives you
control over your files at two levels—at the project level within RAD Studio and in the source control system, through the RAD
Studio interface to the source control system.
provides revision information for your local source files. The History View can be used to track changes you make to files as
you work on them in the Designer or the Code Editor.
See Also
Using the History Manager ( see page 149)
While running either wizard, you can include extra files, such as .resx or .rc files, that are not normally part of a project. You
can add new resource modules to a project at any time. If you have multiple projects open in the IDE, you can process several at
once.
You can also use the wizards to remove languages from a project and restoring languages to a project.
Translation Manager
After resource modules have been added to your project, you can use the Translation Manager to view and edit VCL forms and
18
1.3 General Concepts RAD Studio (Common) Deploying Applications
resource strings. After modifying your translations, you can update all of your application’s resource modules.
The External Translation Manager (ETM) is a version of the Translation Manager that you can set up and use without the IDE.
ETM has the same functionality as the Translation Manager, with some additional menus and toolbars.
Translation Repository
The Translation Repository provides a database for translations that can be shared across projects, by different developers.
While working in the Translation Manager, you can store translated strings in the Repository and retrieve translated strings from
the Repository. 1
By default, each time your assemblies are updated, they will be populated with translations for any matching strings that exist in
the Repository. You can also access the Repository directly, through its own interface, to find, edit, or delete strings.
The Translation Repository stores data in XML format. By default, the file is named default.tmx and is located in the RAD
Studio\bin directory.
See Also
Adding Languages to a Project ( see page 169)
19
Deploying Applications RAD Studio (Common) 1.3 General Concepts
For additional information about deploying specific types of applications, refer to the list of links at the end of this topic.
However, if you build the application by compiling the application to have external references to VCL for .NET assemblies, the
application will have external dependencies on the .NET Framework, the Borland.Delphi.dll, and whatever RAD Studio
packages you have added to the project references, for example, Borland.VclRtl.dll or Borland.Vcl.dll.
When you are ready to deploy the C# application, you can compile it using the default or a user-defined Release option set to
create an optimized version of the application in the project\bin\Release directory. The optimized application is smaller, faster,
and more efficient. To change the Debug/Release option sets, choose Project Options.
20
1.3 General Concepts RAD Studio (Common) Deploying Applications
tasks, such as copying executable and supporting files to the target computer and making Windows registry entries.
Setup toolkits, such as InstallAware, automate the process of creating installation programs, often without the need to write any
code. InstallAware is based on Windows Installer (MSI) technology and can be installed from the RAD Studio installation DVD.
After installing it, refer to the InstallAware online Help for information about using the product.
See Also
Deploying Database Applications for the .NET Framework
21
RAD Studio (Common) 1.4 Getting Started
Topics
Name Description
What is RAD Studio? ( see page 23) RAD Studio is an integrated development environment (IDE) for building Delphi
Win32 applications. The RAD Studio IDE provides a comprehensive set of tools
that streamline and simplify the development life cycle. The tools available in the
IDE depend on the version of RAD Studio you are using. The following sections
briefly describe these tools.
What's New in RAD Studio (Delphi for Microsoft .NET) ( see page 24) RAD Studio provides key new features for developing Delphi for Microsoft .NET
applications.
What's New in RAD Studio (C++Builder) ( see page 28) RAD Studio provides key new features for developing C++ applications.
What's New in RAD Studio (Delphi) ( see page 32) RAD Studio provides key new features for developing Delphi applications for
Win32.
Tour of the IDE ( see page 34) When you start RAD Studio, the integrated development environment (IDE)
launches and displays several tools and menus. The IDE helps you visually
design user interfaces, set object properties, write code, and view and manage
your application in various ways.
The default IDE desktop layout includes some of the most commonly used tools.
You can use the View menu to display or hide certain tools. You can also
customize and save the desktop layouts that work best for you.
The tools available in the IDE depend on the edition of RAD Studio you are using
and include the following:
22
1.4 Getting Started RAD Studio (Common) What is RAD Studio?
Starting a Project ( see page 47) A project is a collection of files that is used to create a target application. This
collection consists of the files you include and modify directly, such as source
code files and resources, and other files that RAD Studio maintains to store
project settings, such as the .dproj project file. Projects are created at design
time, and they produce the project target files (.exe, .dll, .bpl, etc.) when you
compile the project.To assist in the development process, the Object Repository
offers many pre-designed templates, forms, files, and other items that you can
use to create applications.
To create a project,... more ( see page 47)
Template Libraries ( see page 50) RAD Studio allows you to create multiple custom template libraries to use as the
basis for creating future projects. Template libraries let you declare how a project
can look, and enable you to add new types of projects to the New Items dialog
1
box.
Creating a template library is a two-step process.
Modeling Applications
Modeling can help you can improve the performance, effectiveness, and maintainability of your applications by creating a
detailed visual design before you ever write a line of code. RAD Studio provides the Together modeling tool, which works with
23
What's New in RAD Studio (Delphi for RAD Studio (Common) 1.4 Getting Started
the IDE.
Compiler options, and several other Project Options, can be saved as named build configurations, which you can apply to
specific projects. By default, the IDE provides a Debug and a Release build configuration.
The integrated Win32 debugger helps you find and fix runtime and logic errors, control program execution, and step through
code to watch variables and modify data values. RAD Studio includes InstallAware for creating Windows Installer setups.
See Also
Designing User Interfaces ( see page 15)
• This release includes a new .NET personality that provides full support for ASP.NET and VCL.NET, as well as inline updates
for Delphi 2007 for Win32 and C++Builder 2007.
• Generics (also known as parameterized types) are now supported by the Delphi for .NET compiler. Generics allow you to
define a class or record without specifying all the data types to be used within it. You then supply the unspecified types as
parameters when you create an instance of the generic type. You can create and consume generics in Delphi for .NET,
although the debugger does not evaluate generics. For more information, see Overview of Generics ( see page 596).
• For C#, functionality has been rolled back to match that for Visual Basic for .NET. That is, you can open, edit, compile, and
do basic debugging of C# applications. However, the IDE does not offer design-time support for C#.
• Refactorings for Delphi for .NET will not support generics, and Delphi does not support refactoring C# code.
24
1.4 Getting Started RAD Studio (Common) What's New in RAD Studio (Delphi for
• Template libraries (“starter kits”) enable you to add your own project types to the New Items gallery. A template library lets
you declare how your project will look. Sample template libraries are included in RAD Studio, including:
• A template library for creating an ASP.NET project that uses ASP.NET 2.0 AJAX Extensions 1.0. This template library is
further described under the ASP.NET heading in this topic.
• A template library that supports inserting HTML/CSS layouts such as 3-column, 2-column, header, footer, and so on. For
more information about template libraries, see Template Libraries Overview.
• Live Templates support ASP.NET controls. For more information, see Using Live Templates ( see page 148).
• Your projects can have a Project Page, which is an HTML file that contains a description of the project, along with various 1
other notes and information that you want to add. The project page is displayed when you open the project in the IDE. You set
the Project Page by selecting Project Project Page Options.
• Windows forms are no longer supported in RAD Studio.
ASP.NET
This implementation supports .NET 2.0.
You can create both ASP.NET 2.0 applications, and ASP.NET-based Web Services application. ASP.NET supports the
Code-Behind model only.
The Designer provides MasterPages and design-time support for all standard ASP.NET 2.0 controls.
You can drag and drop data connections from the Data Explorer to the WebForms Designer.
Site navigation tools will be provided, such as sitemaps, sitemap paths, and sitemap menus.
An AJAX template library now appears in the File New dialog box. The AJAX library is called AJAX-Enabled ASP.NET Web
Application. Use this gallery item to create a new ASP.NET project that is set up for use with ASP.NET 2.0 AJAX Extensions
1.0. For more information about Microsoft's ASP.NET AJAX technology, see http://www.asp.net/ajax/.
You can use both the Cassini web server and the IIS webserver while developing your project and you can run your application
using F9 when using Cassini.
RAD Studio also provides a DBX4 implementation of the ASP.NET Provider model, which allows you to use a DBX4 database
for storing membership, roles, session information, and so forth.
Debugger
The following key features are new or significantly changed:
• You can specify whether Microsoft Managed Debug Assistants (MDAs) will display notifications in the event log. For more
information, see Event Log Options ( see page 995).
• The debugger can now handle components and classes that contain the new generic types but cannot evaluate generics. For
more information about generics, see Overview of Generics ( see page 596).
• The Debug Inspector has a new context menu command, Bind to Object, which binds the Inspector to the specific object.
For more information, see Debug Inspector ( see page 942).
Together Modeling
Support for the Together modeling tool has the following new features:
• Together modeling features have been updated to sujpport generic types in Delphi for .NET.
• Refactorings that depend on Together will not work for code that contains generic types.
25
What's New in RAD Studio (Delphi for RAD Studio (Common) 1.4 Getting Started
Database
Many changes have been made to improve support for database application development in RAD Studio.
ADODbx Client
This implements the ADO.NET 2.0 interface. It replaces BDP.NET, based on ADO.NET 1.1, which is being deprecated. AdoDbx
Client exposes any existing dbExpress 4 driver as an ADO.NET 2.0 provider.
Instructions on connecting and deploying this provider have been included in the summary documentation at the top of the
Borland.Data.AdoDbxClientProvider.pas unit as well as in the product documentation.
DBXClient Driver
DBXClient is a DBX4 driver that remotes the DBX4 framework interface over a pluggable network based transport. In this
release, a TCP/IP transport is supported.
Blackfish SQL
Blackfish SQL is the Delphi for .NET version of JBuilder's JDataStore. Blackfish SQL is a high-performance transactional
database for the .NET platform, and also supports the .NET Compact Framework. Blackfish SQL will hook to ADO.NET 2.0, and
to any DBX4 driver.
Blackfish SQL exposes an API that is documented in a companion help volume. For a high-level summary, see Blackfish SQL
Overview.
26
1.4 Getting Started RAD Studio (Common) What's New in RAD Studio (Delphi for
Blackfish SQL is written entirely in C# and provides the following features and benefits:
ASP.NET Provider
These providers implement the ASP.NET provider model in dbExpress 4 and Blackfish SQL and provide support for
management of machine.config and web.config for updating the provider assemblies. They also provide tooling for creating a
new instance of the provider database for a website.
VCL.NET
New features:
27
What's New in RAD Studio (C++Builder) RAD Studio (Common) 1.4 Getting Started
ECO
ECO now supports VCL.NET in addition to ASP.NET.
ECO online help is now separate from RAD Studio online help.
C++Builder 2007
The following key features are new or significantly changed:
• MSBuild is the new build engine: When you build a C++ project, MSBuild now performs the build process. The structure of
the project file has also changed to XML and now contains the options needed for MSBuild. The project file extension has
changed to .cbproj. You can build projects from the command line using the MSBuild command syntax. For more
information, see MSBuild Overview.
• The Project Options dialog box has been reorganized: New pages have been added to the Project Options dialog box,
and some existing pages have been renamed in order to better organize the options. New options have also been added,
such as —Vb options that support C++ constructs that are no longer supported in the standard. The new Project Properties
page allows you to specify that the C++ compiler is to manage library paths, verify package imports, show header
dependencies, or use auto-dependency checking. For more information, see Setting Project Options ( see page 162). For
information on project options that are no longer available in the IDE, see Unavailable Options ( see page 893).
• You can merge Project Options: Some project options have a Merge check box. When checked, the IDE includes the
option values from the current build configuration's immediate ancestor. The options for the current configuration are not
actually changed. See Project Options ( see page 842) for more information on Merge.
• Build configurations are more extensive: Build configurations have changed. A build configuration contains the options that
you set on many pages of Project Options. Build configurations store sets of command-line options for build tools such as
the compiler, linker, and MSBuild. You can create your own configurations, and there are three default configurations (Base,
Debug, and Release). For more information, see Build Configurations Overview (C++) ( see page 6).
• Named option sets are new: You can create and apply named option sets from the build-related pages of the
Project Options dialog box. Named option sets are saved in files with the extension .optset. For more information, see
Named Option Sets Overview ( see page 7).
• Build order has changed: MSBuild builds files according to file type (extension) rather than the user-modifiable order
previously used. The new build order is Delphi (.pas), C/C++ (.c/.cpp), assembler (.asm), then resource (.rc). Within
each folder or virtual folder, files are built in order according to their file type. For more information, see Overview of Virtual
Folders ( see page 50).
• New Build Configuration Manager activates a build configuration: Use Project Configuration Manager to select the
build configuration that you want to be active for a selected project or projects. The Configuration Manager replaces the
existing way of specifying the active configuration for C++ projects. For more information, see Build Configuration Manager (
see page 828).
• You can specify build events: You can specify commands to execute at specific points in the build process (pre-link events
are new; pre-build and post-build events existed in previous releases). Right-click a buildable file in the Project Manager and
choose Build Events. For more information, see Build Events Dialog ( see page 829).
• You can create and add .targets files to a project: A .targets file is an XML file that can contain MSBuild scripts, such as
lists of tasks to perform. For more information, see Targets files ( see page 8).
• Location of demo code has changed: Demo code is now in MyDocuments\RAD Studio\Demos. Demos were moved out
of the Program Files directory due to Microsoft Vista restrictions.
• You can compile C++ packages with Delphi: C++Builder supports compiling design-time packages that contain Delphi
source files. However, if any of those Delphi sources make reference to IDE-supplied design-time units such as DesignIntf,
DesignEditors, and ToolsAPI that exist in DesignIDE100.bpl, you must take steps to ensure that the references can be
28
1.4 Getting Started RAD Studio (Common) What's New in RAD Studio (C++Builder)
resolved by the C++Builder package. See Compiling C++ Design-Time Packages That Contain Delphi Source ( see page
106) to learn how to do this.
Unit testing for C++
Support for Unit Testing is integrated with the DUnit Testing Framework. The DUnit framework is based on the JUnit test
framework, and shares much of the same functionality.
You can use the C++Builder Unit Testing wizards to quickly generate skeleton templates for the test project, setup and teardown
methods, and basic tests. You can then modify the templates, adding the specific test logic to test your particular methods.
1
You can run tests using either the Console Test Runner or the DUnit GUI Test Runner. The Console Test Runner directs test
output to the Console. The DUnit GUI Test Runner displays test results interactively in a GUI window, with results color-coded to
indicate success or failure.
• unbounded elements
• optional elements
• nullable elements
• WSDL and schema that import external schemas
These enhancements bring C++Builder Web Services support up-to-date with that of Delphi, enabling your applications to
interact with the more robust Web Services like eBay, Amazon, MapPoint, and so forth.
IDE
The following key features are new or significantly changed in the integrated development environment (IDE):
• Vista and XP Themes: The IDE now supports Windows Vista and XP themes. Themes are on by default, but you can disable
themes for either the IDE or for individual applications. For more information, see IDE on Windows Vista ( see page 40).
• Duplicate file names: A project is now allowed to contain any number of files with the same name. For example, you can
have both the files Common\source1.cpp and Product\source1.cpp in your project. The IDE handles generating the object
files so that there is no confusion, and the object from both files is used in building the project.
• Expanded help about the Memory Manager: The new memory manager, released with Borland Developer Studio 2006, is
documented fully in this release of RAD Studio. Topics include: Configuring the memory manager, Monitoring the memory
manager, and Using ShareMem and SimpleShareMem to share the memory manager. The Memory Manager routines and
variables are listed under VCL in this topic. For more information, see Memory Management Overview ( see page 644).
• Multi-select in Project Manager: Hold the CTRL key to multi-select files for the Open, Save, Save As, and Remove from
Project context-menu commands in the Project Manager.
• New File Browser: Use View File Browser to invoke the File Browser to perform basic file commands or to view a file's
SVN status. For more information, see File Browser ( see page 1036).
• New toolbar in the Structure view: A new toolbar available only for C++ allows you to Sort Alphabetically, Group by Type,
Group by Visibility, Show Type, and Show Visibility. For more information, see View>Structure.
• Virtual folders in the Project Manager: You can create virtual associations between items in the tree structure. You can use
virtual folders to influence the build order. For more information, see Overview of Virtual Folders ( see page 50).
Debugger
The following key features are new or significantly changed:
• Prevent scrolling of the event log: A new option on the Tools Options Debugger Options Event Log page prevents
the event log from scrolling new events into view as they occur.
• CPU windows: You can now open individual panes of the CPU window, such as the Disassembly, CPU Stack, and
Registers panes. These single panes of the CPU window are dockable; you can undock the panes and dock them elsewhere
in the IDE according to your needs. The CPU window also now automatically closes when you end the debugging session,
and the Disassembly pane contains two new options (Show Opcodes and Show Addresses). For more information, see
29
What's New in RAD Studio (C++Builder) RAD Studio (Common) 1.4 Getting Started
• C++Builder 2007 provides limited modeling support from Together, the fully integrated modeling tool in the IDE. Note that only
the code visualization (read-only), documentation generation, and diagram printing features are available in C++ Builder 2007,
but the online help describes the full set of Together features.
• C++ Class Diagrams (Code Visualization): The C++ class diagram is only available in read-only mode. You can create
design diagrams in your C++ projects, but you cannot create classes, interfaces, and so forth in the Model View.
• Design Diagrams: The complete set of design diagrams are available only in the Enterprise edition of the product. This
includes sequence diagrams, collaboration diagrams, state charts, deployment diagrams, use case diagrams, activity
diagrams, and component diagrams.
• Printing diagrams and generating documentation: Both the Professional and Enterprise editions support the printing of
diagrams. The Enterprise edition also supports the generation of documentation.
For more information, see Getting Started With Together ( see page 83) or Modeling Applications With Together ( see page
81).
Note: Only specific editions of the product contain all the features described in the Together portions of this help system. The
current release contains a limited set of features.
Database
Many changes have been made to improve support for database application development in RAD Studio.
dbExpress
Unicode support has been added to the Oracle, Interbase, and MySQL dbExpress drivers.
New driver clients have been added: Interbase 2007 and MySQL 4.1 and 5.
A new dbExpress framework has been created. You can use this framework both to interface with existing drivers and to write
new drivers by extending dbExpress framework's abstract classes. You can use the framework directly for both native and
managed applications.
A delegate driver is a driver between the application and the actual driver. Delegate drivers allow for pre and post processing of
all public methods and properties of the dbExpress 4 framework. Delegate drivers are useful for connection pooling, driver
profiling, tracing, and auditing. Sample delegate drivers area provided.
The dbExpress VCL component's API has changed slightly. Most applications are not affected by changes to the dbExpress
VCL. However, there are some methods, properties, events, constants, and enums that were removed or replaced with
equivalent functionality.
You can also use the dbExpress VCL components that are layered on top of the framework for both native and managed
30
1.4 Getting Started RAD Studio (Common) What's New in RAD Studio (C++Builder)
applications. There are some minor API changes in the VCL components to the TSQLConnection class (method changes),
TSQLDataSet (new property), and data structures (some are removed or replaced). See dbExpress Framework Compatibility for
more information.
• Is written entirely in the Delphi language and allows drivers to be written in Delphi.
• Uses strongly typed data access instead of pointers. For instance, the framework uses String types rather than pointers to
strings.
1
• Is single sourced. This means that a single copy of the source can be compiled with either the native DCC32 or managed
DCCIL compilers.
• Has only Abstract base classes that are used for drivers, connections, commands, readers, and so on.
• Uses exception-based error handling rather than returning error codes.
VCL and RTL
New components: The following new components have been added to the Visual Component Library:
AJAX: RAD Studio supports AJAX-based RAD VCL for the Web development.
Microsoft Vista Compatibility: RAD Studio provides components, classes, methods, and properties that are compatible with
the look and feel of the Vista operating system.
New VCL components: The following new classes have been added to the Visual Component Library:
• TFileOpenDialog
• TFileSaveDialog
• TTaskDialog
• TCustomFileDialog
• TCustomFileOpenDialog
• TCustomFileSaveDialog
• TCustomTaskDialog
• TFavoriteLinkItem
• TFavoriteLinkItems
• TFavoriteLinkItemsEnumerator
• TFileTypeItem
• TFileTypeItems
• TTaskDialogBaseButtonItem
• TTaskDialogButtonItem
• TTaskDialogButtons
• TTaskDialogButtonsEnumerator
• TTaskDialogProgressBar
• TTaskDialogRadioButtonItem
New Memory Manager routines and variables: The following new System routines and variables have been added to support
the Memory Manager:
• AttemptToUseSharedMemoryManager
• GetMemoryManagerState
• GetMemoryMap
31
What's New in RAD Studio (Delphi) RAD Studio (Common) 1.4 Getting Started
• GetMinimumBlockAlignment
• RegisterExpectedMemoryLeak
• SetMinimumBlockAlignment
• ShareMemoryManager
• UnregisterExpectedMemoryLeak
• NeverSleepOnMMThreadContention
1 • ReportMemoryLeakOnShutdown
See Also
MSBuild Overview ( see page 4)
dbExpress Framework
IDE
• MSBuild: The IDE now supports the MSBuild build engine instead of the previous internal make system. When you open a
pre-existing project, the IDE automatically converts the project to the MSBuild format and changes the project extension. You
can also use the MSBuild Console (on the Start menu) or MSBuild.exe to build projects from the command line.
• Build events: You can specify both DOS commands and macros that are to be performed either before or after compiling
your project.
• Build Configurations: You can now create named build configurations on the Project Options window. To apply a named
build configuration to a project or project group, use the new Build Configuration Manager, available on the Project menu.
• Vista and XP Themes: The IDE now supports Vista and XP themes. Themes are on by default, but you can disable themes
for either the IDE or for individual applications.
• Multi-select in Project Manager: You can select multiple files for commands such as Open, Save, Save As, and Remove
from Project in the Project Manager context menu.
• New File Browser: You can invoke the new File Browser to view files on disk and interact with the Windows shell.
Debugger
• Prevent scrolling of the event log: A new option on the Tools Options Debugger Options Event Log page prevents
32
1.4 Getting Started RAD Studio (Common) What's New in RAD Studio (Delphi)
the event log from scrolling new events into view as they occur.
• CPU windows: You can now open individual panes of the CPU window, such as the Disassembly, CPU Stack, and
Registers panes. These single panes of the CPU window are dockable; you can undock the panes and dock them elsewhere
in the IDE according to your needs. The CPU window also now automatically closes when you end the debugging session,
and the Disassembly pane contains two new options (Show Opcodes and Show Addresses).
• Call Stack Window: You can now set a breakpoint on a particular frame.
• Ignore non-user breakpoints: You can now specify that the debugger is to ignore breakpoints that you did not specifically
set using the IDE. 1
• Debug Source Path: The source path for debugging is now a global setting that you create on the
Project Options Debugger page.
• New toolbar button: The Notify on Language Exceptions command is now an icon on the
View Toolbars Customize Categories Run page. You can click and drag the icon to your toolbar for quick access.
• Transparent tooltips: To make a debugger evaluator tooltip transparent, press the CTRL key when the tooltip is displayed.
Making a tooltip transparent enables you to read the screen behind the tooltip.
Database
Many changes have been made to improve support for database application development in RAD Studio.
dbExpress
Unicode support has been added to the Oracle, Interbase, and MySQL dbExpress drivers.
New driver clients have been added: Interbase 2007 and MySQL 4.1 and 5.
A new dbExpress framework has been created. You can use this framework both to interface with existing drivers and to write
new drivers by extending dbExpress framework's abstract classes. You can use the framework directly for both native and
managed applications.
A delegate driver is a driver between the application and the actual driver. Delegate drivers allow for pre and post processing of
all public methods and properties of the dbExpress 4 framework. Delegate drivers are useful for connection pooling, driver
profiling, tracing, and auditing. Sample delegate drivers area provided.
The dbExpress VCL component's API has changed slightly. Most applications are not affected by changes to the dbExpress
VCL. However, there are some methods, properties, events, constants, and enums that were removed or replaced with
equivalent functionality.
You can also use the dbExpress VCL components that are layered on top of the framework for both native and managed
applications. There are some minor API changes in the VCL components to the TSQLConnection class (method changes),
TSQLDataSet (new property), and data structures (some are removed or replaced). See dbExpress Framework Compatibility for
more information.
• is written entirely in the Delphi language and allows drivers to be written in Delphi.
• uses strongly typed data access instead of pointers. For instance, the framework uses String types rather than pointers to
strings.
• is single sourced. This means that a single copy of the source can be compiled with either the native DCC32 or managed
DCCIL compilers.
• has only Abstract base classes that are used for drivers, connections, commands, readers, and so on.
• uses exception-based error handling rather than returning error codes.
VCL
AJAX: RAD Studio supports AJAX-based RAD VCL for the Web development.
Microsoft Vista Compatibility: RAD Studio provides components, classes, methods, and properties that are compatible with
33
Tour of the IDE RAD Studio (Common) 1.4 Getting Started
New components: The following new components have been added to the Visual Component Library:
• TFileOpenDialog
• TFileSaveDialog
• TTaskDialog
New classes: The following new classes have been added:
1
• TCustomFileDialog
• TCustomFileOpenDialog
• TCustomFileSaveDialog
• TCustomTaskDialog
• TFavoriteLinkItem
• TFavoriteLinkItems
• TFavoriteLinkItemsEnumerator
• TFileTypeItem
• TFileTypeItems
• TTaskDialogBaseButtonItem
• TTaskDialogButtonItem
• TTaskDialogButtons
• TTaskDialogButtonsEnumerator
• TTaskDialogProgressBar
• TTaskDialogRadioButtonItem
See Also
MSBuild Overview ( see page 4)
Disabling Themes for the IDE and for the Application ( see page 157)
The default IDE desktop layout includes some of the most commonly used tools. You can use the View menu to display or hide
certain tools. You can also customize and save the desktop layouts that work best for you.
The tools available in the IDE depend on the edition of RAD Studio you are using and include the following:
• Welcome Page
34
1.4 Getting Started RAD Studio (Common) Tour of the IDE
• Accessibility Options
• Forms
• Form Designer
• Tool Palette
• Object Inspector
• Object Repository
• Project Manager 1
• Data Explorer
• Structure View
• History Manager
• Code Editor
• File Browser
• Themes for Windows Vista
The following sections describe each of these tools.
Themes for Windows Vista
The IDE uses Windows Vista or Windows XP themes. If you prefer the classic look in the IDE and in your application, you can
turn off theming on the Project Options dialog box.
Welcome Page
When you open RAD Studio, the Welcome Page appears with a number of links to developer resources, such as
product-related articles, training, and online Help. As you develop projects, you can quickly access them from the list of recent
projects at the top of the page. If you close the Welcome Page, you can reopen it by choosing View Welcome Page.
Accessibility Options
The IDE's main menu supports MS Active Accessibility (MSAA). This means that you can use the Windows accessibility tools
from the Start Menu via All Programs Accessories Accessibility.
Forms
Typically, a form represents a window or HTML page in a user interface. At design-time, a form is displayed on the Designer
surface. You add components from the Tool Palette to a form to create your user interface.
RAD Studio provides several types of forms, as described in the following sections. Select the form that best suits your
application design, whether it’s a Web application that provides business logic functionality over the Web, or a Windows
application that provides processing and high-performance content display. To switch between the Designer and Code Editor,
click their associated tabs below the IDE.
Windows Forms
Use Windows Forms to build native Windows applications that run in a managed environment. You use the .NET classes to build
Windows clients, which presents two major advantages—it allows application clients to use features unavailable to browser
clients, and it leverages the .NET Framework infrastructure. Windows Forms present a programming model that takes advantage
of a unified .NET Framework (for security and dynamic application updates, for instance) and the richness of GUI Windows
clients. You use Windows controls, such as buttons, list boxes, and text boxes, to build your Windows applications.
To access a Windows Form, choose File New Other Delphi for .NET Projects Windows Forms Application.
35
Tour of the IDE RAD Studio (Common) 1.4 Getting Started
VCL Forms
Use VCL Forms to create native applications using VCL components or to create applications that use VCL.NET components to
run in the .NET Framework.
VCL Forms are useful if you want to port an existing Delphi application containing VCL controls to the .NET environment, or if
you are already familiar with the VCL and prefer to use it.
1 You use the classes in the CodeGear Visual Component Library for .NET to create a VCL Forms application.
To access a VCL Forms, choose File New Other VCL Forms Application.
To access an ASP.NET Web Form, choose File New Other Delphi for .NET Projects Windows Forms Application.
Form Designer
The Form Designer, or Designer, is displayed automatically in the center pane when you are using a form. The appearance and
functionality of the Designer depends on the type of form you are using. For example, if you are using an ASP.NET Web Form,
the Designer displays an HTML tag editor. To access the Designer, click the Design tab at the bottom of the IDE.
Visual Components
Visual components appear on the form at design-time and are visible to the end user at runtime. They include such things as
buttons, labels, toolbars, and listboxes.
Form Preview
A preview icon at the bottom right of the Designer (for VCL Forms) shows the positioning of your form as it appears on the
screen at runtime. This allows you to position the forms of your application in relation to each other as you design them.
HTML Designer
Use the HTML Designer to view and edit ASP.NET Web Forms or HTML pages. This Designer provides a Tag Editor for editing
HTML tags alongside the visual representation of the form or page. You can also use the Object Inspector to edit properties of
the visible items on the HTML page and to display the properties of any current HTML tag in the Tag Editor. A combo box
located above the Tag Editor lets you display and edit SCRIPT tags.
To create a new HTML file, choose File New Other Web Documents HTML Page.
When you add a nonvisual component to a form, it is displayed in the component tray at the bottom of the Designer surface. The
component tray lets you distinguish between visual and nonvisual components.
Design Guidelines
If you are creating components for a form, you can register an object type and then indicate various points on or near a
component's bounds that are "alignment" points. These "alignment" points are vertical or horizontal lines that cut across a visual
control's bounds.
36
1.4 Getting Started RAD Studio (Common) Tour of the IDE
When you have the alignment points in place, you can supply UI guideline information so that each component adheres to rules
such as distance between controls, shortcuts, focus labels, tab order, maximum number of items (listboxes, menus), etc. In this
way, the Form Designer can assist the Code Developer in adhering to established UI guidelines.
If the Snap to Grid option is enabled, and Use Designer Guidelines is also enabled, the designer guidelines take precedence.
This means that if a grid point is within the tolerance of the new location and a guideline is also within that distance away, then
the control snaps to the guideline instead of the grid position, even if the guideline does not fall on the grid position. The snap
tolerance is determined by the grid size. Even if the Snap to Grid and Show Grid options are disabled, the Designer still uses the
grid size in determining the tolerance. 1
This feature is currently only available in VCL and VCL.NET only (This includes C++). See the link at the end of this topic for
more information about setting Designer Guidelines.
Tool Palette
The Tool Palette, located on the right-hand column, contains items to help you develop your application. The items displayed
depend on the current view. For example, if you are viewing a form on the Designer, the Tool Palette displays components that
are appropriate for that form. You can double-click a control to add it to your form. You can also drag it to a desired position on
the form. If you are viewing code in the Code Editor, the Tool Palette displays code segments that you can add to your
application.
Customized Components
In addition to the components that are installed with RAD Studio, you can add customized or third party components to the Tool
Palette and save them in their own category.
Component Templates
You can create templates that are made up of one or more components. After arranging components on a form, setting their
properties, and writing code for them, you can save them as a component template. Later, by selecting the template from the
Tool Palette, you can place the preconfigured components on a form in a single step; all associated properties and
event-handling code are added to your project at the same time. You can reposition the components independently, reset their
properties, and create or modify event handlers for them just as if you had placed each component in a separate operation.
Object Inspector
The Object Inspector, located on the left, lets you set design time properties and create event handlers for components. This
provides the connection between your application’s visual appearance and the code that makes the application run. The Object
Inspector contains two tabs: Properties and Events.
Use the Properties tab to change physical attributes of your components. Depending on your selection, some category options
let you enter values in a text box while others require you to select values from a drop-down box. For Boolean operations, you
toggle between True or False. After you change your components’ physical attributes, you create event handlers that control how
the components function.
Use the Events tab to specify the events for a specific object you select. If there is an existing event handler, use the drop-down
box to select it. By default, some options in the Object Inspector are collapsed. To expand the options, click the plus sign (+)
next to the category.
Certain nonvisual components, for example, the Borland Data Providers, allow quick access to editors such as the Connection
Editor and Command Text Editor. You can access these editors in the Designer Verb area at the bottom of the Object
Inspector. To open the editors, place your cursor over the name of the editor until your cursor changes into a hand and the
editor turns into a link. Alternatively, you can right-click the nonvisual component, scroll down to its associated editor and select
it. Note that not all nonvisual components have associated editors. In addition to editors, this area can also display hyperlinks to
show custom component editors, launch a web page, and show dialog boxes.
37
Tour of the IDE RAD Studio (Common) 1.4 Getting Started
Object Repository
To simplify development, RAD Studio offers pre-designed templates, forms, and other items that you can access and use in your
application.
To open the Object Repository , choose File New Other. A New Items dialog box appears, displaying the contents of the
Object Repository . You can also edit or remove existing objects from the Object Repository by right-clicking the Object
Repository to view your editing options.
You can add a starter project, demo, template, or other useful file to the Object Repository and then make it available through
the New menu. Choose Project Add to Repository. Select your file. Now when you select the FileNew command, you can
choose the file you just added and work with a new copy of it.
RAD Studio allows you to create multiple custom template libraries to use as the basis for creating future projects. Template
libraries let you to declare how projects can look, and they enable you to add new types of projects to the Object Repository.
Project Manager
A project is made up of several application files. The Project Manager, located in the top right-hand column, lets you view and
organize your project files such as forms, executables, assemblies, objects, and library files. Within the Project Manager, you
can add, remove, and rename files. You can also combine related projects to form a project group, which you can compile at the
same time.
Add References
You can integrate your legacy COM servers and ActiveX controls into managed applications by adding references to unmanaged
DLLs to your project and then browse the types, just as you would with managed assemblies. Choose Project Add Reference
to integrate your legacy COM servers or ActiveX controls. Alternatively, right-click the Reference folder in the Project Manager
and click Add Reference. You can add other .NET assemblies, COM/ActiveX components, or type libraries using the Add
Reference feature.
• If the reference is to an assembly created in another project, select the Copy Local setting.
• If the assembly is in the GAC, do not select the Copy Local setting.
38
1.4 Getting Started RAD Studio (Common) Tour of the IDE
Once you import the WSDL document, RAD Studio generates all the interfaces and class definitions you need for calling that
Web Service. To use the Add Web Reference feature, from your Project Manager, right-click the Web Services node.
Data Explorer
The Data Explorer lets you browse database server-specific schema objects, including tables, fields, stored procedure
definitions, triggers, and indexes. Using the context menus, you can create and manage database connections. You can also
drag and drop data from a data source to most forms to build your database application quickly.
Structure View 1
The Structure View shows the hierarchy of source code or HTML displayed in the Code Editor, or components displayed on
the Designer. When displaying the structure of source code or HTML, you can double-click an item to jump to its declaration or
location in the Code Editor. When displaying components, you can double-click a component to select it on the form.
If your code contains syntax errors, they are displayed in the Errors folder in the Structure View. You can double-click an error
to locate its source in the Code Editor.
You can control the content and appearance of the Structure View by choosing Tools Options Environment
Options Explorer and changing the settings.
History Manager
The History Manager, located in the center pane, lets you see and compare versions of a file, including multiple backup
versions, saved local changes, and the buffer of unsaved changes for the active file. If the current file is under version control, all
types of revisions are available in the History Manager. The History Manager is displayed to the right of the Code tab and
contains the following tabbed pages:
• The Contents page displays current and previous versions of the file.
• The Diff page displays differences between selected versions of the file.
• The Info page displays all labels and comments for the active file.
You can use the History Manager toolbar to refresh revision information, revert a selected version to the most current version,
and synchronize scrolling between the source viewers in the Contents or Diff pages and the Code Editor and for window
navigation (such as Go to next diff).
Code Editor
The Code Editor, located in the center pane, provides a convenient way to view and modify your source code. It is a
full-featured, customizable, UTF8 editor that provides refactoring, automatic backups, Code Insight, syntax highlighting, multiple
undo capability, context-sensitive Help, Live Templates, Smart Block Completion, Find Class, Find Unit/Import Namespace, and
more. Choose the Code Editor link in the section below to view descriptions for each of these Code Editor features.
File Browser
You can perform basic file operations using the File Browser, a dockable Windows style browser pane. Open the File Browser
to search, rename, or perform source control operations on a file.
To perform an operation on a file, choose View File Browser, browse to the file, right-click the file, and select the operation to
perform.
See Also
Starting a Project ( see page 47)
39
IDE on Windows Vista RAD Studio (Common) 1.4 Getting Started
You can also upgrade existing Message, File, and Save dialogs to the newer Vista dialogs by setting the
UseLatestCommonDialogs flag. If the flag is set, and you are running Vista, and you have theming enabled, the old-style
dialogs will be promoted to Vista-style dialogs. If these conditions are false, Task dialogs are downgraded to Message dialogs.
Vista-style File and Save dialogs do not share all of the functionality of the old File and Save dialogs, however, so the IDE
provides upgrade capability but no downgrade capability for these controls.
Task dialog boxes include all the functionality of the old Message dialog as well as the following new features and controls:
40
1.4 Getting Started RAD Studio (Common) Code Editor
Themed versions have some differences from unthemed versions, such as no support for OnShow, IncludeItem, or OnClose
events. The new file dialogs do not support custom help but do support Microsoft help.
To upgrade existing projects to use themes, set the Vista flag On. This is a one-way setting; you cannot downgrade to the classic
look after upgrading to themes. 1
By default, themes are On in the IDE and in your application, but you can disable the use of themes.
Windows can either have a customizable glass frame or become completely translucent with the SheetOfGlass property.
Controls in a glassed area can be difficult to see unless you set the DoubleBuffered property.
Many controls available in RAD Studio support glass, but some do not.
See Also
MSBuild Overview ( see page 4)
Disabling Themes in the IDE and in the Application ( see page 157)
See Also
Data Explorer ( see page 1034)
41
Code Editor RAD Studio (Common) 1.4 Getting Started
1 As you design the user interface for your application, RAD Studio generates the underlying code. When you modify object
properties, your changes are automatically reflected in the source files.
Because all of your programs share common characteristics, RAD Studio auto-generates code to get you started. 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:
• Change Bars
• Code Insight
• Code Completion
• Code Browsing
• Help Insight
• Live Templates
• Code Folding
• Refactoring
• Sync Edit
• To-Do Lists
• Keystroke Macros
• Bookmarks
• Block comments
• Template Libraries
Change Bars
The left margin of the Code Editor displays a green change bar to indicate lines that have not been changed in the current
editing session. A yellow change bar indicates that changes have been made since the last File->Save operation.
You can, however, customize the change bars to display in colors other than the default green and yellow.
Code Insight
Code Insight refers to a subset of features embedded in the Code Editor (such as Code Parameter Hints, Code Hints, Help
Insight, Code Completion, Class Completion, Block Completion, and Code Browsing) that aid in the code writing process. These
features help identify common statements you wish to insert into your code, and assist you in the selection of properties and
methods. Some of these features are described in more detail in the sub-sections below.
To invoke Code Insight, press CTRL+SPACE while using the Code Editor. A pop-up window displays a list of symbols that are
valid at the cursor location.
To enable and configure Code Insight features, choose Tools Options Editor Options and click Code Insight.
When you're using the Delphi Language, the pop-up window filters out all interface method declarations that are referred to by
property read or write clauses. The window displays only properties and stand-alone methods declared in the interface type.
Code insight supports WM_xxx, CM_xxx, and CN_xxx message methods based on like named constants from all units in the
uses clause.
42
1.4 Getting Started RAD Studio (Common) Code Editor
Code Hints
Display a hint containing information about the symbol such as type, file and line # declared at.
1
You can display Code Hints by hovering the mouse over an identifier in your code, while working in the Code Editor.
Note: Code Hints only work when you have disabled the Help Insight feature.
Help Insight
Help Insight displays a hint containing information about the symbol such as type, file, line # declared at, and any XML
documentation associated with the symbol (if available).
Invoke Help Insight by hovering the mouse over an identifier in your code, while working in the Code Editor. You can also invoke
Help Insight by pressing CTRL+SHIFT+H.
Code Completion
The Code Completion feature displays a drop-down list of available symbols at the current cursor location. You invoke Code
Completion for your specific language in the following way:
C# — CTRL + SPACE + .
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. They are also on the editor context menu.
Block Completion
When you press ENTER while working in the Code Editor and there is a block of code that is incorrectly closed, the Code Editor
enters the closing block token at the next available empty line after the current cursor position. For instance, if you are using the
Code Editor with the Delphi language, and you type the token begin and then press ENTER, the Code Editor automatically
completes the statement so that you now have: begin end; . This feature also works for the C# and C++ languages.
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:
43
Code Editor RAD Studio (Common) 1.4 Getting Started
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 Environment Options Delphi Options for Delphi).
The Library path is searched only if there is no project open in the IDE.
Code Navigation
The sections below describe features that you can use to navigate through your code while you are using the Code Editor.
1
Method Hopping
You can navigate between methods using a series of editor hotkeys. You can also lock the hopping to occur only within the
methods of the current class. For example, if class lock is enabled and you are in a method of TComponent, then hopping is only
available within the methods of TComponent.
Finding Classes
Allows you to find classes (using C# regular expressions). Use the Search Find Class... command to see a list of available
classes that you can select. After you choose one, the IDE navigates to its declaration.
Finding Units
Depending on which language you are programming in, you can use a refactoring feature to locate namespaces or units. If you
are using C#, you can use the Use the Import Namespace command to import namespaces into your code. If you are using the
Delphi language, you can use the Find Unit... command to locate and add units to your code file. For code that is written using
the .NET framework, the Assembly Browser opens if the expression is not found. The Assembly Browser allows you to browse
for a type. The Find Type window allows regular expressions.
Live Templates
Live Templates allow you to have a dictionary of pre-written code that can be inserted into your programs while you're working
with the Code Editor. This reduces the amount of typing that you must do.
Use the links at the end of this topic to learn more about creating and using Live Templates.
Code Folding
Code folding lets you collapse sections of code to create a hierarchical 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.
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. The IDE 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 refactoring methods, such as renaming a symbol and
44
1.4 Getting Started RAD Studio (Common) Form Designer
SyncEdit
The Sync Edit feature lets you simultaneously edit identical identifiers in code. As you change the first identifier, the same
change is performed automatically on the other identifiers. You can also set jump points to navigate to specific sections of your
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, 1
add it to your code as a comment, indicate that it has been completed, and then 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 the left gutter of the Code Editor.
Block Comments
You can comment-out 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 is ignored by the compiler. Pressing CTRL+/ adds or removes 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.
See Also
Customizing Code Editor ( see page 141)
45
Form Designer RAD Studio (Common) 1.4 Getting Started
1 The appearance and functionality of the Designer depends on the type of form you are creating or editing. For example, if you
are using an HTML Element, you can display the HTML Tag Editor in the Designer by selecting View Tag Editor.
Visual Components
You can add Visual components to your form, by dragging them from the Tool Palette, in the lower-right section of the IDE, onto
the form you are creating. These are the components that will be visible to the end user at runtime. The objects on the Tool
Palette change dynamically, depending on the type of application or form you are designing.
The tool palette includes controls such as buttons, labels, toolbars, and listboxes for each of the various tool categories; types of
applications if you're working at the project level, such as DLL wizards, console or logo applications; and web controls, HTML
elements, and data components when you're working on a web application.
Form Preview
A preview icon at the bottom right of the Designer (for VCL Forms) shows the positioning of your form as it will appear on the
screen at runtime. This allows you to position the forms of your application in relation to each other as you design them.
When you add an nonvisual component to a form, they are displayed in the component tray at the bottom of the Designer
surface. The component tray lets you distinguish between visual and nonvisual components.
HTML Designer
Use the HTML Designer to view and edit ASP.NET Web Forms or HTML pages. You can change the default layout in the HTML
Designer to be either 'Grid Layout' or 'Flow Layout'. Choose Tools Options and then select HTML/ASP.NET Options from the
tree on the left side. Now you will see the Default Page Layout Options that allows you to select either the Grid Layout or Flow
Layout radio button option. This Designer provides a Tag Editor for editing HTML tags alongside the visual representation of the
form or page. You can also use the Object Inspector to edit properties of the visible items on the HTML page and to display the
properties of any current HTML tag in the Tag Editor. A combo box located above the Tag Editor lets you display and edit
SCRIPT tags.
To create a new HTML file, choose File New Other Web Documents HTML Page.
Design Guidelines
If you are creating components for a form, you can register an object type and then indicate various points on or near a
component's bounds that are "alignment" points. These "alignment" points are vertical or horizontal lines that cut across the
bounds of a visual control.
When you have the alignment points in place, you can supply UI guideline information so that each component will adhere to
rules such as distance between controls, shortcuts, focus labels, tab order, maximum number of items (listboxes, menus), etc. In
this way, the Form Designer can assist the Code Developer in adhering to established UI guidelines.
If the Snap to Grid option is enabled, and Use Design Guidelines is also enabled, the design guidelines will take precedence.
This means that if a grid point is within the tolerance of the new location and a guideline is also within that distance away, then
the control will snap to the guideline instead of the grid position, even if the guideline does not fall on the grid position. The snap
46
1.4 Getting Started RAD Studio (Common) Starting a Project
tolerance is determined by the grid size. Even if the Snap to Grid and Show Grid options are disabled, the Designer will still use
the grid size in determining the tolerance.
This feature is currently only available in VCL and VCL.NET only (This includes C++). See the link at the end of this topic for
more information about setting up Design Guidelines.
See Also
Starting a Project ( see page 47)
To create a project, click New from the Welcome Page and select the type of application you want to create, or choose
File New Other. To open an existing project, click Project from the Welcome Page or choose File Open Project.
• Types of projects
• Working with unmanaged code
Type of Projects
Depending on the edition of RAD Studio that you are using, you can create traditional Windows applications, ASP.NET Web
applications, ADO.NET database applications, Web Services applications, and many others. RAD Studio also supports
assemblies, custom components, multi-threading, and COM. For a list of the features and tools included in your edition, refer to
the feature matrix on either the CodeGear Delphi web page or the CodeGear C#Builder web page.
Windows Applications
You can create Windows applications using the VCL to provide processing and high-performance content display. In addition to
traditional uses for Windows applications, a Windows application can be used with constructs from the .NET framework. For
instance, a Windows application can function as a front end to an ADO.NET database.
In addition to drag and drop components and visual designers, CodeGear provides an easy way to create application menus and
submenus. The .NET Menu Designers MainMenu and ContextMenu are components that work like editors to let you visually
47
Starting a Project RAD Studio (Common) 1.4 Getting Started
RAD Studio simplifies the creation of Web Services by providing methods for creating a SOAP Server application. The .asmx
1 and .dll files are created automatically, and you can test the Web Service within the IDE, without writing a client application for
it.
When writing a client application that uses, or consumes, a published Web Service, you can use the UDDI Browser to locate and
import WSDL that describes the Web Service into your client application.
VCL.NET Applications
You can use VCL Forms to create a .NET Windows application that uses components from the VCL.NET framework.
RAD Studio simplifies the task of building .NET-enabled applications by supporting VCL components that have been augmented
to run on the .NET Framework. This eliminates the need for you to create custom components to provide standard VCL
component capabilities. This makes the process of porting Win32 applications to .NET much simpler and more reliable.
Database Applications
Whether your application uses Web Forms or VCL Forms, RAD Studio has several tools that make it easy to connect to a
database, browse and edit a database, execute SQL queries, and display live data at design time.
dbExpress allows you to connect to Interbase, Oracle, MS SQL, Informix, DB2, Sybase, and MySQL databases. You can also
write database drivers by extending the classes in the dbExpress framework. You can use both native and managed code.
The ADO.NET framework data providers let you access MS SQL, Oracle, and ODBC and OLE DB-accessible databases. The
Borland Data Providers (BDP.NET) let you access MS SQL, Oracle, DB2, and InterBase databases. You can connect to any of
these data sources, expose their data in datasets, and use SQL commands to manipulate the data. Using BDP.NET provides the
following advantages:
• Portable code that's written once and connects to any supported database.
• Open architecture that allows you to provide support for additional database systems.
• Logical data types that map easily to .NET native types.
• Consistent data types that map across databases, where applicable.
• Unlike OLE DB, there is no need for a COM/Interop layer.
When using VCL Forms and the VCL.NET framework components, you can extend database support even further by using the
BDE.NET, dbExpress.NET, and Midas Client for .NET connection technologies.
Model-Driven Applications
Modeling is a term used to describe the process of software design. Developing a model of a software system is roughly
equivalent to an architect creating a set of blueprints for a large development project. Like a set of blueprints, a model not only
depicts the system as a whole, but also allows you to focus in on specifics such as structural and behavioral details. Abstracted
away from any particular programming language (and at some levels, even from specific technology), the model allows all
participants in the development cycle to communicate in the same language.
CodeGear's Model Driven Architecture (MDA) describes an approach to software engineering where the modeling tools are
completely integrated within the development environment itself. The MDA is designed around CodeGear’s Enterprise Core
Objects (ECO) framework. The ECO framework is a set of interface, classes, and custom attributes that provide the
communication conduit between your application and the modeling-related features of the IDE.
48
1.4 Getting Started RAD Studio (Common) Template Libraries
• Automatic mapping of the model classes, with their attributes and relationships, to a relational schema.
• Automatic evolution of schema when the model changes.
• Specification of the persistence backend. You can choose to store objects in a relational database or in an XML file.
• Design-time structural validation of the model and its Object Constraint Language (OCL) expressions.
• Runtime validation of the OCL expressions.
• An event mechanism that allows you to receive notifications whenever objects are added, changed, or removed.
1
RAD Studio IDE leverages the ECO framework to provide an integrated surface on which to develop your application model. The
IDE and its modeling surface features include:
• Creating model-driven applications as a new kind of project.
• Creating class diagrams, and manipulating model elements (packages, and classes) directly on the surface.
• Adding, removing, and changing class attributes and methods on the class diagram.
• Two-way updating between source code and the modeling surface. Changes in source code are reflected in the graphical
depiction, and vice versa.
• Two-way navigating between model elements and source code. You can navigate from the graphical depiction of a model
element directly to its corresponding source code. Similarly, you can navigate from a modeled class in source code directly to
its graphical diagram on the modeling surface.
• Exporting and importing models using XMI 1.1.
Note: Not all modeling features are available in all editions of RAD Studio. To determine the modeling features supported in
your product edition, refer to the feature matrix on either the CodeGear Delphi web page or the CodeGear C#Builder web
page.
Assemblies
An assembly is a logical package, much like a DLL file, that consists of manifests, modules, portable executable (PE) files, and
resources (.html, .jpeg, .gif) and is used for deployment and versioning. An application can have one or more assemblies
that are referenced by one or more applications, depending on whether the assemblies reside in an application directory or in a
global assembly cache (GAC).
Additional Projects
In addition to the project types described above, RAD Studio provides templates to create class libraries, control libraries,
console applications, Visual Basic applications, reports, text files, and more. These templates are stored in the Object
Repository and you can access them by choosing File New Other.
See Also
Creating a Project ( see page 155)
49
Overview of Virtual Folders RAD Studio (Common) 1.4 Getting Started
1. First, you create a RAD Studio project to use as the basis for the template, and an XML file with a .bdstemplatelib
extension that describes the project. This project can be any kind of project that RAD Studio supports.
2. Next, you add the project to the list of template libraries in the IDE by pointing to the .bdstemplatelib template library file
in the Template Libraries dialog box, accessed with Tools Template Libraries.
Adding a template library does not create a project. It simply adds metadata information to the development environment that
tells the IDE how you create this kind of project, and it adds an icon for it to the specified New Items dialog box page. Once
the custom template library is in the New Items dialog box, you can use it to create a new project.
You can create your own template libraries, and you can use those created by other developers. RAD Studio delivers a default
template library which cannot be removed, however you can add and remove custom template libraries.
Note: When creating a project to use with a template library, make sure the project is located in a subdirectory that contains
no other projects. All of the files that are in the project should be located within the subdirectory or child subdirectories.
You can either create a single .bdstemplatelib template library file for each template library project, or list several related
template projects in the same .bdstemplatelib template library file by assigning each project a separate unique item
number.
See Also
Creating Template Libraries ( see page 138)
Virtual folders can only contain file system entries or other virtual folders. Virtual folders can be reordered within the project, be
renamed, and be deleted. Deleting a virtual folder does not delete the contained files--they simply resume their normal Project
Manager location prior to their inclusion in the virtual folder.
Note that changing the order of entries in a virtual folder changes the build order of the contained buildable entries. In general,
the order files appear in the project manager specifies the order in which they are built. All files that are processed by a tool are
built in batches — each type is done separately. The file type processing order is:
• Delphi (.pas)
• C/C++ (.c/.cpp)
• Assembler (.asm)
• Resource (.rc)
In other words, all Delphi files are compiled first, then C/C++ files in the order they appear in the project manager, and so on.
You can drag any file entry in the Project Manager into and out of any virtual folder in the project. You can also right-click a
virtual folder and use the context menu commands to add items to the virtual folder.
50
1.4 Getting Started RAD Studio (Common) Help on Help
See Also
Using Virtual Folders ( see page 167)
Additionally, the persistent navigation panes in the Help window make it easier to locate and filter information. By default, no filter
is set, allowing you to view all of the installed Help. However, to narrow the focus when searching the Help or using the index,
use the Filter by: drop-down list on the Content, Search, and Index panes. To display the navigation panes, use the
View Navigation menu command.
Tip: When navigating to a topic by using a link from another topic, the context of the topic you are viewing might not be obvious.
To find the context of that topic within the Content
pane, click the Sync Contents button on the toolbar of the CodeGear Help viewer.
Conceptual Overviews
The conceptual overviews provide information about product architecture, components, and tools that simplify development. If
you are new to a particular area of development, such as modeling or ADO.NET, see the overview topic at the beginning of each
section in the online Help.
At the end of most of the overviews, you will find links to related, more detailed information. Icons are used to indicate that a link
leads to the .NET SDK, partner Help, or to a web site. The icons are explained later in this topic.
Procedures (How-To)
The how-to procedures provide step-by-step instructions. For development tasks that include several subtasks, there are core
procedures, which include the subtasks required to accomplish a larger task. If you are beginning a development project and
want to know what steps are involved, see the core procedure for the area you are working on. In addition to the core
procedures, there are several single-task procedures.
All the procedures are listed under Procedures in the Content pane of the Help window. Additionally, most of the conceptual
overviews provide links to the pertinent procedures.
Reference Topics
The reference topics provides detailed information on subjects such as API elements, the Delphi language, and compiler
directives.
All of the reference topics are located under Reference in the Content pane of the Help window. Additionally, most API
51
Code Completion RAD Studio (Common) 1.4 Getting Started
references are underlined and link directly to the appropriate reference topic.
• In the Code Editor, select and highlight the entire element, such as a namespace, keyword, or method
• On a form Design tab, select the component
Typographic conventions
See Also
Microsoft Help on Help
52
1.4 Getting Started RAD Studio (Common) Code Completion
Automatic code completion is on by default. Options for enabling and disabling Code Completion are located on the Code
Insight page of the Tools->Options->Editor Options dialog box.
• To display the properties, methods, and events available in a class, press Ctrl+Space after the name of a variable that
represents either a class instance or a pointer to a class instance.
• To invoke code completion for a pointer type, the pointer must first be dereferenced. For example, type:self.in Delphi, or
this-> in C++.
• Type an arrow for a pointer to an object.
• You can also type the name of non-pointer types followed by a period (.) to see the list of inherited and virtual properties,
methods, and events.
• For example, in Delphi type: TRect test; test. In C++, type: var test: TRect; <br>: <br>: <br>begin test..
• Type an assignment operator or the beginning of an assignment statement, and press Ctrl+Space to display a list of
possible values for the variable.
• Type a procedure, function, or method call and press Ctrl+Space to display a list of arguments that are valid for assignment to
the variable entered. Select a list item followed by an ellipsis (…) to open a second list of related arguments compatible with
the variable entered in the assignment statement.
• Type a record (in Delphi) or a structure (in C++) to display a list of fields.
• Type an array property (not a genuine array), and press Ctrl+Space to display an index expression.
• In C++, you can also press Ctrl+Space on a blank statement line to display symbols from additional RTL units even if they
are not used by the current unit.
Browsing to a Declaration
When the Code Completion list is displayed, you can hold down Ctrl and click any identifier in the list to browse to its
declaration.
Also, if you hover the mouse pointer over the identifier in the Code Editor, a hint window tells where the identifier is declared.
You can press Ctrl, point to the identifier in the code (it changes to blue underline, by default, and the insertion point changes
to a hand pointing), and then click to move to its declaration.
Note: Code Insight works only in the compilation unit. Code Completion supports WM_xxx, CM_xxx, and CN_xxx message
methods based on like named constants from all units in the uses clause.
Note: For C++, Code Completion features work best when you have already built your application and have created a
precompiled header. Otherwise, you need to wait for the compiler to generate the required information. It is recommended that
you check the Use pre-compiled headers
53
Code Completion RAD Studio (Common) 1.4 Getting Started
See Also
Code Editor ( see page 42)
54
1.5 Refactoring Applications RAD Studio (Common)
55
RAD Studio (Common) 1.5 Refactoring Applications
Extract Resource String (Delphi) ( see page 62) Extracting resource strings helps centralize string definitions which can then be
more easily translated, if necessary. You can extract string values to resource
strings that are defined in the resourcestring section of your code file. If there is
no resourcestring section in your code, the refactoring engine creates one
following either the implementation keyword or the uses list.
You cannot create a resource string from the following elements:
• Declare Variable
• Initial Type Suggestion
• Declare Field
Declare Variable ( see page 64) Refactor Declare Variable
Use this dialog box to declare a local variable in a procedure. If the cursor in the
Code Editor is not positioned on an undeclared variable, the
Refactor Declare Variable command in unavailable.
Extract Method ( see page 64) Refactor Extract Method
Turns a selected code fragment into a method. RAD Studio 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.
Find References Overview (Delphi, C#, C++) ( see page 65) Sometimes, you may not want to change code, but want to find references to a
particular identifier. The refactoring engine provides Find References, Find
Local References, and Find Declaration Symbol commands.
Both Find References and Find Local References commands provide you with
a hierarchical list in a separate Find References window, showing you all
occurrences of a selected reference. If you choose the Find References
command, you are presented with a treeview of all references to your selection in
the entire project. If you want to see local references only, meaning those in the
active code file, you... more ( see page 65)
Change Parameters Overview (Delphi) ( see page 66) Adding or removing a parameter from a function is a commonly performed and
tedious programming task. RAD Studio provides the Change Parameters
refactoring to automate this task. You can use Change Parameters to add,
remove, and rearrange function parameters.
To use this refactoring, select a function name in the Code Editor and choose
Refactor Change Params.
When you use the Change Parameters refactoring, the following function
signature conflicts can occur:
56
1.5 Refactoring Applications RAD Studio (Common) Refactoring Overview
Use this dialog box to import namespaces into the using clause of your code file based on objects in code that are contained in
that namespace, but for which no namespace has yet been declared.
Item Description
Search Prefilled with the selected object. You can enter another object name to display a completely new list
of namespaces. If you clear the textbox, the Matching Results field displays all available
namespaces.
Matching Results Displays a list of appropriate namespaces for the specified object. One namespace is highlighted as
the most likely namespace containing the object. You can, however, select other namespaces, or
multi-select namespaces in the list.
Each refactoring operation acts upon one specific type of identifier. By performing a number of successive refactorings, you build
up a large transformation of the code structure, and yet, because each refactoring is limited to a single type of object or
operation, the margin of error is small. You can always back out of a particular refactoring, if you find that it gives you an
unexpected result. Each refactoring operation has its own set of constraints. For example, you cannot rename symbols that are
imported by the compiler. These are described in each of the specific refactoring topics.
RAD Studio includes a refactoring engine that evaluates and executes the refactoring operation. The engine also displays a
preview of what changes will occur in a refactoring pane that appears at the bottom of the Code Editor. The potential refactoring
operations are displayed as tree nodes, which can be expanded to show additional items that might be affected by the
57
Change Parameters RAD Studio (Common) 1.5 Refactoring Applications
refactoring, if they exist. Warnings and errors also appear in this pane. You can access the refactoring tools from the Main menu
and from context-sensitive drop down menus.
Item Description
Class Displays the class in which the selected method is defined.
Method Displays the method that you are refactoring.
Parameters Lists information about the parameters declared in the method.
Add Displays the Add Parameter dialog box, which you use to add a parameter to the method signature.
Edit Displays the Edit Parameter dialog box, which you use to edit a parameter that you have created.
58
1.5 Refactoring Applications RAD Studio (Common) Symbol Rename Overview (Delphi, C#,
Note: If you remove a parameter, you need to manually remove any method code that uses the removed parameter.
See Also
1
Change Parameters Overview ( see page 66)
If you rename an overridden identifier, the engine renames all of the base declarations and descendent declarations, which
means the original virtual identifier and all overridden symbols that exist. An example of this rule follows:
TFoo = class
procedure Foo; virtual;
end;
59
Extract Method Overview (Delphi) RAD Studio (Common) 1.5 Refactoring Applications
TFoo2 = class(TFoo)
procedure Foo; override;
end;
TFoo3 = class(TFoo)
procedure Foo; override;
end;
TFoo4 = class(TFoo3)
procedure Foo; override;
1 end;
Performing a rename operation on Foo renames all instances of Foo shown in the preceding code sample.
See Also
Refactoring Overview ( see page 57)
Item Description
Parameter Name Specifies the name of the new parameter. You must enter a legal Delphi identifier.
Data type Specifies the type of the new parameter.
Matching Results Lists data types that match the text you enter in the Data type field.
Literal Value Specifies the value for the new parameter. Refactoring uses this literal as the value of the new
parameter in existing calls to this procedure.
Parameter Type Specifies the parameter type.
Value Passes the parameter by value.
Var Passes the parameter by reference.
Out Passes the parameter by reference and discards the initial value.
Const Passes the parameter by value and disallows assignment to the parameter.
See Also
Change Parameters Overview ( see page 66)
60
1.5 Refactoring Applications RAD Studio (Common) Extract Resource String (Delphi)
the method. The Extract Method feature analyzes any highlighted code. If that code is not extractable to a method, the
refactoring engine warns you. If the method can be refactored, the refactoring engine creates a new method outside of the
current method. The refactoring engine then determines any parameters, generates local variables, determines the return type,
and prompts the user for a new name. The refactoring engine inserts a method call to the new method in the location of the old
method.
There are certain limitations to the extract method refactoring. They include:
Item Description
Current Class Displays the class from which the field will be derived.
Field Name Displays the name of the field to be declared. By default the name you typed in the Code Editor is
displayed.
If you enter an invalid name in this field, such a reserved word, an exclamation icon is displayed in
the dialog box, prompting you to correct it.
Type Specifies the data type of the field.
Array Specifies that the field should be declared a an array.
Dimensions Specifies the dimensions for the array.
Visibility Specifies the accessibility of the field.
If the value in Field Name conflicts with an existing field name in the same scope, the Refactorings
dialog box is displayed, indicating the conflict.
See Also
Refactoring Overview ( see page 57)
61
Declare Variable and Declare Field RAD Studio (Common) 1.5 Refactoring Applications
• Declare Variable
• Initial Type Suggestion
• Declare Field
Declare Variable
You can create a variable when you have an undeclared identifier that exists within a procedure block scope. This feature gives
you the capability to select an undeclared identifier and create a new variable declaration with a simple menu selection or
keyboard shortcut. When you invoke the Declare Variable dialog, the dialog contains a suggested name for the variable, based
on the selection itself. If you choose to name the variable something else, the operation succeeds in creating the variable,
however, the undeclared identifier symbol (Error Insight underlining) remains.
Variable names must conform to the language rules for an identifier. In Delphi, the variable name:
• Cannot be a keyword.
• Cannot contain a space.
• Cannot be the same as a reserved word, such as if or begin.
• Must begin with a Unicode alphabetic character or an underscore, but can contain Unicode alphanumeric characters or
underscores in the body of the variable name.
• In the Delphi language, the type name can also be the keyword string.
Note: The .NET SDK recommends against using leading underscores in identifiers, as this pattern is reserved for system
use.
62
1.5 Refactoring Applications RAD Studio (Common) Declare Variable and Declare Field
Note: On the dialog that appears when you choose to declare a variable, you can set or decline to set an initial value for the
variable.
Initial Type Suggestion
The refactoring engine attempts to suggest a type for the variable that it is to create. The engine evaluates binary operations of
the selected statement and uses the type of the sum of the child operands as the type for the new variable. For example,
consider the following statement:
myVar := x + 1;
1
The refactoring engine automatically assumes the new variable myVar should be set to type Integer, provided x is an Integer.
Often, the refactoring engine can infer the type by evaluating a statement. For instance, the statement If foo Then...
implies that foo is a Boolean. In the example If (foo = 5) Then... the expression result is a Boolean. Nonetheless, the
expression is a comparison of an ordinal (5) and an unknown type (foo). The binary operation indicates that foo must be an
ordinal.
Declare Field
You can declare a field when you have an undeclared identifier that exists within a class scope. Like the Declare Variable
feature, you can refactor a field you create in code and the refactoring engine will create the field declaration for you in the
correct location. To perform this operation successfully, the field must exist within the scope of its parent class. This can be
accomplished either by coding the field within the class itself, or by prefixing the field name with the object name, which provides
the context for the field.
The rules for declaring a field are the same as those for declaring a variable:
• Cannot be a keyword.
• Cannot contain a space.
• Cannot be the same as a reserved word, such as if or begin.
• Must begin with a Unicode alphabetic character or an underscore, but can contain Unicode alphanumeric characters or
underscores in the body of the field name.
• In the Delphi language, the type name can also be the keyword string.
Note: Leading underscores on identifiers are reserved in .NET for system use.
You can select a visibility for the field. When you select a visibility that is not private or strict private, the refactoring engine
performs the following operations:
• Searches to find all child classes.
• Searches each child class to find the field name.
• Displays a red error item if the field name conflicts with a field in a descendant class.
• You cannot apply the refactoring if it conflicts with an existing item name.
Sample Refactorings
The following examples show what will happen when declaring variables and fields using the refactoring feature.
implementation
procedure TFoo.Foo1;
begin
FTestString := 'test'; // refactor TestString, assign field
63
Extract Method RAD Studio (Common) 1.5 Refactoring Applications
end;
Assume you apply a Declare Field refactoring. This would be the result:
TFoo = class
private
FTestString: string;
procedure Foo1;
end;
If you apply a Declare Variable refactoring instead, the result is:
1
procedure TFoo.Foo1;
var // added by refactor
TestString: string; // added by refactor
begin
TestString := 'test'; // added by refactor
TestString := 'whatever';
end;
See Also
Refactoring Overview ( see page 57)
Use this dialog box to declare a local variable in a procedure. If the cursor in the Code Editor is not positioned on an undeclared
variable, the Refactor Declare Variable command in unavailable.
Item Description
Name Displays the name of the currently selected variable.
Type Specifies the type of variable. By default the name you typed in the Code Editor is displayed.
If you enter an invalid name in this field, such a reserved word, an exclamation icon is displayed in
the dialog box, prompting you to correct it.
Array Specifies that the variable should be declared as an array.
Dimensions Specifies the dimensions of the array.
Set Value Initializes the variable with specified value.
See Also
Refactoring Overview ( see page 57)
Turns a selected code fragment into a method. RAD Studio 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
64
1.5 Refactoring Applications RAD Studio (Common) Change Parameters Overview (Delphi)
Item Description
Current Method Displays the name of the method in which the code fragment currently resides.
New method name Specifies the name to be used for the newly extracted method. ExtractedMethod is displayed by
default, but you can overtype it.
Sample extracted code Displays the code that will be generated for the newly extracted method.
1
See Also
Refactoring Overview ( see page 57)
Both Find References and Find Local References commands provide you with a hierarchical list in a separate Find
References window, showing you all occurrences of a selected reference. If you choose the Find References command, you
are presented with a treeview of all references to your selection in the entire project. If you want to see local references only,
meaning those in the active code file, you can select the Find Local References command from the Search menu. If you want
to find the original declaration within the active Delphi code file, you can use the Find Declaration Symbol command. The Find
Declaration Symbol command is only valid in Delphi and does not apply to C#.
Sample Refactoring
The following sample illustrates how the Find References refactoring will proceed:
1 TFoo = class
2 loc_a: Integer; // Find references on loc_a finds only
3 procedure Foo1; // this line (Line 2) and the usage
4 end; // in TFoo.Foo1 (Line 15)
5 var
6 loc_a: string; // Find references on loc_a here
// finds only this line (Line 6) and
// the usage in procedure Foo (Line11)
7 implementation
8 {$R *.nfm}
9 procedure Foo;
10 begin
11 loc_a := 'test';
12 end;
13 procedure TFoo.Foo1;
14 begin
15 loc_a:=1;
16 end;
See Also
Refactoring Overview ( see page 57)
65
Find Unit RAD Studio (Common) 1.5 Refactoring Applications
When you use the Change Parameters refactoring, the following function signature conflicts can occur:
• A descendant class contains an override for the function you are refactoring. When you refactor the function, any functions
that override the refactored function will also be refactored.
• A descendent class contains an overloaded version of the function that has the same signature as the refactored version.
When you refactor the function, the overload is changed to an override.
• A descendent class has an overridden method that matches the original signature. When you refactor the function, the
override is changed to an overload.
Note: If you remove a parameter, you need to manually remove any method code that uses the removed parameter.
See Also
Refactoring Overview ( see page 57)
Use this dialog box to convert the string currently selected in the Code Editor to a resource string. The resourcestring
keyword and the resource string will be added to the implementation section of your code, and the original string will be replaced
with the new resource string name.
Item Description
String Displays the name of string to be extracted as a resource string.
Name Displays a suggested string name. You can change it as needed.
See Also
Refactoring Overview ( see page 57)
Isolating Resources
Use this dialog to locate units and add them to the uses clause of your Delphi code file.
66
1.5 Refactoring Applications RAD Studio (Common) Undoing a Refactoring (Delphi, C#)
Item Description
Search Displays the selected search identifier. You can change the identifier in this text box. The search
automatically restricts the results based on what you type.
Matching Results Displays all of the potentially appropriate units. Select or multiselect units in the list to add the unit
references to your uses clause.
Add to the Interface Select this to add the unit reference to the interface section.
Add to the Select this to add the unit reference to the implementation section. 1
Implementation
See Also
Refactoring Overview ( see page 57)
1.5.17 Refactorings
View Refactorings
Item Description
Refactor Performs the refactoring operation on the entries.
Undo Refactoring Undoes any refactorings that were performed immediately prior to selecting this command.
Remove Refactoring Removes selected references from the list.
Remove Refactorings Removes all refactorings from the list.
See Also
Refactoring Overview ( see page 57)
67
Rename <symbol name> (C#) RAD Studio (Common) 1.5 Refactoring Applications
backup file that matches that timestamp back over the refactored file.
The important point to understand is that any changes that you make to the files after the refactoring will also be rolled back
when you perform an Undo. Before the Undo is applied, you will get a warning message confirming that you want to apply the
Undo. Applying the Undo reverts changes back to before the refactoring was originally applied in all modified files. You will lose
any changes made in those files since the refactoring was originally applied.
Undo performs local striping only for Rename because Rename is the only refactoring operation that affects multiple files.
1 If you want to undo Extract Method, Declare Field, or Declare Variable refactorings, use Ctrl-z (regular Undo) in the Code
Editor, or the Undo button in the Refactoring window, which accomplishes the same thing.
See Also
Refactoring Overview ( see page 57)
Use this dialog box to specify a new name for the selected symbol before refactoring your code.
Item Description
Old name Displays the current symbol name.
New name Specifies the new name for the symbol.
View references before Displays the Refactorings dialog box, enabling you to preview the proposed changes and selectively
refactoring rename the symbol.
If this option is unchecked, the rename refactoring is performed immediately.
Use this dialog box to perform rename refactoring on a symbol, such as a variable, type, field, method, or parameter, currently
selected in the Code Editor. The first field in the dialog varies based on the type of symbol you are renaming.
Item Description
Namespace Displayed when renaming a type. Indicates the namespace in which the type is defined.
Procedure Displayed when renaming a variable. Indicates the procedure in which the variable is selected.
Class Displayed when renaming a field, method, or parameter. Indicates the class in which the field,
method, or parameter is defined.
Old name The current name of the selected symbol.
New name Enter the new name for the selected symbol.
View references before Displays the Refactorings dialog, enabling you to preview the proposed changes and selectively
refactoring rename the symbol.
If this option is unchecked, the rename refactoring is performed immediately.
68
1.5 Refactoring Applications RAD Studio (Common) Rename <symbol name> (Delphi)
See Also
Refactoring Overview ( see page 57)
1
1.5.21 Rename <symbol name> (Delphi)
Refactor Rename <symbol name>
Use this dialog box to perform rename refactoring on a symbol, such as a variable, type, field, method, or parameter, currently
selected in the Code Editor. The first field in the dialog varies based on the type of symbol you are renaming.
Item Description
Unit Displayed when renaming a type. Indicates the unit in which the type is defined.
Procedure Displayed when renaming a variable. Indicates the procedure in which the variable is selected.
Class Displayed when renaming a field, method, or parameter. Indicates the class in which the field,
method, or parameter is defined.
Old name The current name of the selected symbol.
New name Enter the new name for the selected symbol.
View references before Displays the Refactorings dialog box, enabling you to preview the proposed changes and selectively
refactoring rename the symbol.
If this option is unchecked, the rename refactoring is performed immediately.
See Also
Refactoring Overview ( see page 57)
69
Unit Testing Overview RAD Studio (Common) 1.6 Testing Applications
Both testing frameworks are based on the JUnit test framework and share much of the same functionality.
• What Is Installed
• Test Projects
• Test Cases
• Test Fixtures
70
1.6 Testing Applications RAD Studio (Common) Unit Testing Overview
What Is Installed
By default, both frameworks are installed during the complete RAD Studio installation. When installing individual personalities,
the test framework(s) supported by those personalities will be installed.
DUnit
For Delphi and C++Builder, the DUnit framework is installed automatically by the RAD Studio installer. You can find many DUnit
resources in the \source\DUnit directory, under your installation root directory. These resources include source files,
1
documentation, and test examples. For C++Builder, the following C++ header and library files are also provided for use as C++
test projects:
• GUITestRunner.hpp
• XMLTestRunner.hpp
• TextTestRunner.hpp
• TestFramework.hpp
• DUnitMainForm.hpp
• DUnitAbout.hppdir
• dunitrtl.lib
Note: These files are not part of the standard DUnit distribution. These files are prebuilt by CodeGear and included with
C++Builder for your convenience.
In general when using DUnit, include at least one test case and one or more test fixtures. Test cases typically include one or
more assertion statements to verify the functionality of the class being tested.
DUnit is licensed under the Mozilla Public License 1.0 (MPL).
NUnit
The NUnit framework is available for the Delphi for .NET and C# personalities only.
During the installation process, you are prompted to install NUnit, which you can accept or decline. You can change the location
for installing NUnit, or you can accept the default; the default is C:\Program Files\NUnit V2.x, where x is a point release
number. The installation directory includes a number of resources including documentation and example tests.
NUnit is the name of the .NET testing framework and can be used with both Delphi for .NET and C# projects. There are some
subtle but important differences between the way NUnit and DUnit work. For example, NUnit does not link in .dcu files, but DUnit
does.
In general when using NUnit, include at least one test case and one or more test fixtures. Test cases typically include one or
more assertion statements to verify the functionality of the class being tested.
Test Projects
A test project encapsulates one or more test cases and is represented by a node in the IDE Project Manager. RAD Studio
provides the Test Project Wizard, which you can use to create a basic test project. Once you have a test project that is
associated with a code project, you can create test cases and add them to the test project.
Test Cases
In a typical unit test project, each class to be tested has a corresponding test class; however, this is not required. The test class
is also referred to as a test case. Depending on which framework you are using, the test class may be derived from a specific
test case base class. In general, a test case has a set of one or more methods that correspond to one of the methods in the
class to be tested. More than one test case can be included in a test project. This ability to group and combine tests into test
cases—and test cases into test projects—is what sets a test case apart from simpler forms of testing (such as using print
statements or evaluating debugger expressions). Each test case and test project can be reused and rerun, and can be
automated through the use of batch files, build scripts, or other types of testing systems.
71
DUnit Overview RAD Studio (Common) 1.6 Testing Applications
Generally, it is recommended that you create your tests in a project separate from the source file project. That way, you do not
have to go through the process of removing your tests from your production application. RAD Studio provides the Test Case
Wizard to help you create basic test cases, which you can then customize as needed.
Test Fixtures
The term test fixture refers to the combination of multiple test cases, which test logically related functionality. You can define test
fixtures in your test case. Typically, you will instantiate your objects, initialize variables, set up database connection, and perform
maintenance tasks in the SetUp and TearDown sections. As long as your tests all act upon the same objects, you can include a
1 number of tests in any given test fixture.
See Also
DUnit Overview ( see page 72)
zlib/libpng License
Each testing framework provides its own set of methods for testing conditions. The methods represent common assertions. You
can also create your own custom assertions. You can use the provided methods to test a large number of conditions.
The following sample Delphi Win32 program defines two functions that perform simple addition and subtraction:
unit CalcUnit;
interface
type
{ TCalc }
TCalc = class
public
function Add(x, y: Integer): Integer;
function Sub(x, y: Integer): Integer;
end;
implementation
{ TCalc }
72
1.6 Testing Applications RAD Studio (Common) DUnit Overview
end.
The following example shows the test case skeleton file that you need to modify to test the two functions, Add and Sub, in the
preceding code.
unit TestCalcUnit; 1
interface
uses
TestFramework, CalcUnit;
type
// Test methods for class TCalc
TestTCalc = class(TTestCase)
strict private
aTCalc: TCalc;
public
procedure SetUp; override;
procedure TearDown; override;
published
procedure TestAdd;
procedure TestSub;
end;
implementation
procedure TestTCalc.SetUp;
begin
aTCalc := TCalc.Create;
end;
procedure TestTCalc.TearDown;
begin
aTCalc := nil;
end;
procedure TestTCalc.TestAdd;
var
_result: System.Integer;
y: System.Integer;
x: System.Integer;
begin
_result := aTCalc.Add(x, y);
// TODO: Add testcode here
end;
procedure TestTCalc.TestSub;
var
_result: System.Integer;
y: System.Integer;
x: System.Integer;
begin
_result := aTCalc.Sub(x, y);
// TODO: Add testcode here
end;
initialization
// Register any test cases with the test runner
RegisterTest(TestTCalc.Suite);
end.
73
DUnit Overview RAD Studio (Common) 1.6 Testing Applications
The following sample C++ Win32 header file and program define two functions that perform simple addition and subtraction:
#ifndef Unit7H
#define Unit7H
//-------------------------------------------------
1
class TCalc
{
public:
int Add(int x, int y);
int Sub(int x, int y);
};
#endif
The following example (TestUnit7.cpp) contains a Testcase for the TCalc class. The Wizard generated this example, but the user
is expected to write tests that exercise the functions Add and Sub. The example illustrates the DUnit scaffolding for Unit Tests.
#include <vcl.h>
#pragma hdrstop
#include <TestFramework.hpp>
__published:
void __fastcall TestAdd();
void __fastcall TestSub();
};
74
1.6 Testing Applications RAD Studio (Common) DUnit Overview
if (testSuite->GetInterface(iSuite)) {
testSuite->AddTests(__classid(TTestTCalc));
Testframework::RegisterTest(iSuite);
} else {
delete testSuite;
}
}
#pragma startup registerTests 33
Function Description
Check Checks to see if a condition was met.
CheckEquals Checks to see that two items are equal.
CheckNotEquals Checks to see if items are not equal.
CheckNotNull Checks to see that an item is not null.
CheckNull Checks to see that an item is null.
CheckSame Checks to see that two items have the same value.
EqualsErrorMessage Checks to see that an error message emitted by the application matches a specified error message.
Fail Checks that a routine fails.
FailEquals Checks to see that a failure equals a specified failure condition.
FailNotEquals Checks to see that a failure condition does not equal a specified failure condition.
FailNotSame Checks to see that two failure conditions are not the same.
NotEqualsErrorMessage Checks to see that two error messages are not the same.
NotSameErrorMessage Checks that one error message does not match a specified error message.
For more information on the syntax and usage of these and other DUnit functions, see the DUnit help files in
75
NUnit Overview RAD Studio (Common) 1.6 Testing Applications
\source\dunit\doc.
1 • The GUI Test Runner — This displays test results interactively in a GUI window, with results color-coded to indicate success
or failure.
• The Console Test Runner — This sends all test output to the console.
The DUnit GUI Test Runner is very useful when actively developing unit tests for the code you are testing. The DUnit GUI Test
Runner displays a green bar over a test that completes successfully, a red bar over a test that fails, and a yellow bar over a
test that is skipped.
The DUnit Console Test Runner is useful when you want to run completed code and tests from automated build scripts.
See Also
Unit Testing Overview ( see page 70)
If you want to create tests for an application, you first create a test project. The test project contains the test case files, which
contain one or more tests. A test case is analogous to a class. Each test is analogous to a method. Typically, you might create
one test for each method in your application. You can test each method in your application classes to make sure that the method
performs the task you expect.
You can use the Test Project Wizard to generate a test project file, which builds a .NET assembly that must be run by one of
the NUnit test runners. You can then use the Test Case Wizard to generates a skeleton test method for each method in the
class being tested. This includes local variable declarations for each of the parameters to the method being called. You will need
to write the code required to set up the parameters for the call, and the code to verify the return values or other state that is
appropriate following the call.
The following example shows a small C# program that performs simple addition and subtraction:
using System;
76
1.6 Testing Applications RAD Studio (Common) NUnit Overview
namespace CSharpCalcLib
{
/// <summary>
/// Simple Calculator Library
/// </summary>
public class Calc
{
public int Add(int x, int y)
{
return x + y; 1
}
[SetUp]
public void SetUp()
{
aCalc = new Calc();
}
[TearDown]
public void TearDown()
{
aCalc = null;
}
[Test]
public void TestAdd()
{
int x;
int y;
int returnValue;
// TODO: Setup call parameters
returnValue = aCalc.Add(x, y);
// TODO: Validate return value
}
[Test]
public void TestSub()
{
77
NUnit Overview RAD Studio (Common) 1.6 Testing Applications
int x;
int y;
int returnValue;
// TODO: Setup call parameters
returnValue = aCalc.Sub(x, y);
// TODO: Validate return value
}
}
}
attribute in C# projects. In addition, in C# the test methods are defined as functions returning void. The following example
shows a small Delphi for .NET program that performs simple addition and subtraction:
unit CalcUnit;
// .Net Version
interface
type
{ TCalc }
TCalc = class
public
function Add(x, y: Integer): Integer;
function Sub(x, y: Integer): Integer;
end;
implementation
{ TCalc }
end.
The following example shows the test case skeleton file that you need to modify to test the two functions, Add and Sub, in the
preceding code.
unit TestCalcUnit;
interface
uses
NUnit.Framework, CalcUnit;
type
// Test methods for class TCalc
[TestFixture]
TestTCalc = class
strict private
FCalc: TCalc;
public
[SetUp]
procedure SetUp;
[TearDown]
78
1.6 Testing Applications RAD Studio (Common) NUnit Overview
procedure TearDown;
published
[Test]
procedure TestAdd;
[Test]
procedure TestSub;
end;
implementation
procedure TestTCalc.SetUp; 1
begin
FCalc := TCalc.Create;
end;
procedure TestTCalc.TearDown;
begin
FCalc := nil;
end;
procedure TestTCalc.TestAdd;
var
ReturnValue: Integer;
y: Integer;
x: Integer;
begin
// TODO: Setup call parameters
ReturnValue := FCalc.Add(x, y);
// TODO: Validate return value
end;
procedure TestTCalc.TestSub;
var
ReturnValue: Integer;
y: Integer;
x: Integer;
begin
// TODO: Setup call parameters
ReturnValue := FCalc.Sub(x, y);
// TODO: Validate return value
end;
end.
Note: In Delphi for .NET the test methods are defined as procedures.
• be public
• be a procedure for Delphi for .NET or a function with a void return type for C#
• take no arguments
Setup
Use the SetUp procedure to initialize variables or otherwise prepare your tests prior to running. For example, this is where you
would set up a database connection, if needed by the test.
TearDown
The TearDown method can be used to clean up variable assignments, clear memory, or perform other maintenance tasks on
your tests. For example, this is where you would close a database connection.
79
NUnit Overview RAD Studio (Common) 1.6 Testing Applications
NUnit Asserts
NUnit provides a number of asserts that you can use in your tests.
You can use multiple asserts in any test method. This collection of asserts should test the common functionality of a given
method. If an assert fails, the entire test method fails and any other assertions in the method are ignored. Once you fix the failing
test and rerun your tests, the other assertions will be executed, unless one of them fails.
• NUnitConsole.exe — This is the Console Test Runner, a text-based test runner that sends test output to the console.
• NUnitGUI.exe — This is the GUI Test Runner, an interactive GUI-based test runner, with results color-coded for success or
failure.
The GUI Test Runner is very useful when actively developing unit tests or the code you are testing. The GUI Test Runner
displays a green indicator for a test that completes successfully, a red indicator for a test that fails, and a yellow indicator for a
test that is skipped.
The Console Test Runner is useful when you need to run completed code and tests from automated build scripts. If you want to
redirect the output to a file, use the redirection command parameter. The following example shows how to redirect test results
to a TestResult.txt text file:
nunit-console nunit.tests.dll /out:TestResult.txt
Note: You may need to set the path to your host application in the Project Options
dialog. Set the Host Application property to the location of the test runner you want to use.
See Also
Unit Testing Overview ( see page 70)
NUnit.org Documentation
80
1.7 Modeling Applications with Together RAD Studio (Common)
Note: The product version you have determines which Together features are available. 1
Topics
Name Description
Getting Started with Together ( see page 83) The two sample projects are designed to help you explore Together features
while working with projects. Some of the special features include: UML modeling,
patterns, generating project documentation.
Modeling Overview ( see page 89) Effective modeling with Together simplifies the development stage of your
project. Smooth integration to RAD Studio provides developers with easy
transition from models to source code.
The primary objective of modeling is to organize and visualize the structure and
components of software intensive systems. Models visually represent
requirements, subsystems, logical and physical elements, and structural and
behavioral patterns.
While contemporary software practices stress the importance of developing
models, Together extends the benefits inherent to modeling by fully
synchronizing diagrams and source code.
Together Project Overview ( see page 89) Work in Together is done in the context of a project. A project is a logical
structure that holds all resources required for your work. Together works with the
following project types: design and implementation. Each of them includes
several project formats.
It is up to you to define which directories, archives, and files should be included in
your project. You can set up project properties when the project is being created,
and modify them further, using the Object InspectorProperties Window.
Namespace and Package Overview ( see page 89) A namespace is an element in a model that contains a set of named elements
that can be identified by name.
A project consists of one or more namespaces (or packages). A namespace and
a package are almost synonyms: the term “namespace” is used for
implementation projects, the term “package” is used for design projects.
A namespace (or a package) is like a box where you put diagrams and model
elements. Contents of a namespace (package) can be displayed on a special
type of the Class Diagram.
Each project contains the default namespace (or package) just after its creation.
Together Diagram Overview ( see page 90) Diagrams can be thought of as graphs with vertices and edges that are arranged
according to a certain algorithm.
Each diagram belongs to a certain diagram type (for example, UML 2.0 Class
Diagram). A set of model elements available for use on a diagram depends on
the diagram type.
Diagrams exist within the context of a namespace (or a package). You have to
create or open a project or project groupsolution before creating a new diagram.
When Together support is activated, the project-level package diagram is created
by default. You can create the various UML diagrams in the... more ( see page
90)
Supported UML Specifications ( see page 90) The Object Management Group’s Unified Modeling Language (UML) is a
graphical language for visualizing, specifying, constructing, and documenting the
artifacts of distributed object systems.
Together supports UML to help you specify, visualize, and document models of
your software systems, including their structure and design.
Refer to UML documentation for the detailed information about UML semantics
and notation. The UML (version): Superstructure document defines the user level
constructs required for UML. It is complemented by the UML (version):
Infrastructure document which defines the foundational language constructs
required for UML. The two complementary specifications constitute a complete
specification for the UML modeling... more ( see page 90)
Model Element Overview ( see page 91) Model element is any component of your model that you can put on a diagram.
Model elements include nodes and links between them.
A set of available model elements depends on a current diagram type. Available
model elements are displayed in the Tool PaletteToolbox.
A link can have a label. You can move a label to any point of the link line.
81
RAD Studio (Common) 1.7 Modeling Applications with Together
Model Annotation Overview ( see page 91) The Tool PaletteToolbox for UML diagram elements displays note and note link
buttons for all UML diagrams. Use these elements to place annotation nodes and
their links on the diagram.
Notes can be free floating or you can draw a note link to some other element to
show that a note pertains specifically to it.
You can attach a note link to another link.
The text of notes linked to class diagram elements does not appear in the source
code.
Model Shortcut Overview ( see page 92) A shortcut is a representation of an existing node element placed on the same
or a different diagram.
1 Shortcuts facilitate reuse of elements, make it possible to display library classes
on diagrams, and demonstrate relationships between the diagrams within the
model.
You can create a shortcut to an element of any other project in the current project
groupsolution. You can create a shortcut to an inner class or interface of another
classifier. It is also possible to add a shortcut to an element from project
References, including binary (.dll, .exe) files.
The small special... more ( see page 92)
Diagram Layout Overview ( see page 92) You can customize arrangement of model elements on your diagrams
automatically or manually.
Together enables you to manage diagrams with automated layout features that
optimize the diagram layout for viewing or printing. Nodes and links on a diagram
are arranged according to a certain algorithm.
There are several diagram layout algorithms available. You can apply the same
algorithm for the entire model, or different algorithms to separate diagrams.
Each algorithm has a set of specific options defined in the
Together (level) Diagram Layout category of the Options dialog window.
It is also possible to lay out a diagram manually by... more ( see page 92)
Model Hyperlinking Overview ( see page 92) You can create hyperlinks from diagrams or diagram elements to other system
artifacts and browse directly to them.
LiveSource Overview ( see page 93) LiveSource™ is the key feature of Together that keeps your model and source
code in sync. That is why it applies to implementation projects only.
When a Class diagram is created in an implementation project, it is immediately
synchronized with the implementation code. When you change a Class diagram,
Together updates the corresponding source code.
Together allows you to synchronize different aspects of your project in several
ways.
Use the Reload command to refresh the Together model from the source code.
Transformation to Source Code Overview ( see page 94) Together enables you to generate source code based on a language-neutral
design project.
OCL Support Overview ( see page 95)
Patterns Overview ( see page 96) Patterns provide software developers with powerful reuse facilities. Rather than
trying to tackle each design problem from the very outset, you can use the
predefined patterns supplied with Together. The hierarchy of patterns is defined
in the Pattern Registry. You can manage and logically arrange your patterns
using the Pattern Organizer.
Patterns are intended to:
82
1.7 Modeling Applications with Together RAD Studio (Common) Getting Started with Together
Quality Assurance Facilities Overview ( see page 98) Together provides audits and metrics as Quality Assurance features to
unobtrusively help you enforce company standards and conventions, capture real
metrics, and improve what you do. Although audits and metrics are similar in that
they both analyze your code, they serve different purposes.
Audits and metrics are run as separate processes. Because the results of these
two processes are different in nature,Together provides different features for
interpreting and organizing the results. Note that some of the features and
procedures described in this section apply to both audits and metrics while some
are specific to one or the other.
Documentation Generation Facility Overview ( see page 100) This feature automatically generates documentation for your project. Use this
feature to illustrate you programme with the documentation in the HTML format.
You can update this automatically generated documentation when your project
1
changes, or edit this documentation manually afterwards.
Model Import and Export Overview ( see page 100) You can share model information with other systems by importing and exporting
model information, or by sharing project files:
Import and export features
Topics
Name Description
About Together ( see page 83) Welcome to CodeGear® Together®, the award-winning, design-driven
environment for modeling applications. Together includes features such as
support for UML 2.0, OCL, patterns, Quality Assurance audits and metrics,
source code refactoring and generation, IBM Rational Rose (MDL) format import,
XMI format import and export, and automated documentation generation.
A key feature of Together, LiveSource™, keeps your Together diagrams
synchronized with your source code in the RAD Studio Editor.
The Together features are tightly integrated with the RAD Studio environment.
When Together support is activated, the following items are added or modified:
• Diagram View
• Model View
• Object InspectorProperties Window
• Tool... more ( see page 83)
UML 2.0 Sample Project ( see page 84) This section contains a UML 2.0 sample project guide.
Important: This sample project is available for RAD Studio Architect version only.
Follow the steps:
Code Visualization Overview ( see page 87) The Code Visualization feature is available in both the Enterprise and Architect
versions of RAD Studio. All other modeling tools and information related to
modeling relates only to the Architect version of RAD Studio.
What's New in Together ( see page 88) This version includes the following new and improved features.
83
Getting Started with Together RAD Studio (Common) 1.7 Modeling Applications with Together
generation.
A key feature of Together, LiveSource™, keeps your Together diagrams synchronized with your source code in the RAD Studio
Editor.
The Together features are tightly integrated with the RAD Studio environment. When Together support is activated, the following
items are added or modified:
• Diagram View
1 • Model View
• Object InspectorProperties Window
• Tool PaletteToolbox
In addition, specific commands are added to the main menu and the context menus of the Project ManagerSolution Explorer and
Structure ViewClass View.
Warning: Not all features described in this Help are available in all editions of the product.
If your Internet access is limited by network security, or if your computer is protected by a personal firewall, the Web-based
links in this Help system might not function properly.
See Also
Modeling Overview ( see page 89)
Important: This sample project is available for RAD Studio Architect version only.
Topics
Name Description
UML 2.0 Sample Project, Behavior Package ( see page 85) This package contains diagrams:
• Activity diagram
• State Machine diagram
• Use Case diagram
• Interaction diagram
UML 2.0 Sample Project, Structure Package ( see page 86) The default diagram on the top level of the project contains two packages
intended to demonstrate the structural and behavioral modeling.
This package contains the following diagrams:
• Class diagram
• Component diagram
• Composite Structure diagram
• Deployment diagram
84
1.7 Modeling Applications with Together RAD Studio (Common) Getting Started with Together
• Activity diagram
• State Machine diagram
• Use Case diagram
1
• Interaction diagram
Activity diagram
Activity diagram features are presented by three diagrams:
• Data Activity
• Final Nodes
• Process Order
• Course Attempt
• Submachine State.
85
Getting Started with Together RAD Studio (Common) 1.7 Modeling Applications with Together
Interaction diagrams
Interaction diagrams show interaction between objects represented by their lifelines, by ways of messages. Each lifeline
instantiates a class or represents a part. An interaction can be shown in two ways: as a sequence diagram or as a
communication diagram. The sample interaction ShowAlbumsDialog is represented by the ShowAlbumsDialog diagram
(sequence) and cd_ShowAlbumsDialog diagram (communication).
See Also
1 UML 2.0 Sample Project ( see page 84)
• Class diagram
• Component diagram
• Composite Structure diagram
• Deployment diagram
Class diagram
Class diagram is represented by three samples: Class, Classes and Associations, Classes and Features.
Class Diagram
This diagram shows the usage of patterns as first class citizens. Abstract Factory is created by a GoF pattern. Explore the
specific features of adding and removing participants and pattern objects.
• Generalization of classes
• Implementation of interfaces by classes
• Usage of association classes and n-ary associations. Note that n-ary association can only be created by means of an
association class
• Usage of binary associations
• Usage of association links properties (directed and non-directed associations, link labels, client and supplier multiplicities,
roles, qualifiers, constraints, and so on)
86
1.7 Modeling Applications with Together RAD Studio (Common) Getting Started with Together
• Inner components
• Usage of the required and provided interfaces via ports
1
• Delegation connectors that delegate calls to a component to its subcomponents.
Composite Structure diagram
Composite Structure diagram demonstrates the usage of collaborations and parts.
Deployment diagram
Deployment diagram is represented by the Application Server diagram that demonstrates the usage of deployment specifications
and artifacts.
See Also
UML 2.0 Sample Project ( see page 84)
This section will explain the relationship between source code and the code visualization diagram.
Note: Code visualization, and the integrated UML modeling tools are two separate and distinct features of RAD Studio. Code
visualization refers to the ability to scan an arbitrary set of source code, and map the declarations within that code onto UML
notation. The resulting diagram is "live", in the sense that it always reflects the current state of the source code, but you cannot
make changes directly to the code visualization diagram itself. RAD Studio's model driven UML tools go a step further, giving you
the ability to design your application on the diagramming surface. The model driven tools are built on Borland Together
technologies, plus the Enterprise Core Objects framework. This document covers only the code visualization diagram; please
use the online Help table of contents for more information on the ECO framework.
87
Getting Started with Together RAD Studio (Common) 1.7 Modeling Applications with Together
certain source code constructs (such as class declarations, and implementation of interfaces) onto their UML counterparts, which
are then displayed on the diagram.
The UML term for interface implementation is realization. Similar to the case of inheritance, the IDE creates a realization link
when it sees a class declaration that implements an interface. The realization link appears within the implementor class in the
Model View tree, and on the diagram as a dotted line with a hollow arrowhead pointing at the interface. There will be one such
realization link for every interface implemented by the class.
Associations
In the UML, an association is a navigational link produced when one class holds a reference to another class (for example, as an
attribute or property). Code visualization creates association links when one class contains an attribute or property that is a
non-primitive data type. On the diagram the association link exists between the class containing the non-primitive member, and
the data type of that member.
• Fields: Contains field declarations. The type, and optional default value assignment are shown on the diagram.
• Methods: Contains method declarations. Visibility, scope, and return value are shown.
• Properties: Contains Delphi property declarations. The type of the property is shown.
• Classes: Contains nested class type declarations.
Standard UML syntax is used to display the UML declaration of attributes, operations, and properties. Each of the four categories
can be independently expanded or collapsed to show or hide the members within.
See Also
Code Visualization Diagrams ( see page 730)
88
1.7 Modeling Applications with Together RAD Studio (Common) Namespace and Package Overview
The primary objective of modeling is to organize and visualize the structure and components of software intensive systems.
Models visually represent requirements, subsystems, logical and physical elements, and structural and behavioral patterns.
While contemporary software practices stress the importance of developing models, Together extends the benefits inherent to
modeling by fully synchronizing diagrams and source code.
See Also
About Together ( see page 83)
It is up to you to define which directories, archives, and files should be included in your project. You can set up project properties
when the project is being created, and modify them further, using the Object InspectorProperties Window.
See Also
UML 2.0 Sample Project ( see page 84)
A project consists of one or more namespaces (or packages). A namespace and a package are almost synonyms: the term
89
Supported UML Specifications RAD Studio (Common) 1.7 Modeling Applications with Together
“namespace” is used for implementation projects, the term “package” is used for design projects.
A namespace (or a package) is like a box where you put diagrams and model elements. Contents of a namespace (package)
can be displayed on a special type of the Class Diagram.
Each project contains the default namespace (or package) just after its creation.
See Also
Working with a Namespace or Package ( see page 250)
1
Class Diagram Types ( see page 1124)
Each diagram belongs to a certain diagram type (for example, UML 2.0 Class Diagram). A set of model elements available for
use on a diagram depends on the diagram type.
Diagrams exist within the context of a namespace (or a package). You have to create or open a project or project groupsolution
before creating a new diagram. When Together support is activated, the project-level package diagram is created by default. You
can create the various UML diagrams in the project.
In addition to the standard properties of diagrams and their elements, you can create user properties, represented by the
Name-Value pair.
See Also
Diagram Format Overview
Together supports UML to help you specify, visualize, and document models of your software systems, including their structure
and design.
Refer to UML documentation for the detailed information about UML semantics and notation. The UML (version): Superstructure
document defines the user level constructs required for UML. It is complemented by the UML (version): Infrastructure document
which defines the foundational language constructs required for UML. The two complementary specifications constitute a
complete specification for the UML modeling language.
For design projects, both UML 1.5 and 2.0 are supported.
90
1.7 Modeling Applications with Together RAD Studio (Common) Model Shortcut Overview
The version of UML is selected when a project is created. It cannot be changed later.
UML In Color
“UML In Color” is an optional profile to support the modeling in color methodology. Color modeling makes it possible to
analyze a problem domain and easily spot certain classes during analysis. Together supports the use of the four main groups of
the color-modeling stereotypes:
• Role
• MomentInterval, Mi-detail 1
• Party, Place, Thing
• Description
For each of these stereotypes you can choose a specific color to make your model more understandable at a glance. Note that
the other stereotypes do not have associated colors.
See also "Java Modeling in Color with UML: Enterprise Components and Process" by Coad, Lefebvre and De Luca.
See Also
http://www.uml.org/
A set of available model elements depends on a current diagram type. Available model elements are displayed in the Tool
PaletteToolbox.
A link can have a label. You can move a label to any point of the link line.
See Also
Creating a Single Model Element ( see page 209)
Notes can be free floating or you can draw a note link to some other element to show that a note pertains specifically to it.
The text of notes linked to class diagram elements does not appear in the source code.
See Also
Annotating a Diagram ( see page 195)
91
Model Hyperlinking Overview RAD Studio (Common) 1.7 Modeling Applications with Together
Shortcuts facilitate reuse of elements, make it possible to display library classes on diagrams, and demonstrate relationships
1 between the diagrams within the model.
You can create a shortcut to an element of any other project in the current project groupsolution. You can create a shortcut to an
inner class or interface of another classifier. It is also possible to add a shortcut to an element from project References, including
binary (.dll, .exe) files.
The small special symbol appears over a node to indicate a shortcut. It appears only if this node belongs to a different
namespace or package.
Select a shortcut on your diagram and choose Navigate To Element on the context menu to navigate to the source element in
the Model View.
See Also
Creating a Shortcut ( see page 208)
Together enables you to manage diagrams with automated layout features that optimize the diagram layout for viewing or
printing. Nodes and links on a diagram are arranged according to a certain algorithm.
There are several diagram layout algorithms available. You can apply the same algorithm for the entire model, or different
algorithms to separate diagrams.
Each algorithm has a set of specific options defined in the Together (level) Diagram Layout category of the Options
dialog window.
It is also possible to lay out a diagram manually by moving and resizing nodes and reshaping links. You can also lay out your
diagram automatically, and then adjust arrangement manually.
See Also
Laying Out a Diagram Automatically ( see page 202)
92
1.7 Modeling Applications with Together RAD Studio (Common) LiveSource Overview
By browsing the hyperlink sequence, you can follow the relationships between the use case diagrams.
Together does not confine hyperlinking to such sequences, however. You can use hyperlinking to link diagrams and elements
based on your requirements. For example, you can create a hierarchical browse-through sequence of use case diagrams,
creating hyperlinks within the diagrams that follow a specific actor through all use cases that reference the actor.
See Also
Hyperlinking Diagrams ( see page 201)
When a Class diagram is created in an implementation project, it is immediately synchronized with the implementation code.
When you change a Class diagram, Together updates the corresponding source code.
Together allows you to synchronize different aspects of your project in several ways.
Use the Reload command to refresh the Together model from the source code.
About MDA
Together supports the OMG’s Model Driven Architecture (MDA) initiative.
MDA is an evolving conceptual architecture for a set of industry-wide technology specifications that will support a model-driven
93
Transformation to Source Code Overview RAD Studio (Common) 1.7 Modeling Applications with Together
Doc comments are presented as XML tags, preceeded by /// (for C# projects) or ' (for Visual Basic) However, for the sake of
backward compatibility with Together ControlCenter, Together recognizes doc comment properties created in TCC for the Visual
Basic projects, where the legacy format '@property value was used..
So doing, if the properties of an element are presented in the legacy format and one of these properties is changed to the new
format '<property> value</property>, all the other properties are also converted.
See Also
Roundtrip Engineering Overview
Alternatively, you can import source code from an external design project into your current implementation project.
Name mapping
You can force Together to generate different names for your model elements in the source code. For example, you can have
ClassItem in your source code for the Class1 element in your model.
This feature is especially useful, if your model names are not English. You can use names in Japanese and other languages on
your diagrams, but keep names in Latin alphabet in your code.
If you enable this feature, the file codegen_map.xml is created in the model support folder of the source design project. You
can edit it with any XML or text editor. This file contains a mapping table, where each entry (model element) has two names: one
for the source design project (attribute name), and another one for the destination implementation project (attribute alias).
There are several sections in this file: Class, Attribute, Operation and Package for UML 1.5 projects, and Class and Package
for UML 2.0 projects. Attributes name must be unique for all entries in a section.
You can optionally create an XML file with the same name and structure in a folder of any package.
Then, if you transform your project to source code and the name mapping feature is enabled, Together searches for the
codegen_map.xml file for each model element. If the file is absent for a current package, Together searches in a parent
package, and so on.
94
1.7 Modeling Applications with Together RAD Studio (Common) OCL Support Overview
Note: If you add a new element to your model later and then transform the project to source code, Together adds a new entry
for this item to the corresponding codegen_map.xml file. The existing entries are not changed.
See Also
LiveSource Overview ( see page 93)
1
1.7.14 OCL Support Overview
About OCL
The Object Constraint Language (OCL) is a textual language, especially designed for use in the context of diagrammatic
languages such as the UML. OCL was added to UML, as it turned out a visual diagram-based language is limited in its
expressiveness.
OCL 2.0 is the newest version of the OMG’s constraint language to accompany their suit of Object Oriented modelling languages.
The use of OCL as an accompanying constraint and query language for modelling with these languages is essential.
Note: Portions of this product include the Object Constraint Language Library, courtesy of Kent University, United Kingdom. See
http://www.cs.kent.ac.uk/projects/ocl/
OCL constraint
The Tool PaletteToolbox on some types of diagrams (for example, UML 2.0 Class Diagram) contains buttons that enable you to
create OCL constraints as design elements on diagrams, and link these constraints with the desired context.
You can show or hide constraint elements for the better presentation of your diagrams.
OCL support for constraints provides error highlighting. The text of the constraint is validated when the constraint is linked to its
context. The valid constraints are displayed in the regular font; invalid constraints, or OCL expressions with syntax errors, are
displayed in a red font.
Constrained elements are marked with the decorators. The decorators are small icons attached to the context elements of
constraints. If a constraint is valid the decorator is green; otherwise the decorator is red. If the constraints are concealed, you can
still monitor the validity of constraints by means of the decorators.
OCL expression
For OCL expressions without object constraints (expressions as properties of other nodes), no validation is performed since no
valid OCL context can be set for these elements.
95
Patterns Overview RAD Studio (Common) 1.7 Modeling Applications with Together
See Also
Modeling Overview ( see page 89)
Pattern Organizer
The Pattern Organizer enables you to logically organize patterns (using virtual trees, folders and shortcuts), and view and edit
the pattern properties. You will be working with shortcuts, not with the actual patterns. Because of this, shortcuts to the same
pattern may be included in several folders.
Templates
Together supports templates as a way to provide backward compatibility with the legacy Together ControlCenter projects. You
can copy the folders with your legacy source code templates to the Patterns subfolder of your Together installation directory,
and use these templates to create elements in implementation projects.
Templates are text files with the language-specific extensions that use macros to be substituted with real values when the
templates are applied. Therefore, templates can be regarded as forms ready for "filling in" for a specific instance. A template
consists of a template file containing source code, and a properties file that contains macro descriptions and their default values.
Templates are stored in the Patterns\templates directory of your Together installation using the following structure:
/<language>/<category>/<template name>
96
1.7 Modeling Applications with Together RAD Studio (Common) Patterns Overview
where <category> is CLASS, LINK or MEMBER. Each <template_name> folder contains the following files:
• %Name%.<ext>
• <template_name>,properties (optional)
Design patterns
A design pattern is an XML file that contains a sequence of statements or actions, required to create entities and links and set
their properties. Each statement creates either one model element or one link between the model elements.
In addition to creating new elements, you can use design patterns to add members to a container element. The pattern that you 1
are applying to the specified container element should have its Use Existent property set as True. You can then apply the pattern
to the container element you want to modify. For example, if you want to add several methods stored in a class as pattern to an
existing class, then you have to apply that pattern to the diagram where that class exists.
The design patterns are stored as XML files in the Patterns directory of your Together installation.
A pattern is displayed on a diagram as an oval with the pattern name and an expandable list of participants. Each participant is
connected with the pattern oval by a link, labeled with the participant's role.
FCC patterns generate source code, but the oval FCC pattern elements do not. The entities created by patterns are stored in the
diagram files.
If the destination of a link is an interface, the pattern makes the class-source implement that interface, and creates in a class the
stubs for all of the methods found in the interface and all of its parent interfaces.
If the destination link is an abstract class, this pattern makes the class-source extend the class-destination, and makes stubs for
all of the constructors found in the class-destination. These constructor stubs call the corresponding constructors in the
class-destination.
You can find the Implementation link and stub pattern in the Pattern Wizard by clicking the Link by Pattern or Node by Pattern
buttons in the Tool PaletteToolbox, or by using the Create by Pattern context menu for a class.
The Implementation link and stub pattern creates the following members of interfaces and abstract classes:
• Methods
• Functions
• Subroutines
• Properties
• Indexers
• Events
See Also
Together Pattern Procedures ( see page 251)
97
Quality Assurance Facilities Overview RAD Studio (Common) 1.7 Modeling Applications with Together
The refactoring features provided by Together affect both source code and model. As a result, your project is consisting after
refactoring, even if it includes UML diagrams.
The primary resource book on refactoring is Refactoring - Improving the Design of Existing Code by Martin Fowler (Addison -
Wesley, 1999).
See Also
Using Refactor Operations ( see page 184)
Audits and metrics are run as separate processes. Because the results of these two processes are different in nature,Together
provides different features for interpreting and organizing the results. Note that some of the features and procedures described in
this section apply to both audits and metrics while some are specific to one or the other.
Audits
When you run audits, you select specific rules to which your source code should conform. The results display only the violations
of those rules so that you can examine each problem and decide whether to correct the source code. Together provides a wide
variety of audits to choose from, ranging from design issues to naming conventions, along with descriptions of what each audit
looks for and how to fix violations. You can create, save, and reuse sets of audits to run. Together ships with a predefined saved
audit set (current.adt) and you can create your own custom sets of audits to use.
Metrics
Metrics evaluate object model complexity and quantify your code. It is up to you to examine the results and decide whether they
are acceptable. Metrics results can highlight parts of code that need to be redesigned, or they can be used for creating reports
and for comparing the overall impact of changes in a project.
Together supports a wide range of metrics. See the descriptions of available metrics in the Metrics dialog window.
Along with the full set of metrics, Together provides tips for using metrics and interpreting results.
98
1.7 Modeling Applications with Together RAD Studio (Common) Documentation Generation Facility
Bar chart
Metrics results can also be viewed graphically. Two graphic views allow you to summarize metrics results: bar charts and Kiviat
charts. Both charts are invoked from the context menu of the table. Use the Kiviat chart for rows and the bar chart for columns.
The bar chart displays the results of a selected metric for all packages, classes, and/or operations.
The bar color reflects conformance to the limiting values of the metric in reference:
Kiviat chart
Use the Kiviat chart for rows and the bar chart for columns.
The Kiviat chart demonstrates the analysis results of the currently selected class or package for all the metrics that have
predefined limiting values. The metrics results are arranged along the axes that originate from the center of the graph.
Each axis has a logarithmic scale with the logarithmic base being the axis metric upper limit so that all upper limit values are
equidistant from the center. In this way, limits and values are displayed using the following notation:
• Upper limits are represented by a red circle. Any points outside the red circle violate the upper limit.
• Lower limits are represented by blue shading, showing that any points inside the blue area violate the lower limit. Note that
blue shading does not show up in areas of the graph with lower limits of 1 or 0.
As the mouse cursor hovers over the chart, the Visual Studio status bar displays information about the metrics or metrics values
that correspond to the tick marks.
• The actual metrics show up in the form of a star with metric values drawn as points.
• Green points represent acceptable values.
• Blue points represent values below the lower limit.
• Red points represent values exceeding the upper limit.
• Scale marks are displayed as clockwise directional ticks perpendicular to the Kiviat ray.
• Lower limit labels are displayed as counterclockwise directional blue ticks perpendicular to the Kiviat ray.
Sets of audits and metrics
Both Audits and Metrics dialog boxes display the set of all available audits and metrics. When you open a project, a default
subset is active. Active audits and metrics are indicated by checkmarks. If you open the desired dialog and click Start, all of the
active audits/metrics are processed.
You will not want to run every audit or metric in the default active set every time, but rather some specific subset. Together
enables you to create saved sets of active audits and metrics that can be loaded and processed as you choose. To do that, use
the Load Set and Save Set buttons on the toolbar of the Audits and Metrics dialog windows. You can always restore the default
active set using the Set Defaults button in the Audits dialog. Refer to the Audits dialog for description of controls.
Use the default active audits set or any saved set as the basis for creating a new saved set. By default, audit sets are saved in
the QA folder under the Together installation.
See Also
Running Audits ( see page 273)
99
Model Import and Export Overview RAD Studio (Common) 1.7 Modeling Applications with Together
100
1.7 Modeling Applications with Together RAD Studio (Common) Model Import and Export Overview
Feature Description
Exporting You can save diagrams in several formats, including:
diagrams to Bitmap image (BMP)
images
Enhanced windows metafile (EMF)
Graphics interchange (GIF)
JPEG file interchange (JPG)
W3C portable network graphics (PNG) 1
Tag image file (TIFF)
Windows metafile (WMF)
Importing IBM It is possible to convert models designed in IBM Rational Rose 2003 to the format of Together. The
Rational Rose following file formats are supported: .mdl, .ptl, .cat, and .sub.
(MDL) models For import, you create a new design UML 1.5 project based on the IBM Rational Rose project.
Importing from XMI (XML Metadata Interchange) enables the exchange of metadata information. Using XMI, you can
XMI exchange models across languages and applications. For example, if you have a modeling project created
Exporting to XMI with a tool other than Together, you can import it to Together as an XMI file for extension or as the basis of
a new project. Likewise, you can export Together projects for use in other applications. The result in each
case is a single, portable .xml file.
Together supports UML 1.3 Unisys XMI interchange for 8 types of UML diagrams.
This feature is available for design projects that comply with the UML 1.5 specification.
Importing from You can reuse models created in other editions and versions of Borland Together. This feature is known
other versions of as interoperability.
Together
Sharing with
other versions of
Together
Export a Quality Create a chart and then export it to image.
Assurance
metric chart to
image
See Also
Interoperability Overview
Importing a Project in IBM Rational Rose (MDL) Format ( see page 265)
101
2 RAD Studio (Common)
2 Procedures
This section provides how-to information for various areas of RAD Studio development.
Topics
Name Description
Compiling and Building Procedures ( see page 104) This section provides how-to information on building packages and localizing
applications.
Debugging Procedures ( see page 114) This section provides how-to information on debugging applications.
Deploying Applications ( see page 133) This section provides how-to information on deploying applications. There are
two ways to deploy an application — manually, or using the Deployment
2
Manager. Currently, the Deployment manager is only for use with ASP.NET
applications. Manual procedures for deploying applications are described in the
appropriate Win32 area in this help system (for example, Delphi, ECO, or COM).
Editing Code Procedures ( see page 136) This section provides how-to information on using the features of the Code
Editor.
Getting Started Procedures ( see page 151) This section provides how-to information on configuring the IDE, working with
forms and projects, and more.
Localization Procedures ( see page 169) This section provides how-to information on localizing applications by using the
RAD Studio translation tools.
Managing Memory ( see page 175) This section provides how-to information on using the Memory Manager,
covering how to configure the Memory Manager, increase the memory address
space, monitor the Memory Manager, use the memory map, share memory, and
report and manage memory leaks.
Unit Test Procedures ( see page 180) This section provides how-to information on using the features of DUnit and
NUnit.
Together Procedures ( see page 183) This section provides how-to information on using the Together features.
103
Applying the Active Build Configuration for RAD Studio (Common) 2.1 Compiling and Building Procedures
Topics
Name Description
Applying the Active Build Configuration for a Project ( see page 104)
Building Packages ( see page 105) You can create packages in RAD Studio and include them in your projects.
Compiling C++ Design-Time Packages That Contain Delphi Source ( see page C++Builder supports compiling design-time packages that contain Delphi source
106) files. However, if any of those Delphi sources make reference to IDE-supplied
design-time units such as DesignIntf, DesignEditors, and ToolsAPI that exist in
DesignIDE100.bpl, you must take steps to ensure that the references can be
resolved by the C++Builder package.
Creating Build Events ( see page 107) You can use the build events dialog to create a list of events that occur in various
stages of the build process. Depending on the type of project, you can create
events for the pre-build, pre-link, and post-build stages. You add events for any
of these stages in exactly the same way.
Creating Named Build Configurations for C++ ( see page 107)
Creating Named Build Configurations for Delphi ( see page 108)
Building a Project Using an MSBuild Command ( see page 108) The IDE uses Microsoft's MSBuild engine to build a project. You can build
projects without knowing anything about MSBuild; the IDE handles all the details
for you. However, you can also directly build the project using MSBuild
command-line syntax as described here. When you build a project, the results of
the build appear in the Output pane of the Messages window. If you have
entered build events, the build output pane displays the commands you specified
and their results.
MSBuild command-line syntax has the form:
2 MSBuild <projectname> [/t:<target
name>][/p:configuration=<configuration name>]
Using Targets Files ( see page 109)
Installing More Computer Languages ( see page 110) If you have installed RAD Studio with only one or two computer languages
(Delphi, C#, C++), and you later decide to add a language that was not originally
installed, follow the steps below.
Linking Delphi Units Into an Application ( see page 111) When compiling an application that references a Delphi-produced assembly, you
can link the Delphi units for that assembly into your application. The compiler will
link in the binary DCUIL files, which will eliminate the need to distribute the
assembly with your application.
Previewing and Applying Refactoring Operations ( see page 111) You can preview most refactoring operations in the Refactoring pane. Some
refactorings occur immediately and allow no preview. You might want to use the
preview feature when you first begin to perform refactoring operations. The
preview shows you how the refactoring engine evaluates and applies refactoring
operations to various types of symbols and other refactoring targets. Previewing
is set as the default behavior. When you preview a refactoring operation, the
engine gathers refactoring information in a background thread and fills in the
information as the information is collected.
If you apply a refactoring operation right away, it is performed in... more ( see
page 111)
Renaming a Symbol ( see page 112) You can rename symbols if the original declaration symbol is in your project, or if
a project depended upon by your project contains the symbol and is in the same
open project group. You can also rename error symbols.
Working with Named Option Sets ( see page 113)
104
2.1 Compiling and Building Procedures RAD Studio (Common) Building Packages
2. On the Build Configuration Manager, select a configuration from the Configuration name list. The list includes all the
available configurations you have created in the project group, including the default configurations (Debug and Release).
3. In Available projects, select the project or projects that you want to use the selected configuration. Selecting a configuration
name causes the Available projects list to display the names of the projects that are associated with that configuration. The
Available projects list also includes the Active Configuration for each project.
4. To designate the selected Configuration name as the active configuration for the projects you've selected, click Apply.
Tip: To select all the available projects, click Select All
.
Tip: To clear all selections in the Available Projects
list, click Clear All.
105
Creating Build Events RAD Studio (Common) 2.1 Compiling and Building Procedures
106
2.1 Compiling and Building Procedures RAD Studio (Common) Creating Named Build Configurations for
107
Building a Project Using an MSBuild RAD Studio (Common) 2.1 Compiling and Building Procedures
and select Activate, or choose Project Configuration Manager and click Apply.
See Also
MSBuild Overview ( see page 4)
108
2.1 Compiling and Building Procedures RAD Studio (Common) Using Targets Files
109
Linking Delphi Units Into an Application RAD Studio (Common) 2.1 Compiling and Building Procedures
110
2.1 Compiling and Building Procedures RAD Studio (Common) Previewing and Applying Refactoring
If you apply a refactoring operation right away, it is performed in a background thread also, but a modal dialog blocks the UI
activity. If the refactoring engine encounters an error during the information gathering phase of the operation, it will not apply the
refactoring operation. The engine only applies the refactoring operation if it finds no errors during the information gathering
phase.
111
Working with Named Option Sets RAD Studio (Common) 2.1 Compiling and Building Procedures
To apply refactorings
1. Open a project.
2. Locate a symbol name in the Code Editor.
3. Select the symbol name.
4. Right-click to display the context menu.
5. Select Refactoring Rename 'symbol type' where symbol type is one of the valid types, such as method, variable, or field.
This displays the Rename Symbol dialog.
6. Type a new name in the New name text box.
7. Click OK. As long as the View references before refactoring check box is not selected, the refactoring occurs immediately.
Warning: If the refactoring engine encounters errors, the refactoring is not applied. The errors are displayed in the Message
Pane
.
2 See Also
Refactoring Overview ( see page 57)
To rename a symbol
1. Select the symbol name in the Code Editor.
2. Right-click to display the drop-down context menu.
3. Select Refactoring Rename 'symbol type' ' symbol name' where symbol type is either method, variable, or field, and
symbol name is the actual name of the selected symbol. This displays the Rename dialog box.
4. Enter the new name in the New Name text box.
5. If you want to preview the changes to your project files, select the View References Before Refactoring check box.
Note: The menu commands are context-sensitive. If you select a method, the command will read Rename Methodmethod
name where method name is the actual name of the method you have selected. This context-sensitivity holds true for all other
object types, as well.
See Also
Refactoring Overview ( see page 57)
112
2.1 Compiling and Building Procedures RAD Studio (Common) Working with Named Option Sets
113
RAD Studio (Common) 2.2 Debugging Procedures
Topics
Name Description
Adding a Watch ( see page 116) Add a watch to track the values of program variables or expressions as you step
over or trace into code. Each time program execution pauses, the debugger
evaluates all the items listed on the Active tab (or ActiveWatchGroup) in the
Watch List window and updates their displayed values.
You can organize watches into groups. When you add a watch group, a new tab
is added to the Watch List window and all watches associated with that group
are shown on that tab. When a group tab is displayed, only the watches in that
group are evaluated during debugging. By grouping... more ( see page 116)
Using the CPU View ( see page 116) The CPU view displays the assembly language code for your program.
Displaying Expanded Watch Information ( see page 117) When you debug an application, you can inspect the values of members within a
watched object whose type is a complex data object (such as a class, record, or
array). These values display in the Watch List window when you expand a
watched object. Additionally, you can expand the elements within an object,
displaying its sub-elements and their values. You can expand all levels in the
object. Members are grouped by ancestor.
Attaching to a Running Process ( see page 117) You can attach to a process that is running on your computer or on a remote
computer. This is useful for debugging a program that was not created with RAD
Studio.
Setting and Modifying Breakpoints ( see page 118) Breakpoints pause program execution at a certain location or when a particular
condition occurs. You can set source breakpoints and module load breakpoints in
the Code Editor before and during a debugging session. You can set data
breakpoints and address breakpoints only when the application is running in
2 debug mode (F9),
Procedures described in this Topic:
114
2.2 Debugging Procedures RAD Studio (Common) Adding a Watch
Modifying Variable Expressions ( see page 124) After you have evaluated a variable or data structure item, you can modify its
value. When you modify a value through the debugger, the modification is
effective for the program run only. Changes you make through the
Evaluate/Modify dialog box do not affect your source code or the compiled
program. To make your change permanent, you must modify your source code in
the Code Editor, then recompile your program.
Preparing a Project for Debugging ( see page 124) While most debugging options are set on by default, you can use the following
procedures to review and change those options. There are both general IDE
options and project specific options. The project specific options vary based on
the active project type, for example, Delphi, Delphi .NET, or C#.
Remote Debugging: Metaprocedure ( see page 125) Remote debugging lets you debug a RAD Studio application running on a remote
computer. Once the remote debug server is running on the remote computer, you
can use RAD Studio to connect to that computer and begin debugging.
Installing, Starting, and Stopping the Remote Debug Server ( see page 125) Remote debugging lets you debug a RAD Studio application running on a remote
computer. Once the remote debug server is running on the remote computer, you
can use RAD Studio to connect to that computer and begin debugging.
Prerequisites and security considerations for remote debugging
115
Displaying Expanded Watch Information RAD Studio (Common) 2.2 Debugging Procedures
You can organize watches into groups. When you add a watch group, a new tab is added to the Watch List window and all
watches associated with that group are shown on that tab. When a group tab is displayed, only the watches in that group are
evaluated during debugging. By grouping watches, you can also prevent out-of-scope expressions from slowing down stepping.
To add a watch
1. Choose Run Add Watch to display the Watch Properties dialog box.
2. In the Expression field, enter the expression you want to watch. An expression consists of constants, variables, and values
contained in data structures, combined with language operators. Almost anything you can use as the right side of an
assignment operator can be used as a debugging expression, except for variables not accessible from the current execution
point.
3. Optionally, enter a name in the Group Name field to create the watch in a new group, or select a group name from the list of
previously defined groups.
4. Specify other options as needed (click Help on the Watch Properties dialog for a description of the options). For example,
you can request the debugger to evaluate the watch, even if doing so causes function calls, by selecting the Allow Function
Calls option.
5. Click OK.
2 The watch is added to the Watch List window.
See Also
Watch Properties ( see page 948)
116
2.2 Debugging Procedures RAD Studio (Common) Setting and Modifying Breakpoints
Inspecting and Changing the Value of Data Elements ( see page 122)
2
117
Setting and Modifying Breakpoints RAD Studio (Common) 2.2 Debugging Procedures
Icon Description
The breakpoint is valid and enabled. The debugger is inactive.
The breakpoint is valid and enabled. The debugger is active.
The breakpoint is invalid and enabled. The breakpoint is set at an
invalid location, such as a comment, a blank line, or invalid
declaration.
The breakpoint is valid and disabled. The debugger is inactive.
The breakpoint is valid and disabled. The debugger is active.
The breakpoint is invalid and disabled. The breakpoint is set at an
invalid location.
118
2.2 Debugging Procedures RAD Studio (Common) Setting and Modifying Breakpoints
gutter, choose Tools Options Editor Options Display and adjust the Gutter width option.
3. In the Add Source Breakpoint dialog box, the file name is prefilled with the name of the file, and Pass count is set to 0
(meaning that the breakpoint fires on the first pass). In the Line number field, enter the line in the Code Editor where you
want to set the breakpoint.
4. To apply a condition to the address breakpoint, enter a conditional expression in the Condition field. The conditional
expression is evaluated each time the breakpoint is encountered, and program execution stops when the expression
evaluates to True.
5. To associate the source breakpoint with a breakpoint group, enter the name of a group or select from the Group dropdown
list.
6. To set any of the Advanced options, see the help topic ( see page 938) for the Add Address Breakpoint or Add Data
Breakpoint dialog box.
Note: To quickly set a breakpoint on a line of source code, click the left gutter of the Code Editor
next to the line of code where you want to pause execution.
119
Setting and Modifying Breakpoints RAD Studio (Common) 2.2 Debugging Procedures
To modify a breakpoint
1. Open the Breakpoints List by selecting View Debug Windows Breakpoints. Right-click the icon for the breakpoint you
want to modify. For a source breakpoint, you can right-click the breakpoint icon in the Code Editor gutter, and choose
Breakpoint Properties.
2. Set the options in the Breakpoint Properties dialog box to modify the breakpoint. For example, you can set a condition,
create a breakpoint group, or specify an action that is to occur when execution reaches the breakpoint.
3. Click Help for more information about the options on the dialog box.
4. Click OK.
120
2.2 Debugging Procedures RAD Studio (Common) Debugging VCL for .NET Source Code
expression evaluates to false (or zero), the debugger does not stop at the breakpoint location.
To change the color of the text at the execution point or the color of breakpoints
1. Choose Tools Options Editor Options Color.
2. In the code sample window, select the appropriate language tab. For example, to change the breakpoint color for Delphi code,
select the Delphi tab.
3. Scroll the code sample window to display the execution and breakpoint icons in the left gutter of the window.
4. Click anywhere on the execution point or breakpoint line that you want to change.
5. Use the Foreground Color and Background Color dropdown lists to change the colors associated with the selected
execution point or breakpoint.
6. Click OK.
Note: You can also set breakpoints in the Breakpoint List
, the CPU window (and the Disassembly view), the Call Stack view, and the Modules window.
See Also
Add Address Breakpoint or Add Data Breakpoint dialog box ( see page 938)
2
Add Module Load Breakpoint dialog box ( see page 1019)
121
Inspecting and Changing the Value of Data RAD Studio (Common) 2.2 Debugging Procedures
6. Right-click the assembly and choose Link in Delphi Units. This sets the Link Units property to True in the Object Inspector.
7. Repeat the previous two steps for each CodeGear assembly that you want to debug.
You are now able to debug VCL for .NET source code.
Tip: You can use this procedure to debug VCL for .NET assemblies produced by a third party if the debug DCUILs for those
assemblies are available.
See Also
Linking Delphi Units Into an Application ( see page 111)
122
2.2 Debugging Procedures RAD Studio (Common) Modifying Variable Expressions
Inspector is especially useful for examining compound data objects, such as arrays and linked lists. Because you can inspect
individual items displayed in the Debug Inspector, you can perform a walkthrough of compound data objects by opening a
Debug Inspector on a component of the compound object.
123
Preparing a Project for Debugging RAD Studio (Common) 2.2 Debugging Procedures
Warning: Modifying values (especially pointer values and array indexes), can have undesirable effects because you can
2 overwrite other variables and data structures. Use caution whenever you modify program values from the debugger.
124
2.2 Debugging Procedures RAD Studio (Common) Installing, Starting, and Stopping the
See Also
Debugger Options ( see page 836)
Use the following set of procedures to debug an application running on a remote machine
1. To enable debugging on a machine without the full IDE installation, see Installing a Debugger on a Remote Machine ( see
page 126)
2. To connect the local machine to the remote machine, see , Establishing a Connection for Remote Debugging ( see page
127)
3. To generate program files to be copied to the remote machine, see , Preparing Files for Remote Debugging ( see page 128)
See Also
Remote Debugging Overview
Remote debugging lets you debug a RAD Studio application running on a remote computer. Once the remote debug server is
running on the remote computer, you can use RAD Studio to connect to that computer and begin debugging.
125
Installing a Debugger on a Remote Machine RAD Studio (Common) 2.2 Debugging Procedures
[hostname:]port] where:
1. hostname is an optional host name or TCP/IP address for binding to a particular host, for example, somehost or
127.0.0.1. If you specify hostname, you must also specify :port.
2. port is an optional (required if hostname is specified) port number or standard protocol name, for example, 8000 or ftp. If
omitted, 64447 is used as the port number. Examples:
3. rmtdbg105.exe
4. rmtdbg105.exe -listen 8000
5. rmtdbg105.exe -listen somehost:8000
6. rmtdbg105.exe -listen 127.0.0.1:8000
After the remote debug server is started, its icon appears in the Windows taskbar.
2
2.2.13 Installing a Debugger on a Remote Machine
To debug a project on a machine that does not have RAD Studio installed, you must install the remote debugger executable
files. You can install these files either directly from the installation disk or by copying them from a machine that has RAD Studio
installed.
126
2.2 Debugging Procedures RAD Studio (Common) Establishing a Connection for Remote
• bordbk105N.dll
• comp32x.dll
• dbkpro100.dll
• DCC100.DLL
3. Copy the files from your local machine to the directory you created on the remote machine.
4. On the remote computer, register bordbk105.dll and bordbk105n.dllby running the regsvr32.exe registration utility.
For example, on Windows XP, enter C:\Windows\System32\regsvr32.exe bordbk105.dll at the command prompt,
then enter C:\Windows\System32\regsvr32.exe bordbk105n.dll.
5. If you are debugging an ASP.NET application, copy Borland.dbkasp.dll to the Install\GlobalAssemblyCache directory on the
remote machine. If you are debugging an ASP.NET application, register the Borland.dbkasp.dll in the GlobalAssemblyCache
using the Microsoft .NET gacutil.exe utility. For example, on Windows XP with Microsoft .NET Framework SDK, enter
C:\Program Files\Microsoft.NET\SDK\v1.1\Bin\gacutil Borland.dbkasp.dll.
See Also
Overview of Remote Debugging ( see page 12)
Note: If the remote machine uses the firewall included with Windows XP service pack 2, you will receive a message asking
whether CodeGear remote debugging service should be allowed. You must indicate that this is allowed.
Warning: The connection between RAD Studio and the remote debug server is a simple TCP/IP socket, with neither encryption
nor authentication support. Therefore, the remote debug server should not be run on a computer that can be accessed over the
network by untrusted clients.
127
Preparing Files for Remote Debugging RAD Studio (Common) 2.2 Debugging Procedures
9. Click the Load button. This connects the IDE on the local machine to the debugger on the remote machine.
Once this connection is established, you can use the IDE on the local machine to debug the application as it runs on the remote
machine.
Note: You cannot interact directly with the remote application through the remote debugger. For interactive debugging, you
can establish a remote desktop connection.
See Also
Overview of Remote Debugging ( see page 12)
2 2. For Delphi, choose Project Options Linker and verify that the Include remote debug symbols option is checked. This
directs the compiler to generate a symbol file. The following extensions are used in symbol files (for Delphi projects):
Setting the Search Order for Debug Symbol Tables ( see page 129)
128
2.2 Debugging Procedures RAD Studio (Common) Setting the Search Order for Debug
• Delphi Win32, does not use external symbol files because the compiler holds the symbols tables in memory. However, if you
are debugging a remote application, you must generate symbol files with the .RSM extension.
• Delphi.NET, VB.NET and C# symbol files use the .PDB extension.
• C++ symbol files use the .TDS extension. However, if debug information is contained in the PE file, external symbol tables are
not used.
To specify the global path for all projects (for Delphi and C++ only)
1. Choose Tools Options Debugger Options CodeGear Debuggers.
2. In the Debug symbols search path field, type or navigate to the path to the symbols table that you want the debugger to use.
3. Click OK.
129
Resolving Internal Errors RAD Studio (Common) 2.2 Debugging Procedures
can specify a path for Win32 and .NET symbol tables. They are searched in the following order during debugging:
1. Search path
2. Package output directory
3. DCP output directory
4. Output directory
2. In each of these fields, type or navigate to the path to the symbols table that you want the debugger to use.
3. Click OK.
Tip: Internal error numbers indicate the file and line number in the compiler where the error occurred. This information may help
Technical Support services track down the problem. Be sure to record this information and include it with your internal error
description.
130
2.2 Debugging Procedures RAD Studio (Common) Resolving Internal Errors
131
Resolving Internal Errors RAD Studio (Common) 2.2 Debugging Procedures
2. If you've tried your code on the latest release of the compiler and it is still reproducible, create the smallest possible test case
that will still reproduce the error and submit it to CodeGear. If it is not reproducible on the latest version, it is likely that the
problem has already been fixed.
List of all Delphi compiler errors and messages ( see page 311)
132
2.3 Deploying Applications RAD Studio (Common) Deploying the AdoDbx Client
Topics
Name Description
Deploying ASP.NET applications ( see page 133) The Deployment Manager can be used with ASP.NET applications to collect all
of the .aspx, asax, Web.config and other assembly files, as well as related
assemblies.
Deploying the AdoDbx Client ( see page 134) You can deploy AdoDbx Client applications in several ways.
133
Deploying the AdoDbx Client RAD Studio (Common) 2.3 Deploying Applications
134
2.3 Deploying Applications RAD Studio (Common) Deploying the AdoDbx Client
<configuration>
<system.data>
<DbProviderFactories>
<add name="AdoDbx Data Provider"
invariant="Borland.Data.AdoDbxClient"
description=".Net Framework Data Provider for dbExpress Drivers"
type="Borland.Data.TAdoDbxProviderFactory, Borland.Data.AdoDbxClient, Version=11.0.5000.0,
Culture=neutral, PublicKeyToken=a91a7c5705831a4f"/>
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="IBConnection"
connectionString="SomeName=IBCONNECTION;
drivername=Interbase;
database=someDatabasePathName\database.gdb;
rolename=RoleName;user_name=UserName;password=password;
sqldialect=3;localecode=0000;blobsize=-1;commitretain=False;waitonlocks=True;
interbase transisolation=ReadCommited;
trim char=False"
providerName="Borland.Data.AdoDbxClient"/>
</connectionStrings>
</configuration>
Note: Although this approach makes deployment easier, the TAdoDbxProviderFactory
can only create ADO.NET 2.0 objects for the AdoDbx Client provider.
See Also
AdoDbx Client Overview
135
RAD Studio (Common) 2.4 Editing Code Procedures
Topics
Name Description
Using Code Folding ( see page 137) Code folding lets you collapse (hide) and expand (show) your code to make it
easier to navigate and read. RAD Studio generates code that contains code
folding regions, but you can add your own regions as needed.
Creating Live Templates ( see page 138) While using the Code Editor, you can add your favorite code constructs to the
Template Manager to create a library of the templates you use most often.
Creating Template Libraries ( see page 138) Template libraries are custom project templates that specify how a project should
look and what it should contain. When you create a custom template library, it is
placed in the New Files dialog box where is accessible for creating a project
using File New.
You can create template library projects from scratch, or you can use projects
previously created by you or other developers as the basis for template libraries.
To use an existing project, you simply create an XML file with the extension
.bdstemplatelib which describes the project and is used to create the
template library using that... more ( see page 138)
Customizing Code Editor ( see page 141) CodeGear RAD Studio lets you customize your Code Editor by using the
available settings to modify keystroke mappings, fonts, margin widths, colors,
syntax highlighting, and indentation styles.
Finding References ( see page 141) The Find References refactoring feature helps you locate any connections
between a file containing a symbol you intend to rename and other files where
that symbol also appears. A preview allows you to decide how you want the
refactoring to operate on specific targets or on the group of references as a
whole.
2 Finding Units and Using Namespaces (Delphi, C#) ( see page 142) Depending on which language you are using, you can use a refactoring feature
to locate namespaces or units. If you are using C#, you can use the Use
Namespace command to import namespaces into your code files, based on an
object in your code. If you are using Delphi, you can use the Find Unit command
to locate and add units to your code file based on objects in your code.
The Use Namespace dialog appears when you select a C# object name and
select the Use Namespace command. The import operation attempts to identify
and display the most likely... more ( see page 142)
Recording a Keystroke Macro ( see page 142) 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.
Refactoring Code ( see page 143) Refactoring refers to the capability to make structural changes to your code
without changing the functionality of the code. Code can often be made more
compact, more readable, and more efficient through selective refactoring
operations. RAD Studio provides a set of refactoring operations that can help you
re-architect your code in the most effective and efficient manner possible.
Refactoring operations are available for Delphi, C#, and C++. However, the
refactorings for C# and C++ are limited in number. You can access the
refactoring commands from the Refactoring menu or from a right-click context
menu while in the Code Editor.... more ( see page 143)
Using Bookmarks ( see page 145) You can mark a location in your code with a bookmark and jump directly to it from
anywhere in the file. You can set up to ten bookmarks. Bookmarks are preserved
when you save the file and available when you reopen the file in the Code Editor.
Using Class Completion ( see page 145) Class completion automates the definition of new classes by generating skeleton
code for Delphi class members that you declare.
Using Code Insight ( see page 146) Code Insight (sometimes referred to as Code Completion) is a set of features
in the Code Editor and the HTML Tag Editor that provide code completion,
display code parameter lists, and show tool tips for expressions and symbols.
The hint window list box filters out all interface method declarations that are
referred to by property read or write clauses. The list box displays only properties
and stand-alone methods declared in the interface type.
136
2.4 Editing Code Procedures RAD Studio (Common) Using Code Folding
Using Live Templates ( see page 148) Live templates are reusable code statements that are accessible from the Code
Editor. You can insert pre-defined code segments into your code or add your
own code snippets to the Template window.
Note: If a template has one or more jump points that are editable, it will
automatically enter SyncEdit mode when you are inserting it into your code. The
jump points allow you to navigate between different areas of the template, using
the Tab
key and SHIFT+Tab keys. Pressing ESC, Enter,(or pressing theTab key) from
the last jump point exits SyncEdit mode and puts the... more ( see page 148)
Using the History Manager ( see page 149) The History Manager lets you view and compare versions of a file, including
multiple backup versions, saved local changes, and the edit buffer of unsaved
changes.
For simplicity, the following procedures uses a small text file to introduce the
functionality of the History Manager. However, the History Manager is available
for most files, including source code and HTML files.
Using Sync Edit ( see page 150) The Sync Edit feature lets you simultaneously edit indentical identifiers in
selected code. For example, in a procedure that contains three occurrences of
label1, you can edit just the first occurrence and all the other occurrences will
change automatically.
137
Creating Template Libraries RAD Studio (Common) 2.4 Editing Code Procedures
You can create template library projects from scratch, or you can use projects previously created by you or other developers as
the basis for template libraries. To use an existing project, you simply create an XML file with the extension .bdstemplatelib
which describes the project and is used to create the template library using that project.
Note: When creating a project to use with a template library, the project should be located in a subdirectory that contains no
other projects. Also, all of the files that are in the project should be located within the subdirectory or its child subdirectories.
138
2.4 Editing Code Procedures RAD Studio (Common) Creating Template Libraries
• The id="" attribute of the <TemplateLibrary> element should be something unique to avoid conflicts with other template
libraries. A good practice is to include your name or the name of your company as part of the id.
• The Creator="" attribute in the <Item> element specifies which page of the New Items dialog box displays the icon for this
template library. You can put the project icon on a specific page for the type of project it creates. Below are the possible 2
Creator="" attribute values:
139
Creating Template Libraries RAD Studio (Common) 2.4 Editing Code Procedures
To use this template library for creating a new project, choose File New Other, and select your template library in the New
files dialog box.
Example
<TemplateLibrary Version="1.0" id="CompanyXYZASPWebSiteProject">
<Name>ASPWebSiteProject<Name/>
<Description>ASP.NET WebSite Project Template<Description/>
<Items>
<Item id="ASPWebSiteProject" Creator="AspDelphiProjectRepositoryCreator">
<Name>ASP.NET WebSite Project<Name/>
<Description>ASP.NET WebSite<Description/>
<Author>John Smith<Author/>
<Icon>ASPWebsiteProject\ASPWebsiteProjectIcon.ico<Icon/>
<Projectfile>ASPWebSiteProject.dproj</Projectfile>
<DefaultProjectName>ASPWebSiteProject<DefaultProjectName/>
<FilePath>ASPWebSiteProject<FilePath/>
</Item>
</Items>
</TemplateLibrary>
If you have several related projects, you can use a single .bdstemplatelib template library file to list all the projects.
2 Example
<TemplateLibrary Version="1.0" id="CodeGearASPWebSiteProject">
<Name>ASPWebSiteProject<Name/>
<Description>ASP.NET WebSite Project Template<Description/>
<Items>
<Item id="ASPWebSiteProject" Creator="AspDelphiProjectRepositoryCreator">
<Name>ASP.NET WebSite Project<Name/>
<Description>ASP.NET WebSite Project<Description/>
<Author>CodeGear<Author/>
<Icon>ASPWebsiteProject\ASPWebsiteProjectIcon.ico<Icon/>
<Projectfile>ASPWebSiteProject.dproj</Projectfile>
<DefaultProjectName>ASPWebSiteProject<DefaultProjectName/>
<FilePath>ASPWebSiteProject<FilePath/>
</Item>
<Item id="ASPWebSiteProjectMP" Creator="AspDelphiProjectRepositoryCreator">
<Name>ASP.NET WebSite Project Master Page<Name/>
<Description>ASP.NET WebSite Project Master Page<Description/>
<Author>CodeGear<Author/>
<Icon>ASPWebsiteProjectMP\ASPWebsiteProjectMPIcon.ico<Icon/>
<Projectfile>ASPWebSiteProjectMP.dproj</Projectfile>
<DefaultProjectName>ASPWebSiteProjectMP<DefaultProjectName/>
<FilePath>ASPWebSiteProjectMP<FilePath/>
</Item>
<Item id="ASPWebSiteProjectForm" Creator="AspDelphiProjectRepositoryCreator">
<Name>ASP.NET WebSite Project Information Form<Name/>
<Description>ASP.NET WebSite Information Form<Description/>
<Author>CodeGear<Author/>
<Icon>ASPWebsiteProjectForm\ASPWebsiteProjectFormIcon.ico<Icon/>
<Projectfile>ASPWebSiteProjectForm.dproj</Projectfile>
<DefaultProjectName>ASPWebSiteProjectForm<DefaultProjectName/>
<FilePath>ASPWebSiteProjectForm<FilePath/>
</Item>
</Items>
140
2.4 Editing Code Procedures RAD Studio (Common) Finding References
</TemplateLibrary>
See Also
Overview of Template Libraries ( see page 50)
The Find References refactoring feature helps you locate any connections between a file containing a symbol you intend to
rename and other files where that symbol also appears. A preview allows you to decide how you want the refactoring to operate
on specific targets or on the group of references as a whole.
2. Click the Refactor Delete icon at the top of the Find References window, to delete the selected item and any item in that
141
Recording a Keystroke Macro RAD Studio (Common) 2.4 Editing Code Procedures
result set.
Note: Deleting items from the Find References
window does not delete them from your actual code files or your project.
The Use Namespace dialog appears when you select a C# object name and select the Use Namespace command. The import
2 operation attempts to identify and display the most likely namespaces. You can select multiple namespaces to add to the using
clause. The feature works identically in Delphi, although in a Delphi project, the operation attempts to find the appropriate unit
containing the definition of the selected object, then adds the selected unit to the uses clause.
See Also
Refactoring Overview ( see page 57)
To record a macro
1. In the Code Editor, click the record macro button at the bottom of the code window to begin recording.
2. Type the keystrokes that you want to record.
3. When you have finished typing the keystroke sequence, click the stop recording button .
4. To record another macro, repeat the previous steps.
Note: Recording a macro replaces the previously recorded macro.
The macro is now available to use during the current IDE session.
142
2.4 Editing Code Procedures RAD Studio (Common) Refactoring Code
To run a macro
1. In the Code Editor, position the cursor in the code where you want to run the macro.
2. Click the macro playback button to run the macro. If the button is dimmed, no macro is available.
Refactoring operations are available for Delphi, C#, and C++. However, the refactorings for C# and C++ are limited in number.
You can access the refactoring commands from the Refactoring menu or from a right-click context menu while in the Code
Editor.
The Undo capability is available for all refactoring operations. Some operations can be undone using the standard Undo
(CTRL+Z) menu command, while the rename refactorings provide a specific Undo feature.
To rename a symbol
1. In the Code Editor, click the identifier to be renamed. The identifier can be a method, variable, field, class, record, struct,
interface, type, or parameter name.
2. From either the main menu or the Code Editor context menu, choose Refactor Rename.
2
3. In the Rename dialog box, enter the new identifier in the New Name field.
4. Leave View references before refactoring checked. If this option is unchecked, the refactoring is applied immediately,
without a preview of the changes.
5. Click OK. The Refactorings dialog box displays every occurrence of the identifier to be changed.
6. Review the proposed changes in the Refactorings dialog box and use the Refactor button at the top of the dialog box to
perform all of the refactorings listed. Use the Remove Refactoring button to remove the selected refactoring from the dialog
box.
To declare a variable
1. In the Code Editor, click anywhere in a variable name that has not yet been declared.
Note: Any undeclared variable will be highlighted with a red wavy underline by Error Insight.
2. From either the main menu or the Code Editor context menu, choose Refactor Declare Variable. If the variable has
already been declared in the same scope, the command is not available.
3. Fill in the Declare New Variable dialog box as needed.
4. Click OK.
The variable declaration is added to the procedure, based on the values you entered in the Declare New Variable dialog box.
To declare a field
1. In the Code Editor, click anywhere in a field name that has not yet been declared.
2. From either the main menu or the Code Editor context menu, choose Refactor Declare Field.
3. Fill in the Declare New Field dialog box as needed.
143
Refactoring Code RAD Studio (Common) 2.4 Editing Code Procedures
4. Click OK.
The new field declaration is added to the type section of your code, based on the values you entered in the Declare New Field
dialog box.
Note: If the new field conflicts with an existing field in the same scope, the Refactorings
dialog box is displayed, prompting you to correct the conflict before continuing.
To convert a string constant to a resource string (for the Delphi language only)
1. In the Code Editor, select the quoted string to be converted to a resource string, for example, in the following code, insert the
cursor into the constant Hello World:
procedure foo;
begin
writeLn('Hello World');
end;
2 2. From either the main menu or the Code Editor context menu, choose Refactor Extract Resource String.
Note: You can also use the Shift+Ctrl+L
keyboard shortcut. The Extract Resource String dialog box is displayed.
3. Enter a name for the resource string or accept the suggested name (the Str, followed by the string).
4. Click OK.
The resourcestring keyword and the resource string are added to the implementation section of your code, and the original
string is replaced with the new resource string name.
resourcestring
strHelloWorld = 'Hello World';
procedure foo;
begin
writeLn(StrHelloWorld);
end.
144
2.4 Editing Code Procedures RAD Studio (Common) Using Class Completion
5. Click OK.
The uses or using clause is updated with the selected units or namespaces.
See Also
Refactoring Overview ( see page 57)
To set a bookmark
1. In the Code Editor, right-click the line of code where you want to set a bookmark. The Code Editor context menu is
displayed.
2. Choose Toggle Bookmarks Bookmark n, where n is a number from 0 to 9. A bookmark icon is displayed in the left
gutter of the Code Editor.
Tip: To set a bookmark using the shortcut keys, press CTRL+SHIFT
and a number from 0 to 9.
2
To jump to a bookmark
1. In the Code Editor, right-click to display the context menu.
2. Choose GoTo Bookmarks Bookmark n, where n is a number from 0 to 9.
Tip: To jump to a bookmark using the shortcut keys, press CTRL
and the number of the bookmark. For example, CTRL+1 will jump you to the line of code set at bookmark 1.
To remove a bookmark
1. In the Code Editor, right-click to display the context menu.
2. Choose Toggle Bookmarks Bookmark n, where n is the number of the bookmark you want to remove. The bookmark icon
is removed from the left gutter of the Code Editor.
Tip: To remove all bookmarks from a file, choose Clear Bookmarks
.
145
Using Code Insight RAD Studio (Common) 2.4 Editing Code Procedures
procedure TMyButton.DoSomething;
begin
2 end;
option on the Tools Options Explorer page determines whether class completion completes property declarations.
The hint window list box filters out all interface method declarations that are referred to by property read or write clauses. The list
box displays only properties and stand-alone methods declared in the interface type.
146
2.4 Editing Code Procedures RAD Studio (Common) Using Code Insight
one in this help topic give more details about some of the Code Insight settings.
3. Click OK.
147
Using Live Templates RAD Studio (Common) 2.4 Editing Code Procedures
usingcodeinsight.xml
Note: If a template has one or more jump points that are editable, it will automatically enter SyncEdit mode when you are
inserting it into your code. The jump points allow you to navigate between different areas of the template, using the Tab
key and SHIFT+Tab keys. Pressing ESC, Enter,(or pressing theTab key) from the last jump point exits SyncEdit mode and
puts the Code Editor back into regular edit mode. See the link at the end of this topic for more information about SyncEdit.
148
2.4 Editing Code Procedures RAD Studio (Common) Using the History Manager
For simplicity, the following procedures uses a small text file to introduce the functionality of the History Manager. However, the
History Manager is available for most files, including source code and HTML files.
149
Using Sync Edit RAD Studio (Common) 2.4 Editing Code Procedures
History Manager
150
2.5 Getting Started Procedures RAD Studio (Common)
Topics
Name Description
Adding Components to a Form ( see page 152)
Adding References ( see page 153) You can integrate your legacy COM servers and ActiveX controls into managed
applications by adding references to unmanaged DLLs to your project, and then
browse the types just as you would with managed assemblies.
Adding and Removing Files ( see page 153) You can add and remove a variety of file types to your projects.
Adding Templates to the Object Repository ( see page 153) You can add your own objects to the Object Repository as templates to reuse
or share with other developers. Reusing objects lets you build families of
applications with common user interfaces and functionality to reduce
development time and improve quality.
Copying References to a Local Path ( see page 154) During runtime, assemblies must be in the output path of the project or in the
GAC for deployment. If your project contains a reference to an object that is not
in one of the two locations, the reference must be copied to the appropriate
output path.
Creating a Component Template ( see page 154) You can save selected, preconfigured components on the current form as a
reusable component template accessible from the Tool Palette.
Creating a Project ( see page 155)
Customizing the Form ( see page 155)
Customizing the Tool Palette ( see page 156)
Customizing Toolbars ( see page 156)
Disabling Themes in the IDE and in Your Application ( see page 157) Both Windows Vista and Windows XP support themes in the user interface. By
default, the IDE uses themes, and runtime themes are enabled for the application
2
itself. If you prefer or if you require the classic user interface style, you can
disable the use of themes in the IDE and in your application.
Docking Tool Windows ( see page 157) The Auto-Hide feature lets you undock and hide tool windows, such as the
Object Inspector, Tool Palette, and Project Manager, but still have access to
them.
Finding Items on the Tool Palette ( see page 158)
Exploring .NET Assembly Metadata Using the Reflection Viewer ( see page You can open and explore the namespaces and types contained with a .NET
158) assembly. The assembly metadata is displayed in the Reflection viewer, whose
left pane contains a tree structure of the namespaces and types within the
assembly. The right pane displays specific information on the selected item in the
tree. The Call Graph tab shows you a list of the methods called by the selected
method, as well as a list of the methods that call the selected method.
You can open multiple .NET assemblies in the Reflection viewer. Each open
assembly is displayed in the tree in the... more ( see page 158)
Exploring Windows Type Libraries ( see page 159) You can open and inspect the interfaces and other types contained within a
Windows type library. The type library contents are displayed in a Windows
Explorer-style presentation, with a left pane containing a tree of the interface and
type definitions within the type library. The right pane displays specific
information on the selected item in the tree. The Type Library Explorer can
open a .TLB file, as well as OCX controls, and .DLL and .EXE files that have
type libraries as embedded resources.
Installing Custom Components ( see page 160)
Renaming Files Using the Project Manager ( see page 160) Renaming a file changes the name of the file in both the Project Manager and
on disk.
Saving Desktop Layouts ( see page 161) To switch between desktop layouts, choose a layout from the drop-down list box
located on the Desktop toolbar.
This procedure describes how to save your current desktop layout so that your
own layout is available from the View Desktops submenu and from the toolbar.
Setting Component Properties ( see page 161) After you place your components on your Designer, set their properties using the
Object Inspector. By setting a component’s properties, you can change the way
a component appears and behaves in your application. Because properties
appear during designtime, you have more control over a component’s properties
and can easily modify them without having to write additional code.
151
Adding References RAD Studio (Common) 2.5 Getting Started Procedures
Setting Dynamic Properties ( see page 161) Many of the .NET Framework objects support dynamic properties. Dynamic
properties provide a way to change property values without recompiling an
application. The dynamic properties and their values are stored in a configuration
file, along with the application's executable file. Changing a property value in the
configuration file causes the change to take effect the next time the applications
runs. Dynamic properties are useful for changing an application after it has been
deployed.
Setting Project Options ( see page 162) You can manage application and compiler options for your project. Making
changes to your project only affects the current project. However, you can also
save your selections as the default settings for new projects.
Setting C++ Project Options ( see page 163) You can manage application and compiler options for your project. Making
changes to your project only affects the current project. However, you can also
save your selections as the default settings for new projects.
Setting Properties and Events ( see page 164) Properties, methods, and events are attributes of a component.
Setting The IDE To Mimic Delphi 7 ( see page 164) Use this procedure to set the IDE to mimic Delphi 7 or C++Builder, where each
pane is its own window.
Setting Tool Preferences ( see page 165) You can customize the appearance and behavior of many tools and features,
such as the Object Inspector, Code Editor, and integrated debugger.
Using Design Guidelines with VCL Components ( see page 165) You can use VCL or VCL.NET (with Delphi or C++) to setup components that are
"aware" of their relation to other components on a form. You can set properties to
specify the distance between controls, shortcuts, focus labels, tab order, and
maximum number of items (listboxes, menus).
Using the File Browser ( see page 166) The File Browser is a standard Windows-style browser that you can undock
within the IDE. The context menu on the File Browser enables you to perform file
operations such as Cut, Copy, Delete and Rename. You can also add a file to
your project using the Add to project command.
Using To-Do Lists ( see page 166) A to-do list records and displays tasks that need to be completed for a project.
Using Virtual Folders ( see page 167) For C++ only, the IDE provides the ability to organize your project files with virtual
folders in the Project Manager tree. Virtual folders only affect the display of the
folder structure in the IDE. Moving files into virtual folders does not change their
actual location on disc.
Note: Virtual folders can only contain file system entries or other virtual folders.
Note: Changing the order of entries in a virtual folder changes the build order of
the contained buildable entries.
2 Writing Event Handlers ( see page 168) Your source code usually responds to events that might occur to a component at
runtime, such as a user clicking a button or choosing a menu command. The
code that responds to an occurrence is called an event handler. The event
handler code can modify property values and call methods.
152
2.5 Getting Started Procedures RAD Studio (Common) Adding Templates to the Object Repository
To add references
1. From the main menu, choose Project Add Reference. The Add Reference dialog box appears.
2. Select either a legacy COM type library or ActiveX control to integrate into your managed application.
3. Click Add Reference. The reference is added to the text box.
4. Click OK.
Tip: You can also right-click the References
folder in the Project Manager, and choose Add Reference.
153
Creating a Component Template RAD Studio (Common) 2.5 Getting Started Procedures
2
2.5.6 Creating a Component Template
You can save selected, preconfigured components on the current form as a reusable component template accessible from the
Tool Palette.
154
2.5 Getting Started Procedures RAD Studio (Common) Customizing the Tool Palette
properties, and create or modify event handlers for them, just as if you had placed each component in a separate operation.
155
Customizing Toolbars RAD Studio (Common) 2.5 Getting Started Procedures
156
2.5 Getting Started Procedures RAD Studio (Common) Docking Tool Windows
157
Exploring .NET Assembly Metadata Using RAD Studio (Common) 2.5 Getting Started Procedures
2 3. To remove the search filter from the Tool Palette, click the filter icon .
See Also
Adding Components to the Tool Palette ( see page 160)
You can open multiple .NET assemblies in the Reflection viewer. Each open assembly is displayed in the tree in the left-pane;
the top-level node for a .NET assembly is denoted by the icon.
158
2.5 Getting Started Procedures RAD Studio (Common) Exploring Windows Type Libraries
159
Saving Desktop Layouts RAD Studio (Common) 2.5 Getting Started Procedures
open a .TLB file, as well as OCX controls, and .DLL and .EXE files that have type libraries as embedded resources.
To rename a file
1. In the Project Manager, right-click the file that you want to rename. The context menu is displayed.
2. Choose Rename.
3. Enter the new name for the file. If the file has associated files that appear as child nodes in the Project Manager tree, those
files are automatically renamed.
See Also
Tour of the IDE ( see page 34)
160
2.5 Getting Started Procedures RAD Studio (Common) Setting Dynamic Properties
This procedure describes how to save your current desktop layout so that your own layout is available from the View Desktops
submenu and from the toolbar.
161
Setting Project Options RAD Studio (Common) 2.5 Getting Started Procedures
without recompiling an application. The dynamic properties and their values are stored in a configuration file, along with the
application's executable file. Changing a property value in the configuration file causes the change to take effect the next time
the applications runs. Dynamic properties are useful for changing an application after it has been deployed.
162
2.5 Getting Started Procedures RAD Studio (Common) Setting C++ Project Options
You can manage application and compiler options for your project. Making changes to your project only affects the current
project. However, you can also save your selections as the default settings for new projects.
163
Setting The IDE To Mimic Delphi 7 RAD Studio (Common) 2.5 Getting Started Procedures
3. If an option's value differs from its parent configuration's value, its associated text is boldface.
4. Right-click the option and click Revert on the context menu. The option value changes to the parent configuration's value.
5. Click OK to accept the changes and close the dialog. Click Cancel to ignore the changes and close the dialog.
See Also
Tour of the IDE ( see page 34)
164
2.5 Getting Started Procedures RAD Studio (Common) Using the File Browser
You can use VCL or VCL.NET (with Delphi or C++) to setup components that are "aware" of their relation to other components
on a form. You can set properties to specify the distance between controls, shortcuts, focus labels, tab order, and maximum
number of items (listboxes, menus).
See Also
UI Design ( see page 15)
165
Using To-Do Lists RAD Studio (Common) 2.5 Getting Started Procedures
166
2.5 Getting Started Procedures RAD Studio (Common) Using Virtual Folders
Note: Virtual folders can only contain file system entries or other virtual folders. 2
Note: Changing the order of entries in a virtual folder changes the build order of the contained buildable entries.
167
Writing Event Handlers RAD Studio (Common) 2.5 Getting Started Procedures
3. Drag the file to the desired location in the virtual folder and release the mouse button.
168
2.6 Localization Procedures RAD Studio (Common) Adding Languages to a Project
Topics
Name Description
Adding Languages to a Project ( see page 169) You can add languages to your project by using the Satellite Assembly Wizard
(.NET) or Resource DLL Wizard (Win32). For each language that you add, the
wizard generates a resource module project in your project group. Each resource
module project is given an extension based on the language’s locale.
Editing Resource Files in the Translation Manager ( see page 170) After you have added languages to your project by using the Satellite Assembly
Wizard or Resource DLL Wizard, you can use the Translation Manager to view
and edit your resource files. You can edit resource strings directly, add translated
strings to the Translation Repository, or get strings from the Translation
Repository.
Setting the Active Language for a Project ( see page 171) After adding languages to your project with the Satellite Assembly Wizard or
the Resource DLL Wizard, the base language module is loaded when you
choose Run Run. However, you can load a different language module by
setting the active language for the project.
Setting Up the External Translation Manager ( see page 172) If you do not have the RAD Studio IDE, you can use the External Translation
Manager (ETM) to localize an application. To use ETM, the developer must
provide you with the required ETM files and project files.
Note: The Microsoft .NET Framework must be installed on your computer before
you install ETM.
Updating Resource Modules ( see page 173) When you add an additional resource, such as a button on a form, you must
update your resource modules to reflect your changes.
Using the External Translation Manager ( see page 173) Translators who do not have the RAD Studio IDE can use the External
Translation Manager (ETM) instead of the Translation Manager. The steps for 2
using the ETM are similar to those for the internal Translation Manager.
Note: ETM must be set up and operational on your computer before using the
following procedure. See in the link listed at the end of this topic for details.
169
Editing Resource Files in the Translation RAD Studio (Common) 2.6 Localization Procedures
Update or Overwrite. Choose Update to keep and modify the existing satellite assembly project. Choose Overwrite to create
a new, empty project and to delete the old project and any translations it contains. Click Next.
7. Review the summary of what the wizard will do and click Finish to create or update the resource modules for the languages
you have selected. If the wizard asks to generate a .drcil (.NET) or .drc (Win32) file, click Yes. Any project that uses its
own resource strings (instead of previously compiled .rc files) needs a .drcil or .drc file. If you are sure that no new files
are needed (because your project does not introduce any resource strings of its own), select Skip drcil files that are not
found in the final dialog. This prevents the wizard from generating, or asking to generate, files.
8. Click Yes to compile. Click OK to save your project group.
The generated projects contain untranslated copies of the resource strings in your original project. By default, the Translation
Manager is displayed, enabling you to begin translating the resource files.
170
2.6 Localization Procedures RAD Studio (Common) Setting the Active Language for a Project
4. Click the resource file you want to edit. The resource strings in the file are displayed in a grid in the right pane.
5. Click the field that you want to edit and type the new text directly in the grid, right-click the field and choose Edit to edit the
string in a dialog box, or click the Multi-line editor icon on the toolbar above the grid.
6. Optionally, enter a comment in the Comment field.
7. Optionally, set the translation status for the string by using the drop-down list in the Status field.
8. Click the Save Translation icon on the toolbar above the grid to update the resource file.
Tip: To display the original form or translated form, click the Show original form
and Show translated form icons in the toolbar above the grid.
171
Setting Up the External Translation RAD Studio (Common) 2.6 Localization Procedures
module is loaded when you choose Run Run. However, you can load a different language module by setting the active
language for the project.
Note: The Microsoft .NET Framework must be installed on your computer before you install ETM.
172
2.6 Localization Procedures RAD Studio (Common) Using the External Translation Manager
7. Navigate to the directory that contains the ETM files. Make sure that the Files of type filter is set to Designtime packages
(dcl*.bpl).
8. Select all of the designtime packages in the directory and click OK.
The designtime packages are registered and you can now begin using ETM.
173
Using the External Translation Manager RAD Studio (Common) 2.6 Localization Procedures
Manager. The steps for using the ETM are similar to those for the internal Translation Manager.
Note: ETM must be set up and operational on your computer before using the following procedure. See in the link listed at the
end of this topic for details.
4. Click the unit file that you want to edit. The resource strings in the file are displayed in a grid in the right pane.
5. Click the field that you want to edit and do one of the following:
• type the new text directly in the grid
• right-click the field and choose Edit to edit the string in a dialog box
• click the Multi-line editor icon on the toolbar above the grid
6. Optionally, enter a comment in the Comment field.
2 7. Optionally, set the translation status for the string by using the drop-down list in the Status field.
8. Click the Save Translation icon on the toolbar above the grid to update the resource file.
After you have finished the translations, you can send the translated files back to the developer to add to the project.
174
2.7 Managing Memory RAD Studio (Common) Configuring the Memory Manager
Topics
Name Description
Configuring the Memory Manager ( see page 175) This section describes how to configure the Memory Manager.
Note: You can change some memory manager configuration settings while the
Memory Manager is in use. All the configuration settings are global settings and
affect all threads that are using the Memory Manager. Unless otherwise stated,
all functions and procedures are thread safe.
These configuration options are for the local Memory Manager only. Setting
these options inside a library when the library is sharing the Memory Manager of
the main application will have no effect.
Increasing the Memory Address Space ( see page 176) This section describes how to extend the address space of the Memory Manager
beyond 2 GB.
Note: The default size of the user mode address space for a Win32 application is
2GB, but this can optionally be increased to 3GB on 32-bit Windows and 4GB on
64-bit Windows. The address space is always somewhat fragmented, so it is
unlikely that a GetMem request for a single contiguous block much larger than
1GB will succeed – even with a 4GB address space.
Monitoring Memory Usage ( see page 177) This section describes how to monitor the state of the Memory Manager.
The Memory Manager provides two procedures that allow the application to
monitor its own memory usage and the state of the process’ address space. Both
functions are thread safe.
Registering Memory Leaks ( see page 178) This section describes how to register and unregister expected memory leaks.
2
When you allocate memory that you don't expect to free, you can register it with
the Memory Manager. The Memory Manager adds it to a list of areas to ignore
when it checks for memory leaks. When you unregister a memory location, the
Memory Manager removes it from its list of expected memory leaks.
Sharing Memory ( see page 178) This section describes how to share memory using the Memory Manager. On
Win32, if a DLL exports routines that pass long strings or dynamic arrays as
parameters or function results (whether directly or nested in records or objects),
then the DLL and its client applications (or DLLs) must all share the same
memory manager. The same is true if one application or DLL allocates memory
with New or GetMem which is deallocated by a call to Dispose or FreeMem in
another module. There are two mutually exclusive methods through which the
Memory Manager can be shared between an application and... more ( see
page 178)
Note: You can change some memory manager configuration settings while the Memory Manager is in use. All the configuration
settings are global settings and affect all threads that are using the Memory Manager. Unless otherwise stated, all functions and
procedures are thread safe.
These configuration options are for the local Memory Manager only. Setting these options inside a library when the library is
sharing the Memory Manager of the main application will have no effect.
175
Increasing the Memory Address Space RAD Studio (Common) 2.7 Managing Memory
2. Select the appropriate memory block alignment for your application. Available block alignments are 8-byte (mba8byte) and
16-byte (mba16byte).
3. To change the memory block alignment, use the procedure SetMinimumBlockAlignment.
Note: Memory allocated through the Memory Manager is guaranteed to be aligned to at least 8-byte boundaries. 16-byte
alignment is useful when memory blocks will be manipulated using SSE instructions, but may increase the memory usage
overhead.
Increasing the Memory Manager Address Space Beyond 2GB ( see page 176)
Note: The default size of the user mode address space for a Win32 application is 2GB, but this can optionally be increased to
176
2.7 Managing Memory RAD Studio (Common) Monitoring Memory Usage
3GB on 32-bit Windows and 4GB on 64-bit Windows. The address space is always somewhat fragmented, so it is unlikely that a
GetMem request for a single contiguous block much larger than 1GB will succeed – even with a 4GB address space.
The Memory Manager provides two procedures that allow the application to monitor its own memory usage and the state of the
process’ address space. Both functions are thread safe.
Increasing the Memory Manager Address Space Beyond 2GB ( see page 176)
177
Sharing Memory RAD Studio (Common) 2.7 Managing Memory
When you allocate memory that you don't expect to free, you can register it with the Memory Manager. The Memory Manager
adds it to a list of areas to ignore when it checks for memory leaks. When you unregister a memory location, the Memory
Manager removes it from its list of expected memory leaks.
Note: When a DLL is statically linked to an application, the DLL is initialized before the application. The application will use the
memory manager of the DLL if the SimpleShareMem sharing method is used in both. Only the module that is sharing its memory
manager can change memory manager settings and retrieve memory manager statistics. Changing settings in any of the other
modules will have no effect, since their memory managers are not used.
It is possible, but rarely needed, to control the memory manager sharing mechanism manually.
To use ShareMem
1. List ShareMem as the first unit in the program and library uses clause. Your modules will become dependant on the external
178
2.7 Managing Memory RAD Studio (Common) Sharing Memory
To use SimpleShareMem
1. List SimpleShareMem as the first unit in the program and library uses clause in each of your modules. The module that is
initialized first will be the module that will share its memory manager. All modules initialized after that will use the memory
manager of the first module.
2. The module that is initialized first will be the module that will share its memory manager. All modules initialized after that will
use the memory manager of the first module.
See Also
Memory Management ( see page 644)
Increasing the Memory Manager Address Space Beyond 2GB ( see page 176)
179
Developing Tests RAD Studio (Common) 2.8 Unit Test Procedures
Topics
Name Description
Developing Tests ( see page 180) The structure of a unit test largely depends on the functionality of the class and
method you are testing. The Unit Test Wizards generate skeleton templates for
the test project, setup and teardown methods, and basic test cases. You can
then modify the templates, adding the specific test logic to test your particular
methods.
The following describes the procedures for creating a Unit Test Project and a Unit
Test Case. Follow these procedures in the order shown. You must create the
Unit Test Project prior to creating the associated test cases. The Unit Test Case
Wizard is available only if... more ( see page 180)
The following describes the procedures for creating a Unit Test Project and a Unit Test Case. Follow these procedures in the
2 order shown. You must create the Unit Test Project prior to creating the associated test cases. The Unit Test Case Wizard is
available only if the current active project is a Unit Test Project.
180
2.8 Unit Test Procedures RAD Studio (Common) Developing Tests
Delphi and C++ personalities, only the DUnit framework is supported, so you cannot change this value. For C#, only the NUnit
framework is supported.
• Test Runner: Choose either GUI or Console from the drop down list. The Console Test Runner directs output to the console.
The GUI Test Runner displays the results interactively in a GUI window, with results color-coded to indicate success or failure.
8. Click Finish. The Test Project Wizard generates the test project template. For the Delphi and C# personalities, this also
adds the necessary source references into the test project template; you can skip the next step. For C++Builder, you must
manually link the test project with the C++ classes you want to test; proceed to the next step.
9. For C++Builder, only: Link the new test project to the source to be tested. For C++Builder, you must manually link the test
project with the C++ code you want to test. You can use any of the following techniques to do this, as appropriate:
• Add the C++ code directly to the test project.
• Add an .obj file to the test project.
• Add a .lib file (either a static library or an import library for a DLL) to the test project.
• Include the header file that implements the class you want to test. See the next section, Adding files to a test project, for
instructions.
181
Developing Tests RAD Studio (Common) 2.8 Unit Test Procedures
default base TestCase class. In most cases, you can use the default. However, you can specify a custom TTestCase class
that you have created. In addition, if you are testing a hierarchy of objects, you can derive the new test case from the
TestCase class of a base object of the object being tested. This allows a derived class to inherit a test created for the base
type for that class.
9. Click Finish. The wizard generates a test case file with the name you specified.
182
2.9 Together Procedures RAD Studio (Common) Configuring Together
Topics
Name Description
Configuring Together ( see page 183) Together is flexibly configurable. Use the Options dialog window to tune
modeling features to best fit your requirements.
The Options dialog window provides a number of diagram customization
settings. You can configure the appearance and layout of the diagrams, specify
font properties, member format, and level of detail.
Together Refactoring Procedures ( see page 184) This section provides how-to information on using Together refactoring facilities.
Opening the UML 2.0 Sample Project ( see page 190)
Together Diagram Procedures ( see page 190) This section provides how-to information on using Together UML diagrams.
Together Documentation Generation Procedures ( see page 247) This section provides how-to information on using Together Documentation
Generation facilities.
Using Online Help ( see page 248)
Together Object Constraint Language (OCL) Procedures ( see page 248) This section provides how-to information on using Together OCL facilities.
Working with a Namespace or a Package ( see page 250) Namespaces are used in implementation projects, and packages in design
projects.
Together Pattern Procedures ( see page 251) This section provides how-to information on using patterns with Together.
Together Project Procedures ( see page 262) This section provides how-to information on using Together projects.
Together Quality Assurance Procedures ( see page 271) This section provides how-to information on using Together Quality Assurance
facilities.
The Options dialog window provides a number of diagram customization settings. You can configure the appearance and layout
of the diagrams, specify font properties, member format, and level of detail.
183
Together Refactoring Procedures RAD Studio (Common) 2.9 Together Procedures
Topics
Name Description
Refactoring: Changing Parameters ( see page 184)
Refactoring: Extracting Interfaces ( see page 185) The following conditions should be met for extracting interfaces:
3. In the resulting dialog, select parameter from the list and choose the desired action:
• To add a new parameter, click Add, and specify the parameter name, type and default value.
• To delete parameter, click Remove.
184
2.9 Together Procedures RAD Studio (Common) Together Refactoring Procedures
• To rename parameter, click the Name field, and edit the parameter name using the in-place editor.
4. If applicable, check Refactor Ancestors.
5. Check Preview Usages if necessary.
• If this option is checked when you click OK, the Refactoring window opens allowing you to review the refactoring before
committing to it. Click the Perform refactoring button to complete the changes. You can use the Undo and Redo commands
as necessary once you have performed the refactoring.
• If this option is cleared when you click OK, the Refactoring window opens with the change completed. You can use the Undo
and Redo commands as necessary once you have performed the refactoring.
See Also
Refactoring overview ( see page 98)
To extract an interface:
1. Select one or more code elements (class, interface, field, method, event, property, or indexer) in the Diagram View or Model 2
View.
2. On the main menu, chooseRefactoring Extract Interface
Tip: Alternatively, you can choose Refactoring->Extract Interface
on the context menu of the selection.
3. In the Extract interface dialog box, enter the name for the interface and designate its namespace, if applicable.
4. Specify the members to be used in the resulting interface by setting or clearing the respective check-boxes.
5. Click OK. The Refactoring window opens allowing you to review the refactoring before committing to it.
6. Click the Perform refactoring button to complete the extraction.
See Also
Refactoring Overview ( see page 98)
185
Together Refactoring Procedures RAD Studio (Common) 2.9 Together Procedures
186
2.9 Together Procedures RAD Studio (Common) Together Refactoring Procedures
be applied to.
3. Click OK to complete refactoring.
Warning: The variable that you select for creating an inline variable, should not be updated later in the source code. If it is,
the following error message will display: "Variable index is accessed for writing."
For example, if you use the Inline Variable refactoring command on the local variable, index, shown below:
public void findIndex() {
int index = 2;
System.Console.Writeline("Index is: {0}", index);
}
then the following refactoring occurs:
public void findIndex() {
System.Console.Writeline("Index is: {0}", 2);
}
See Also
Refactoring overview ( see page 98)
187
Together Refactoring Procedures RAD Studio (Common) 2.9 Together Procedures
See Also
Refactoring overview ( see page 98)
To move a member:
1. Select member in the Diagram View or in the Model View.
Tip: In the editor, place the mouse cursor on the member name.
2. Choose Refactoring Pull Members Up/Push Members Down on the context menu or on the main menu.
3. In the resulting dialog box, specify additional information required to make the move.
• In the top pane of the dialog box, check the members to be moved.
• In the bottom pane of the dialog box, that shows the class hierarchy tree, select the target class.
4. Click OK.
188
2.9 Together Procedures RAD Studio (Common) Together Refactoring Procedures
5. In the Refactoring window that opens, review the refactoring before committing to it. Click the Perform refactoring button to
complete the move.
Tip: Moving members is more complicated than moving classes among namespaces, because class members often contain
references to each other. A warning message is issued when Pull Members Up or Push Members Down has the potential for
corrupting the syntax if the member being moved references other class members. You can choose to move the class
member and correct the resulting code manually.
See Also
Refactoring overview ( see page 98)
Tip: In order to make renaming overloads possible, the method should have its override
To rename an element:
1. Select element in the Diagram View or in the Model View.
Tip: In the editor, place the mouse cursor on the element name.
189
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
See Also
Refactoring overview ( see page 98)
2
2.9.4 Together Diagram Procedures
This section provides how-to information on using Together UML diagrams.
Topics
Name Description
Annotating a Diagram ( see page 195)
Creating a Diagram ( see page 196) When you create a new diagram, the Diagram View presents an empty
background. You place the various model elements on the background and draw
relationship links between them according to the requirements of your model.
Exporting a Diagram to an Image ( see page 197)
Printing a Diagram ( see page 197) You can print diagrams separately or as a group, or print all diagrams in the
project.
Changing Diagram Notation ( see page 197)
Using Grid and Other Appearance Options ( see page 198) You can optionally display or hide a design grid on the diagram background and
have elements “snap” to the nearest grid coordinate when you place or move
them. The grid is configured in the Diagram Appearance options dialog window.
Using the UML in Color Profile ( see page 198)
Aligning Model Elements ( see page 199) You can automatically rearrange all or selected model elements on a diagram.
Changing Type of a Link ( see page 199)
Closing a Diagram ( see page 200)
Copying and Pasting Model Elements ( see page 200) The move and copy operations are performed by drag-and-drop, context menu
commands, or keyboard shortcut keys.
Note: You can move or copy an entire diagram. In this case, all elements
addressed on this diagram are not copied, and a new diagram contains shortcuts
to these elements.
Deleting a Diagram ( see page 200) Warning: The default diagram which is created automatically for a namespace
(package) cannot be deleted.
190
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
Hyperlinking Diagrams ( see page 201) Select Hyperlinks from the diagram context menu to create, view, remove, and
browse hyperlinks.
Laying Out a Diagram Automatically ( see page 202)
Moving Model Elements ( see page 203) Create your own layout by selecting and moving single or multiple diagram
elements.
You can:
191
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
Creating a Shortcut ( see page 208) You can create a shortcut to a model element on the diagram background by
using three methods:
192
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
Working with a UML 1.5 Message ( see page 215) This section describes techniques for working with messages in Sequence and
Collaboration diagrams. Although the two diagram types are equivalent, the
techniques for dealing with messages differ.
In a Collaboration diagram, all messages between the two objects are displayed
as a generic link line, and a list of messages is created above it. The link line is
present as long as there is at least one message between the objects. Messages
display in time-ordered sequence from top to bottom of the messages list. In
addition to the message links, you can add links that show association and
aggregation relationships. These... more ( see page 215)
Designing a UML 1.5 Statechart Diagram ( see page 217) Following are tips and techniques that you can use when working with UML 1.5
Statechart Diagram.
Creating a Pin ( see page 217)
Designing a UML 2.0 Activity Diagram ( see page 218) Use the following tips and techniques when you design a UML 2.0 Activity
Diagram. Usually you create Activity Diagrams after State Machine Diagrams.
Grouping Actions into an Activity ( see page 219)
Working with an Object Flow or a Control Flow ( see page 219) You can create control flow or object flow as an ordinary link between the two
node elements. The valid nodes are highlighted when the link is established.
You can scroll to the target element if it is out of direct reach, or you can use the
context menu command to avoid scrolling.
There are certain limitations stipulated by UML 2.0 specifications:
193
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
194
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
Working with a Constructor ( see page 243) You can create as many constructors in a class as needed.
In design projects, a constructor is created as an operation with the
<<constructor>> stereotype.
In implementation projects, each new constructor is created with its unique set of
parameters. In addition to creating parameters automatically, you can define the
custom set of parameters, using the Object InspectorProperties Window.
Tip: You can move, copy and paste constructors and destructors between the
container classes same way as the other members.
Working with a Field ( see page 243) This topic applies to implementation projects only.
In the source code, it is possible to declare several fields in one line. This
notation is represented in diagram as a number of separate entries in the Fields
section if a class icon. However, you can rename the fields, change modifiers, set
initial values and so on, all modifications being applied to the respective field in
the diagram icon. Also you can copy and move such fields in diagram (using
context menu commands or drag-and-drop), and the pasted field appears in the
target container separately.
Associating a Message Link with a Method ( see page 244) Message links can be associated with the methods of the recipient class. The
methods can be selected from the list of existing ones or can be created. This is
done by two commands provided by the message context menu: Add and
Choose method.
You can use the Operation field in the Object InspectorProperties Window to
rename the method. A dialog box appears asking if you want to create a new
method or rename the old one.
Generating an Incremental Sequence Diagram ( see page 245) You can generate incremental sequence diagrams from a previously-generated
sequence diagram. In some cases, you can have generated a sequence diagram
with a low nesting value such as 3 or 5. The nesting value limits how deep the
parser traverses the source code calling sequence.
Creating a Browse-Through Sequence of Diagrams ( see page 246) You can link entire diagrams at one level of detail to the next diagram up or down
in a sequence of increasing granularity, or you can link from key use cases or
actors to the next diagram.
Creating an Extension Point ( see page 246)
Designing Use Case Hierarchy ( see page 246) Use case diagrams typically represent the context of a system and system
requirements.
2
2.9.4.1 Annotating a Diagram
Use the following actions to annotate a diagram:
1. Draw an annotation
2. Draw an annotation link
3. Type comments
To draw an annotation:
1. In the Diagram View, you can:
• Hyperlink the note to another diagram or element.
• Edit the text when its in-place editor is active.
• Edit the properties of a note using Object Inspector.
• Add an existing note from one diagram to another diagram using a shortcut. (Select Add Shortcuts from any diagram
context menu.)
2. In the Object Inspector for the note, you can:
• Edit the text.
• Change the foreground and background colors.
• Change the text-only property.
195
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
To type comments:
1. To enter comments in the source code, use the Comment fields (Author, Since, Version) in the Object Inspector for the class.
2. You can also enter source code comments directly into the code using the Editor.
See Also
Annotation Overview ( see page 91)
To create a diagram:
1. In the Model View, right-click the target project.
2
Tip: Alternatively, you can use the shortcut CTRL+SHIFT+D
.
2. Select the target namespace (package) either in the Diagram View or in the Model View. If you do not select a custom
namespace (package), Together adds a new diagram to the default one.
3. Choose Add Other Diagram on the context menu.
4. In the Add New Diagram dialog box, choose the Diagrams tab.
5. Select the diagram type.
6. In the Name field, enter a name for the new diagram.
7. Click OK.
Result: The new diagram opens in a new tab in the Editor Window. You can use the Object Inspector to view and edit the
diagram properties.
To create a new diagram, use can also use the Hyperlink To New diagram command on the context menu of the Model View
or the Diagram View.
You can create a new logical class diagram using the context menu of the root node for your project, or by using the context
menu of a namespace element in the Model View. Choose either Add Class Diagram or Add Other Diagram. Choosing
the latter command opens the Add New Diagram dialog box. When you place a class, interface, or namespace on a logical
class diagram, Together generates the corresponding source code or descendent namespace in the namespace where this
class diagram is located.
See Also
Diagram Overview ( see page 90)
196
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
To print a diagram:
1. With the diagram in focus in the Diagram View, choose File Print from the main menu. The Print diagram dialog box 2
opens.
2. In the Print Diagrams list box, specify the scope of diagrams to be printed:
• Active diagram: To print the currently selected diagram.
• Active with neighbors: To print the current diagram and the other diagrams of the same project.
• All opened: To print all diagrams currently opened in the Diagram view.
• All in model: To print all diagrams within a project group.
3. In the Print zoom field, specify the zoom factor.
4. If necessary, adjust the page and printer settings:
• Click the Print list box and choose Print dialog box to select the target printer.
• Use the Options dialog window (Together (level) Diagram Print options) to set up the paper size, orientation, and
margins.
Tip: Click Preview to open the preview pane. Use the Preview zoom slider, or Auto Preview zoom check box, as required.
See Also
Diagram Print options ( see page 1094)
197
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
2. In UML 2.0 projects, you can change notation of interfaces to "ball and socket".
3. Adjust appearance options, including selection between UML or language formats.
Tip: Notation options are included in the Diagram ->Appearance
category of Together options.
4. Use the UML In Color profile.
5. Use stereotypes.
See Also
Diagram Layout Overview ( see page 92)
To show grid:
1. Open Options dialog window.
2. Choose the Together Diagram Appearance category, Grid group.
2 3. Adjust the options.
Note: Grid display and snap are enabled by default.
See Also
Diagram Appearance options ( see page 1089)
198
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
Result: The classifier changes its color according to the settings in the Options dialog window.
See Also
Supported UML Specifications ( see page 90)
2
2.9.4.9 Changing Type of a Link
Use the following techniques to change the type of a link:
1. Set the link type by using the Object Inspector
2. Set the link type by using the context menu
199
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
Note: You can move or copy an entire diagram. In this case, all elements addressed on this diagram are not copied, and a new
diagram contains shortcuts to these elements.
To copy an element:
1. Select the element or elements to be copied.
2. Do any of the following:
2 • Right-click and choose Copy on the context menu
• Press CTRL+C on the keyboard
3. Do any of the following:
• Right-click the target location and choose Paste on the context menu
• Select the target location and press CTRL+V
See Also
Creating a single element ( see page 209)
To delete a diagram:
1. In the Model View, select the diagram to be deleted.
2. On the context menu, choose Delete.
3. Confirm deletion, if required.
Result: The diagram is deleted from the project.
See Also
Creating a Diagram ( see page 196)
200
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
201
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
3. Click URL.
4. In the dialog box that opens, enter the appropriate URL and click OK.
Tip: You can create a hyperlink to an external document by entering a relative URL path.
7. To remove an element from the selected list, select the element and click Remove.
8. To clear the Recently used Documents list, click Clear.
Note: Items added to the Recently used Documents list are not specific to a single project or project group
.
9. Click OK to close the dialog box and create the link.
To browse hyperlinks:
1. To view hyperlinks to a diagram, element or external document, right-click on the diagram background or element, and
choose Hyperlinks from the context menu. All hyperlinks created appear under the Hyperlinks submenu. On a diagram, all
names of diagram elements that are hyperlinked are displayed in blue font. When you select a link from the submenu, the
respective element appears selected in the Diagram View.
2. Once you have defined hyperlinks for a selected diagram or element, use the context menus to browse to the linked
resources.
Note: Browsing to a linked diagram opens it in the Diagram View
or makes it the current diagram if already open. Browsing to a linked element causes its parent diagram to open or become
current, and the diagram scrolls to the linked element and selects it.
To remove a hyperlink:
2 1. Open the diagram that displays the link you want to remove.
2. Choose Hyperlinks Edit from the diagram or element context menu. The Edit Hyperlinks dialog box opens.
3. In the selected list on the right of the dialog, click the hyperlink that you wish to remove.
4. Click Remove.
5. Click OK to close the dialog box.
Note: To remove a hyperlink from a specific element, select the element first. Then choose Hyperlinks->Edit
on the context menu.
See Also
Hyperlinking Overview ( see page 92)
202
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
Note: Individual diagram elements also have the Route Links and Optimize Size layout commands on their respective
context menus. The Route Links command streamlines the links removing any bending points. The Optimize Size command
enlarges or shrinks the element to the optimal size, leaving enough space for its label and any sub elements it may contain.
Tip: To enable layout of the inner substructure in diagrams, check the Recursive
option ( (level) Diagram Layout General) in the Options dialog window.
You can:
To move an element:
1. Select the element or elements to be moved.
2. Drag-and-drop the selection to the target location.
Tip: Right-click and use Cut and Paste. Use the keyboard shortcuts for Cut (CTRL+X
), Copy (CTRL+C), and Paste (CTRL+V) operations.
See Also
Select Model Elements ( see page 205)
203
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
To rename a diagram:
1. In the Object Inspector, double-click the diagram name to initiate the inline editor.
2. Enter a new name.
3. Press Enter.
Alternatively:
1. Select the diagram in the Model View.
2. Press F2 or right-click and choose Rename on the context menu.
3. Enter a new name.
4. Press Enter.
Result: The diagram is renamed.
See Also
Creating a diagram ( see page 196)
204
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
205
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
Drag-and-drop functionality from the Model View to the Diagram View and within the Model View works as follows:
• Selecting an element in the Model View and using drag-and-drop to place the element onto the diagram creates a shortcut.
• Using drag-and-drop while pressing the SHIFT key moves the element to the selected container.
• Using drag-and-drop while pressing the CTRL key copies the element to the selected container.
Tip: You can also change the origin and destination for links on your diagrams using drag-and-drop.
206
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
5. Using the Add and Remove buttons, make up the list of user properties.
6. Click OK when ready.
Result: The User Properties category appears in the Object Inspector.
207
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
208
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
In an implementation project, you can create a link to another node or a shortcut of an element of the same project.
5. Click the diagram background in the place where you want to create the new element. This creates the new element and
activates the in-place editor for its name.
Tip: Alternatively, you can right-click the diagram background and choose Add on the context menu. The submenu displays
all of the basic elements that can be added to the diagram, and the Shortcuts command.
See Also
Creating Multiple Model Elements ( see page 207)
To search diagrams:
1. Choose Search->(search command) to use the find and replace facilities provided by the RAD Studio.
209
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
2. You can find the specified string in the specified scope. The function supports case sensitivity, searching for whole words or
substrings, using wildcards and regular expressions.
3. Browse the search results.
See Also
Searching source code for usages ( see page 210)
The Search for usages command is available on the context menu of an element in a diagram or in the Model View. Note that
Search for usages is not available for the design projects.
Command
Close
Close all
Close all but this
See Also
Searching Diagrams ( see page 209)
210
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
2. Create one or more activities. You can place several activities on a single swimlane, or create a separate swimlane for each.
Warning: You cannot create nested activities.
2
3. For convenient browsing, first model the main flow. Next, cover branching, concurrent flows, and object flows.
Tip: Use separate diagrams as needed and then hyperlink them.
4. Create Start, End, Signal Receipt, and Signal Sending elements for your swimlanes. If your activity has several Start
points, they can be used simultaneously.
5. Create object nodes. You do not link object nodes to classes on your Class Diagrams. However, you can use hyperlinks for
better understanding of your diagrams.
6. Create state nodes for your swimlanes.
Tip: You can create nested states.
211
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
design project or any implementation project in the same project group. In an implementation project, you can create an object
that instantiates a class or interface from the same project or some UML 1.5 design project or a referenced project. You can
create such links by using the Object Inspector or by using Dependency links to shortcuts.
To instantiate a classifier:
1. On a UML 1.5 class diagram, choose an object.
2. In the Object Inspector, choose the Instantiates field.
3. Click the Chooser button. The Choose Type to Instantiate dialog box opens.
4. In this dialog box, choose a classifier (class or interface).
Tip: Alternatively, draw a Dependency link
from this object to a classifier or its shortcut.
See Also
UML 1.5 Class diagram ( see page 1121)
2. Create a hierarchy of Components. The largest component can be the whole system or its major part (for example, server
application, IDE, service).
Tip: You can create nested component nodes. There are two methods for creating a nested component node: You can select
an existing component and add a child component inside. Alternatively, you can create two separate components and connect
them with an Association-Composition link.
212
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
2. Create a hierarchy of Components. The largest component can be the whole system or its major part (for example, server
application, IDE, service).
Tip: You can create nested Components. There are two methods for creating a nested component: You can select an
existing component and add a child component inside. Alternatively, you can create two separate components and connect
them with an Association-Composition link.
3. Represent how Components resides on Nodes. You can represent this in two ways:
• Use a supports link between the component and node. The supports link is a dependency link with the stereotype field set to
support.
• Graphically nest the Component within the Node.
4. Optionally, create Objects.
5. Create Interfaces. Each component can have an interface.
6. Indicate a temporary relationship between a Component and Node. Objects and components can migrate from one
component instance to another component instance, and respectively from one node instance to another node instance. In
such a case, the object (component) will be on its component (node) only temporarily. To indicate this, use the dependency
relationship with a becomes stereotype.
7. You can optionally create shortcuts to related elements of other diagrams. 2
See Also
Creating a Shortcut ( see page 208)
Alternatively:
1. Right-click an activation bar on a sequence diagram.
2. Choose Add Conditional Block on the context menu.
To set the type of the conditional block (if, for, and so on):
1. Open the Object Inspector.
2. Click the drop-down arrow for your choices.
213
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
See Also
UML 1.5 interaction diagrams ( see page 1131)
Note that an object can instantiate classifiers that belong to the various source-code projects within a single project group, when
such projects are referenced from the project in question.
To unlink an object:
1. Select an object.
2. On the context menu of the object choose Unlink class.
Result: The association is removed, but the classifier is preserved in the model.
214
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
To remove branching:
1. Select the message link to remove branching from.
2. Right-click the message link and choose Branching None on the context menu.
See Also
Working with UML 1.5 messages ( see page 215)
215
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
In a Collaboration diagram, all messages between the two objects are displayed as a generic link line, and a list of messages is
created above it. The link line is present as long as there is at least one message between the objects. Messages display in
time-ordered sequence from top to bottom of the messages list. In addition to the message links, you can add links that show
association and aggregation relationships. These links do not display if you view the diagram as a sequence diagram.
When you draw messages between objects in a sequence diagram, each message is represented by its own link line. Messages
in sequence diagrams have more editable properties than messages in collaboration diagrams.
216
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
2. On the sequence diagram, click the object lifeline element at the supplier end of the message link to draw the return link.
3. Create transitions.
4. Create history nodes.
2
5. You can optionally create shortcuts to related elements of other diagrams.
217
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
Alternatively:
1. Open the Tool Palette.
2. Choose the appropriate button, and click the target action.
See Also
Pin ( see page 1141)
2. Usually activities are linked to states or transitions on State Machine Diagrams. Switch to your State Machine Diagrams and
associate the activities you just created with states and transitions.
Tip: After that you can find that some more activities must be created, or the same activity can be used in several places.
3. Switch back to the Activity Diagram. Think about flows in your activities. You can have an object flow (for transferring data), a
2 control flow, both or even several flows in each activity.
4. Create starting and finishing points for every flow. Each flow can have the following starting points:
• Initial node
• Activity parameter (for object flow)
• Accept event action
• Accept time event action Each flow finishes with a Activity Final or Flow Final node. If your activity has several starting
points, they can be used simultaneously.
5. Create object nodes. You do not link object nodes to classes on your Class Diagrams. However, you can use hyperlinks for
better understanding of your diagrams.
6. Create action nodes for your flows. Flows can share actions.
Warning: You cannot create nested actions.
7. For object flows, add pins to actions. Connect actions and pins by flow links.
8. Add pre- and postconditions. You can create plain text or OCL conditions.
9. You can optionally create shortcuts to related elements of other diagrams.
218
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
See Also
Associating a Transition or a State with an Activity ( see page 230)
You can scroll to the target element if it is out of direct reach, or you can use the context menu command to avoid scrolling.
• Object flow link must have an object at least on one of its ends.
• It is impossible to connect two actions with an object flow except through an output pin on the source action.
• Control flow link may not connect objects and/or activity parameters.
219
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
To create a flow:
1. Right-click the source element of the flow.
2. On the context menu, choose Add Control Flow or Add Object Flow. The Choose Destination dialog box opens.
3. In the Choose Destination dialog box, select the target and click OK. Note that the OK button is only enabled when the valid
target is selected.
2. In the hierarchy of components, you can end up by adding concrete classes and instance specifications. You can create them
on a Component Diagram directly, or create them on a Class Diagram and put shortcuts on a Component Diagram.
3. Create interfaces. Each component can have a provided interface and a required interface.
4. Optionally, create artifacts. Usually, you describe physical artifacts of your system on Deployment Diagrams. But if some
component is closely connected with its physical store, add and link an artifact to a Component Diagram.
Tip: You can create nested artifacts.
220
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
5. Optionally, create ports for your components. You can attach a port to a component and link it with several classes or
components inside. In this case, when a message arrives, this port decides which class must handle it.
6. Draw links between elements.
7. You can optionally create shortcuts to related elements of other diagrams.
See Also
Working with a Provided or Required Interface ( see page 238)
221
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
See Also
UML 2.0 composite structure diagram ( see page 1146)
To bind the roles (parts) of the different classifiers via the collaboration use:
1. Create a collaboration use and define its type.
2. Create one or more parts in the collaboration that represents the type.
222
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
3. Right-click the target collaboration use and choose Bind new role on its context menu.
4. In the Select Destination dialog box that opens, choose the role to be bound in the target classifier.
Result: A role link is created from the collaboration use to the role in the target classifier. The role link is now marked with the
name of the role selected in the collaboration.
Note: Each role can be used for binding only once. With the next invocation of the Bind new role command, the list of
available roles no longer displays the ones previously used.
To define an owner:
1. Right-click a collaboration use and choose Object Inspector on its context menu.
2. In the owning classifier field of the Object Inspector, click the chooser button.
3. In the Select Owning Classifier dialog box, navigate to the owner class or collaboration and click OK.
Result: A link is created between the owner as supplier, and the collaboration use as the client. The link is marked with the label
<<represents>>.
See Also
UML 2.0 composite structure diagram ( see page 1146)
2. Create artifacts.
3. Create deployment and instance specifications. By doing this, you arrange physical locations of objects and other entities of
your system.
4. Add operations to artifacts.
5. Once an operation is added, you can define its properties in the Object Inspector, which includes parameters, stereotype,
multiplicity and more.
6. You can optionally create shortcuts to related elements of other diagrams.
223
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
2. In the Object Inspector, expand the General node and choose Parameters field.
3. Click the chooser button to open Add/Remove Parameters dialog box.
4. Click Add. This creates an entry in the parameters list.
5. Enter the parameter's name, type multiplicity, default value, and direction. Note that parameter type can be selected from the
list of pre-defined types, or from the model.
6. Using the Add and Remove buttons, create the list of parameters.
7. Click OK when ready.
See Also
Creating a Shortcut ( see page 208)
224
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
See Also
OCL Support Overview ( see page 95)
225
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
Whenever an interaction diagram is created, the corresponding interaction is added to the project. Interactions are represented
as nodes in the Model View.
depends on the view type defined in the Model View options on the default or project group levels. If model-centric mode is
selected, an interaction is shown both under its package node and diagram node. If diagram-centric mode is selected, an
interaction is shown under the diagram node only.
Note: You can view an interaction in two ways: as a Sequence Diagram, or as a Communication Diagram. So doing, any
actions performed with either view are automatically reflected in the other views. Thus, adding or deleting an element in an
interaction results in the modification of the corresponding interaction diagram, and vice versa. An interaction diagram contains a
reference to the underlying interaction.
Note: Unlike UML 1.5, it is not possible to switch a diagram that already exists from sequence to communication and vice versa.
However, it is possible to create a Sequence Diagram and a Communication Diagram based on the same interaction.
5. In the Choose Referenced Interaction dialog box, select the desired interaction from the project or Favorites, and click OK.
An interaction use is initially created attached to a lifeline. Further it can be expanded over several lifelines, detached from and
reattached to lifelines.
226
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
See Also
UML 2.0 Interaction Diagram Reference ( see page 1149)
227
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
diagram types are equivalent, the techniques for dealing with messages differ.
To nest messages:
1. You can nest messages by originating message links from an execution specification. The nested message inherits the
numbering of the parent message. For example, if the parent message has the number 1, its first nested message is 1.1.
2. It is also possible to create message links back to the parent execution specifications.
228
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
menu of the selection, choose Add Combined Fragment. This adds a combined fragment to the target location.
Result: the combined fragment is added to the target lifeline or execution specification. Each new combined fragment has
different color, to tell it from the other combined fragments within the same cluster of nested frames.
To create an operand:
1. Select the desired combined fragment in the Model View or in the Diagram View.
2. On the context menu of the combined fragment, choose Add Interaction operand. 2
3. In the Interaction constraint node select the language to be used for describing constraint. To do this, click the Language
drop-down list and choose OCL or plain text.
4. Type the constraint expression.
5. Add as many operands as required.
6. Apply changes.
Result: a new operand is created. Constraint text is displayed in the operand section of the combined fragment.
See Also
OCL Support Overview ( see page 95)
229
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
230
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
Field Description
Composite Set to True if there is one or more regions in this state (not editable)
Orthogonal Set to True if there are two or more regions in this state (not editable)
Simple Set to True if there are no regions in this state (not editable)
Do activity Specify the activity to be performed during execution of the current state by using the Object Inspector. This
activity may be selected from any Activity diagram of the project
Entry Specify the activity to be performed when the current state starts executing by using the Object Inspector. This
activity may be selected from any Activity diagram of the project
Exit Specify the activity to be performed when the current state finishes executing by using the Object Inspector. This
activity may be selected from any Activity diagram of the project
In the edit field below the list box enter the OCL expression for this state.
See Also
OCL Support Overview ( see page 95)
231
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
To design a UML 2.0 State Machine Diagram, follow this general procedure:
1. Create initial and final nodes.
2. Create main states and substates.
3. Create regions.
4. Create entry and exit points.
5. Create pins.
6. Create transitions.
7. Create history nodes.
8. You can optionally create shortcuts to related elements of other diagrams.
See Also
Creating a Shortcut ( see page 208)
232
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
To show or hide diagram elements using the Show Hidden dialog box:
1. Right-click the diagram and choose Show/Hide on the context menu. The Show Hidden dialog box opens.
2. Select the element(s) that you wish to hide from the Diagram Elements list.
3. To add elements in the Diagram Elements list to the Hidden Elements list, do one of the following:
• Double-click the element .
• Click the element once and click Add.
• Select multiple elements using CTRL+Click and click Add.
4. To remove items from the Hidden Elements list do one of the following:
• Double-click the element.
• Click the element once and click Remove.
• Select multiple elements using CTRL+Click and click Remove.
• To remove all items from the Hidden Elements list, click Remove All.
5. Click OK to close the dialog box.
See Also
Using View Filters ( see page 233)
To filter classes:
1. In the Options dialog window, View Filters page, click the Show members field.
2. Click the drop-down arrow and select False.
3. Click OK.
This results in disabling the members, and the inner classifiers (classes, delegates, enumerations, interfaces, and structures).
Since inner classifiers are treated as members of the container element, the following filters do not filter inner classifiers:
View filter
Show classes
Show delegates
Show enumerations
Show interfaces
233
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
Show structures
See Also
Hiding and Showing Model Elements ( see page 232)
You can resize the main state. You can also create a substate by drawing a state diagram within another state diagram and
indicating start, end, and history states as well as transitions.
Create a composite state by nesting one or more levels of states within one state. You can also place start/end states and a
history state inside of a state, and draw transitions among the contained substates.
To create a nested substate using the context menu of the state element:
1. Right-click the state (region) that will be the container.
2. Select Add State on the context menu.
Tip: You can nest multiple levels of substates inside one state. For especially complex substate modeling, however, you can
find it more convenient to create different diagrams, model each of the substate levels individually, and then hyperlink the
diagrams sequentially.
Using the Shortcuts command on the context menu of the diagram, you can reuse existing elements in other state diagrams.
Right-click the diagram and choose Add > Shortcuts, navigate within the pane containing the tree view of the available project
234
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
235
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
Alternatively:
1. Draw a transition between two activities (or states).
2
2. Drag the opposite end of the link line back to the desired activity (or state).
See Also
Creating a Simple Link ( see page 209)
236
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
237
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
238
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
This section includes instructions for adding inner classifiers to classes (including Windows classes, such as Windows forms,
Inherited forms, User Controls and so on), structures, and modules (collectively, containers) in implementation projects.
You can add inner classifiers to class diagram elements (containers) using the respective context menu for the diagram element
in the Diagram or Model Views. You can also select a classifier in the Tool PaletteToolbox and click the container element in the
Diagram View to add the inner classifier to the container element.
Tip: You can use drag-and-drop or clipboard operations to remove an inner classifier from the container element.
Using drag-and-drop:
1. Select an existing classifier in the Diagram View.
239
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
2. Drag-and-drop it onto a pre-existing container in the Diagram View. A blue border highlights the location that Together
recognizes as a valid destination for dropping the inner classifier.
See Also
Creating a Single Element ( see page 209)
To create an interface:
1. Create a class and an interface node elements using the and Tool PaletteToolbox buttons.
2. On the diagram Tool PaletteToolbox, click the Generalization link button.
3. Click the client class and drag the mouse cursor to the interface node.
To hide an interface:
1. Select an interface.
2. Right-click and choose Hide on the context menu.
Tip: You can hide all interfaces by disabling the Show Interfaces
view filter.
See Also
Changing Appearance of Interfaces ( see page 242)
240
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
241
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
242
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
See Also
Changing notation ( see page 197)
In implementation projects, each new constructor is created with its unique set of parameters. In addition to creating parameters
automatically, you can define the custom set of parameters, using the Object InspectorProperties Window.
Tip: You can move, copy and paste constructors and destructors between the container classes same way as the other
members.
2
2.9.4.88 Working with a Field
This topic applies to implementation projects only.
In the source code, it is possible to declare several fields in one line. This notation is represented in diagram as a number of
separate entries in the Fields section if a class icon. However, you can rename the fields, change modifiers, set initial values and
so on, all modifications being applied to the respective field in the diagram icon. Also you can copy and move such fields in
diagram (using context menu commands or drag-and-drop), and the pasted field appears in the target container separately.
To rename a field:
1. Choose a field.
2. Enter the new name in the in-place editor of the Diagram View or Model View, Name text field in the Object
InspectorProperties Window or the source code editor.
243
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
You can use the Operation field in the Object InspectorProperties Window to rename the method. A dialog box appears asking if
you want to create a new method or rename the old one.
Use the following techniques to associate a message link with a method (operation):
1. Create a new method for an existing message link
2 2. Associate an existing method with a message link
3. Unlink a method
244
2.9 Together Procedures RAD Studio (Common) Together Diagram Procedures
To unlink a method:
1. Select the message link.
2. On the context menu of the message link, choose Unlink method.
Result: An association between the message link and the operation is removed. However, the operation is preserved in the
recipient class.
If you unlink a classifier from an object and that object has incoming message links where the Operation property is set to a
method of the unlinked classifier, a dialog opens prompting you to unlink the method from the message link or save it as text.
Choosing the option to save as text places the Operation property in quotation marks and the operation displays in red on the
diagram. The intent of this feature is to help users to preserve all of the signatures of any methods that have been linked to
the message links. Upon instantiating the object with a class again, you can delete the quotation marks. This will open a
dialog box prompting you to create the method if it does not exist in the linked classifier. A dialog box does not open if the
signature of the method matches an existing method in the classifier. 2
See Also
Creating a simple link ( see page 209)
245
Together Diagram Procedures RAD Studio (Common) 2.9 Together Procedures
4. Create a hyperlink to the next diagram. The titles of source and destination elements turn blue.
5. Open the destination diagram.
6. Repeat steps 3–5 for all parts of your sequence.
2
7. Optionally, create hyperlinks in the reverse motion.
See Also
Hyperlinking Overview ( see page 92)
246
2.9 Together Procedures RAD Studio (Common) Together Documentation Generation
Topics
Name Description
Configuring the Documentation Generation Facility ( see page 247) To define the documentation title, header, footer and other specific settings, use
the Options dialog window.
Descriptions of the options are provided in the Options dialog window. You can
also find their descriptions in this online help.
Generating Project Documentation ( see page 248)
2
2.9.5.1 Configuring the Documentation Generation Facility
To define the documentation title, header, footer and other specific settings, use the Options dialog window.
Descriptions of the options are provided in the Options dialog window. You can also find their descriptions in this online help.
247
Together Object Constraint Language RAD Studio (Common) 2.9 Together Procedures
248
2.9 Together Procedures RAD Studio (Common) Together Object Constraint Language
Topics
Name Description
Creating an OCL Constraint ( see page 249)
Editing an OCL Expression ( see page 249)
Showing and Hiding an OCL Constraint ( see page 250)
249
Working with a Namespace or a Package RAD Studio (Common) 2.9 Together Procedures
See Also
OCL Support Overview ( see page 95)
250
2.9 Together Procedures RAD Studio (Common) Together Pattern Procedures
Topics
Name Description
Adding Participants to the Patterns as First Class Citizens ( see page 253) Patterns as First Class Citizens are represented by the GoF patterns. When such
patterns are applied, the elements are created with the standard number of
participants. However, you can add allowed participants to the existing pattern
object. If you add participants, links between the pattern object and the new
participants are created.
Creating a Pattern ( see page 253) You can use existing diagram elements as the basis to create custom patterns.
The newly created patterns are stored in the Pattern Registry. They become
visible in the pattern tree of the Pattern Organizer and can be used to generate
design elements in diagrams.
Deleting Patterns as First Class Citizens from the Model ( see page 254) You can delete elements of the patterns as First Class Citizens (GoF patterns),
using both the Diagram View and the Model View. If you delete elements, they
are removed from the diagram and from the model.
251
Together Pattern Procedures RAD Studio (Common) 2.9 Together Procedures
Using the Pattern Registry ( see page 254) The Pattern Registry is only available from the Pattern Organizer context menu,
when you create a new shortcut, or assign a pattern to a shortcut. In the Pattern
Registry you can filter patterns by category, metaclass, diagram type, language
or status of registration.
To open the Pattern Registry, do one of the following:
252
2.9 Together Procedures RAD Studio (Common) Together Pattern Procedures
Using the Pattern Organizer ( see page 261) The Pattern Organizer enables you to:
See Also 2
Patterns overview ( see page 96)
To create a pattern:
1. Select one or more elements on a diagram.
2. Right-click and choose Save as Pattern on the context menu of the selection. The Create Pattern Wizard opens.
3. On the General page of the wizard enter the following information:
• In the File field specify the target XML file name.
• In the Name field specify the name of the new pattern.
• Optionally, enter the pattern description in the Description field
• Optionally, check Create Pattern Object check box. Selecting this option allows you to use your pattern as a First Class
Citizen. This means that an oval pattern element will display on your diagrams when applying the pattern.
• Click Next.
253
Together Pattern Procedures RAD Studio (Common) 2.9 Together Procedures
254
2.9 Together Procedures RAD Studio (Common) Together Pattern Procedures
See Also
Patterns overview ( see page 96)
2
2.9.9.6 Creating a Model Element by Pattern
You can apply patterns explicitly using the Node by Pattern button in the Tool Palette or by using the right-click menu command
Create by Pattern. Whenever you create an element on a diagram using one of the toolbar buttons, you are applying a default
pattern that is connected to the selected button.
255
Together Pattern Procedures RAD Studio (Common) 2.9 Together Procedures
2. Click the source class and drag-and-drop the link to the destination class or interface. The Pattern Wizard dialog opens.
3. In the Pattern Wizard, expand the Standard folder and select Implementation link and stub.
4. Click OK to complete the stub implementation. The inheritance link is created and the stubs for the inherited methods are
generated in the source class.
To create an inheritance link with stub implementation using the Node by Pattern button:
1. Click the Node by Pattern button in the Tool Palette.
2. Select the source class on the diagram. The Pattern Wizard opens.
3. In the Pattern Wizard, expand the Standard folder, and select Implementation link and stub.
4. In the Pattern Properties pane on the right of the Pattern Wizard, click the information button to the right of the Supplier field.
The Select Supplier dialog opens.
5. Select the destination class or interface from the treeview of available contents and click Ok.
6. Click OK to complete the stub implementation and close the Pattern Wizard. The inheritance link is created and the stubs for
the inherited methods are generated in the source class.
To create an inheritance link with stub implementation using the Create by Pattern context menu:
1. Right-click the source class on the diagram and choose Create by Pattern from the context menu. The Pattern Wizard opens.
2. In the Pattern Wizard, expand the Standard folder and select Implementation link and stub.
3. In the Pattern Properties pane on the right of the Pattern Wizard, click the information button to the right of the Supplier field.
The Select Supplier dialog opens.
4. Select the destination class or interface from the treeview of available contents and click Ok.
5. Click OK to complete the stub implementation and close the Pattern Wizard. The inheritance link is created and the stubs for
the inherited methods are generated in the source class.
2
Note: You can find the Stub implementation pattern on the context menu of classes that inherit from an interface or an
abstract class. This pattern is also available in the Pattern Wizard by clicking the Node by Pattern button in the Tool Palette
, or by using the Create by Pattern context menu for a class. Use the Stub implementation pattern if you already have an
inheritance/generalization link drawn on the diagram and you want to copy the methods to the source class.
256
2.9 Together Procedures RAD Studio (Common) Together Pattern Procedures
To export a pattern:
1. In the Pattern Organizer window, expand the pattern tree and locate the folder to be exported.
2. Right-click the selected folder and choose Export folder.
3. In the Select path to export dialog box, navigate to the desired location, and click Save.
See Also
Creating a pattern ( see page 253)
257
Together Pattern Procedures RAD Studio (Common) 2.9 Together Procedures
258
2.9 Together Procedures RAD Studio (Common) Together Pattern Procedures
3. Right-click the destination node and choose Paste on the context menu. Alternatively, press CTRL+V
4. Save changes.
See Also
Pattern Organizer ( see page 1107)
2
2.9.9.14 Creating a Shortcut to a Pattern
In the Pattern Organizer you are working with shortcuts, not with the actual patterns. Because of this, shortcuts to the same
pattern may be included in several folders.
259
Together Pattern Procedures RAD Studio (Common) 2.9 Together Procedures
2. Right-click this node and choose New Pattern Tree. The New Pattern Tree node is added.
3. In the Properties section, edit the Name and Visible fields as required.
See Also
Creating a Folder ( see page 259)Creating a Shortcut to a Pattern ( see page 259)
260
2.9 Together Procedures RAD Studio (Common) Together Pattern Procedures
261
Together Project Procedures RAD Studio (Common) 2.9 Together Procedures
Topics
Name Description
Activating Together Support for Projects ( see page 263) This topic describes how to activate Together support for a project individually.
Tip: You can also force Together to activate support automatically for all new or
currently open projects by adjusting General options.
Creating a Project ( see page 264)
Exporting a Project to XMI Format ( see page 264)
Importing a Project in IBM Rational Rose (MDL) Format ( see page 265) IMPORTANT: For the MDL Import function to work, the Java Runtime
Environment and the Java Development Kit must be installed, and the paths in
the jdk.config file must correctly point to your JDK/JRE directory. See the first
step below
Importing a Project Created in TVS, TEC, TJB, or TPT ( see page 265) Together supports full backward compatibility with the previous version. You can
open your old projects in the regular way.
You can also import projects created in other editions of Together.
Warning: Diagrams in projects must be created in the common diagram format
.txv*. The legacy diagram format .df* is not supported.
Warning: Diagram elements must be embedded (created as filemates).
Standalone design elements (SDE) are not supported.
Importing a Project in XMI Format ( see page 266)
262
2.9 Together Procedures RAD Studio (Common) Together Project Procedures
Opening an Existing Project for Modeling ( see page 267) You can add modeling capabilities to an existing implementation project that was
created without Together.
When you open a project subdirectory from the Model View or Diagram View,
Together reverse engineers the contents into a namespace diagram that shows
the namespaces, classes, and interfaces and their interrelationships.
Synchronizing the Model View, Diagram View, and Source Code ( see page Together provides constant synchronization between different aspects of your
267) project:
263
Together Project Procedures RAD Studio (Common) 2.9 Together Procedures
264
2.9 Together Procedures RAD Studio (Common) Together Project Procedures
To create a design project on the base of an IBM Rational Rose (MDL) project:
1. Open [RAD Studio]5.0/bin/plugins/mdlimport/jdk.config and modify the javahome and addpath statements
to reflect the relative path from the jdk.config file to your JKD/JRE installation. For example,
javahome ../../../../../../../jdk1.4.2/jre
addpath ../../../../../../../jdk1.4.2/lib/tools.jar
Note: The path to the JDK/JRE should be without quotation marks.
2. On the main menu, choose File->New->Other. The New Project dialog box opens.
3. From the Project Types pane, choose Design Project.
4. From the Templates pane, choose Convert from MDL template.
5. Enter the project name, location and other parameters as required by the New Project dialog box.
6. Click OK.
7. In the Project from MDL wizard, specify the source .mdl, .ptl, .cat, or .sub file using the Add button.
8. Specify the scale factor and conversion options.
9. Click Finish.
2
Result: A new design project is created in the specified location.
See Also
Import and Export Features Overview ( see page 100)
Warning: Diagrams in projects must be created in the common diagram format .txv*. The legacy diagram format .df* is not
supported.
Warning: Diagram elements must be embedded (created as filemates). Standalone design elements (SDE) are not supported.
The general procedure for importing a project created in name="Delphi"TVS, TEC, TJB, or TPT consists of the following
steps:
1. Creating a new project in RAD Studio
2. Importing the model information into this project
265
Together Project Procedures RAD Studio (Common) 2.9 Together Procedures
• For a UML 1.x design project, choose Design project->UML 1.5 Design ProjectTogether design project->UML 1.5 Together
Design Project.
• For a UML 2.x design project, choose Design project->UML 2.0 Design ProjectTogether design project->UML 2.0 Together
Design Project.
3. Enter the project name.
Warning: The project name should be exactly equal to the source project name. Adjust the remainder of the settings on your
own.
2. In the Model View, right-click the root project node and choose Import Project from XMI, or choose File Import Project
from XMI on the main menu. The XMI Import dialog box opens.
3. Browse for the source file.
4. Click Import.
Tip: The recommended way to import a project from Together ControlCenter (TCC) or Together Architect (TAR) to RAD
Studio is to use the common diagram format.
266
2.9 Together Procedures RAD Studio (Common) Together Project Procedures
You can import a model created with IBM Rational Rose directly.
See Also
Import and Export Features Overview ( see page 100)
Importing a Project in IBM Rational Rose (MDL) Format ( see page 265)
When you open a project subdirectory from the Model View or Diagram View, Together reverse engineers the contents into a
namespace diagram that shows the namespaces, classes, and interfaces and their interrelationships.
You can navigate between the Model View, Diagram View, and source code by using the following techniques:
1. Navigate to a diagram from the Model View to the Diagram View
2. Navigate to a model element from the Model View to the Diagram View
3. Navigate from the Diagram View to the Model View
4. Navigate from a lifeline to its classifier in the Model View or a Class diagram
5. Navigate from source code to the Model View
6. Navigate from the Model View or Diagram View to source code (for implementation projects)
267
Together Project Procedures RAD Studio (Common) 2.9 Together Procedures
To navigate to a model element from the Model View to the Diagram View:
1. Select a model element in the Model View.
2. Right-click and choose Select on Diagram on the context menu.
Note: If this model element appears on several diagrams, choose a diagram on the submenu.
To navigate from a lifeline to its classifier in the Model View or a Class diagram:
1. Right-click the selected lifeline on a UML 2.0 Sequence diagram in the Diagram View.
2. Choose Select Type in Model View to navigate to the classifier in the Model View, Or: Choose Select Type on Diagram
to navigate to the classifier on a Class diagram in the Diagram View.
To navigate from the Model View or Diagram View to source code (for implementation projects):
1. Right-click a model element or a node member.
2. Choose Go to definition on the context menu.
Note: This command is available for source code-generating elements.
Result: Source code of the element in question opens in the Editor tab. The corresponding definition is highlighted.
Tip: To open source code of an entire class or interface, double-click the element icon.
268
2.9 Together Procedures RAD Studio (Common) Together Project Procedures
To refresh a model:
1. Open the Diagram View.
2. Press F6.
To reload a model:
1. Open the Model View.
2. Right-click the project root node and choose Reload on the context menu.
Note: Use the Reload command as a workaround for issues that might appear while making changes in Together that cause
269
Together Project Procedures RAD Studio (Common) 2.9 Together Procedures
some elements on the diagram to stop responding, or if you get errors from Together, such as, <undefined value>.
Tip: Usually, when these problems occur, the elements also disappear from the RAD Studio Structure View
and the corresponding source code is underlined in blue in the RAD Studio Editor. Together cannot always properly handle
such elements that become broken. To restore broken elements to a normal state, it is necessary to edit the code in the text
editor according to the recommendation shown in the RAD Studio Editor. In these cases, it is best to refresh the model using
Reload to prevent possible further misbehavior.
To fix a model:
1. For interaction diagrams: regenerate them from the source code.
2. For all types of diagrams: check that none of the necessary elements are hidden.
See Also
Synchronizing the Model View ( see page 267)
The Model View enables you to view class diagrams for references included in your projects. You can add references to your
project using the Project Manager.
270
2.9 Together Procedures RAD Studio (Common) Together Quality Assurance Procedures
Topics
Name Description
Exporting Audit Results ( see page 271) Export audit results to an XML or HTML file to share them with team members or
review them later.
Printing Audit Results ( see page 272) You can print the entire table of audit violations, or select specific rows and
columns.
Warning: This feature is available for implementation projects only.
Running Audits ( see page 273) Audits automatically check for conformance to standard or user-defined style,
maintenance, and robustness guidelines. Before running audits, make sure that
the code being audited is compilable. If your source code contains errors, or
some libraries and paths are not included, audits might produce inaccurate
results. 2
Warning: This feature is available for implementation projects only.
Viewing Audit Results ( see page 274) When viewing audit results, you can compare and organize items in the results
report.
The results report is tightly connected with the diagram elements and the source
code. Using the report, you can navigate to the specific location of the violation.
Warning: This feature is available for implementation projects only.
Working with a Set of Audits ( see page 274)
Creating a Metrics Chart ( see page 275) You can create a chart in the Metric Results Pane.
Metrics charts are created in temporary files which are deleted when the charts
are closed. However, you can save graphical information in text files, export it to
the desired graphical format, and include graphics in project.
Running Metrics ( see page 276) Before running metrics, make sure that the code being analyzed can be
compiled. If your source code contains errors or some libraries and paths are not
included, metrics might produce inaccurate results.
Warning: This feature is available for implementation projects only.
Viewing Metric Results ( see page 276)
Working with a Set of Metrics ( see page 277)
271
Together Quality Assurance Procedures RAD Studio (Common) 2.9 Together Procedures
• All Results: If the results are grouped, choosing All Results prints a report for all groups in the current tabbed page. If the
results are not grouped, then all results export for the current tabbed page.
• Active Group:If the results are grouped, you can select a group in the current tabbed page, and the generated report
contains the results from the selected group.
• Selected Rows: You can select single or multiple rows in the audit results report view. Choosing Selected Rows generates a
report for such selections.
4. Each tabbed page can contain a list of audits (when the audits are ungrouped) or a group tree with a list of the selected group
(when the audits are grouped).
Note: Unless the results have been grouped using the Group by command, the Active Group option is not enabled in the
dialog box.
Tip: You can use CTRL+CLICK
to select multiple rows.
5. In the Select Format list box, select the format for the exported file:
• XML: Generates an XML-based report.
• HTML: Generates an HTML-based report. Selecting HTML format activates the following check boxes:
• Add Description: This saves the audit descriptions in a separate folder with hyperlinks to the descriptions from the results
file.
• Launch Browser: This option opens the generated HTML file in the default viewer.
6. Click Save to save the results in the specified location.
See Also
Quality Assurance facilities overview ( see page 98)
272
2.9 Together Procedures RAD Studio (Common) Together Quality Assurance Procedures
dialog window.
5. If desired, specify the print zoom factor in the Print zoom field, or check Fit to page if you want to print the results on a single
page. If Fit to page is checked, the Print zoom field is disabled.
6. If necessary, adjust the page and printer settings:
• Click the Print list box, and choose the Print dialog box command to select the target printer.
• Choose Tools Options and open Together (level) Diagram Print options to set up the paper size, orientation, and
margins.
Tip: Click the drop-down arrow to the right of the Preview option to open the preview pane. Use the Preview zoom (auto)
slider, or Auto preview zoom check box as required. Click the upward arrow to the right of the Preview option to close the
preview pane.
7. Click Print to open the system print dialog box, and send the file to the printer.
See Also
Quality Assurance overview ( see page 98)
To run audits:
1. Open an implementation project.
2. Open the Model View.
3. Right-click the project root node. QA Audits on the context menu. The Audits dialog window opens.
4. In this dialog window:
• In the Scope list box, choose the code to run the set of audits on.
• Model processes the entire project.
• Selection processes only the specific classes, namespaces, or diagrams currently selected in the Diagram or Model View.
Tip: If you have not selected any items in the Diagram or Model View, the Scope option defaults to the entire project.
5. If you want to run audits on specific classes, namespaces, or diagrams, make sure you correctly select them before you open
the Audits dialog window.
6. Choose the audits to run. As you click an audit, the description for each audit is shown in the lower pane of the dialog box.
7. For each audit, the severity level and other audit-specific options are displayed in the right-hand panel of the Audits dialog
box. Change the settings if necessary.
8. When you have selected your set of audits, click Start. The Operation in progress dialog box opens displaying a status bar
that indicates the progress completed. The status bar will display until the process finishes.
273
Together Quality Assurance Procedures RAD Studio (Common) 2.9 Together Procedures
The Audits Results Pane opens automatically, displaying the results. In the results table, right-click any line to open the context
menu and use its commands to perform operations with the report.
See Also
Quality Assurance facilities overview ( see page 98)
The results report is tightly connected with the diagram elements and the source code. Using the report, you can navigate to the
specific location of the violation.
274
2.9 Together Procedures RAD Studio (Common) Together Quality Assurance Procedures
3. If you want to base your new saved set on the default set, click the Set default audit set button.
4. If you want to base it on a previously created custom set, click the Load set button, then choose the desired saved .adt file.
5. Go through the individual audits and check those you want to include in the set, or clear those you do not want to include.
6. Select all the items in a group by checking the group name.
7. When you complete your selection, click the Save set button, and specify the location and filename for new set file.
Metrics charts are created in temporary files which are deleted when the charts are closed. However, you can save graphical
information in text files, export it to the desired graphical format, and include graphics in project.
2
To create a bar chart:
1. Select a column that contains the result for the desired metric.
2. Right-click and choose Bar Chart.
To save a chart:
1. Right-click the chart tab and choose Save.
2. In the Save graph dialog box, navigate to the target location and click Save.
275
Together Quality Assurance Procedures RAD Studio (Common) 2.9 Together Procedures
See Also
Quality Assurance facilities overview ( see page 98)
To run metrics:
1. Open an implementation project.
2. Open the Model View.
3. Right-click the project root node. QA Metrics on the context menu. The Metrics dialog window opens.
4. In this dialog window:
• In Scope, choose what to run metrics on: Model processes the entire project.
• Selection processes only the specific classes, packages, or diagrams currently selected in the diagram or Model View.
5. Choose the metrics you want to analyze. Each metric displays a description in the lower panel of the Metrics dialog box.
Tip: If nothing is currently selected in the diagram or navigator view, the Selection scope is not available. If you want to run
metrics on specific classes, packages, or diagrams, make sure you correctly select them before you open the Metrics dialog
2 window.
6. For each metric there are settings for options such as limits and granularity in the right-hand panel of the Metrics dialog box.
Change the settings if necessary.
7. When you have selected your set of metrics, click Start.
Note: Metrics run in the command thread, so you cannot edit the project while they are being processed.
Result: The Metrics Results Pane opens automatically displaying the results.
See Also
Quality Assurance facilities overview ( see page 98)
276
2.9 Together Procedures RAD Studio (Common) Together Quality Assurance Procedures
To filter results:
1. You can filter the displayed results to improve the meaningfulness of the results report.
2. Use the following toolbar buttons to show and hide elements:
Button
Namespaces
Classes
Methods
Child elements
To update results:
1. You can update or refresh the results table.
2. Use the following Tool Palette buttons:
Button Description
Refresh Recalculate the results that are currently displayed
Restart Open the Metrics dialog window, define new settings and start new metrics analysis.
277
Together Quality Assurance Procedures RAD Studio (Common) 2.9 Together Procedures
7. When you complete your selection, click the Save set button, and specify the location and filename for new set file.
278
3 RAD Studio (Common)
3 Reference
Topics
Name Description
Delphi Reference ( see page 280) This section describes the Delphi language, Delphi compiler directives, and
errors that may arise in Delphi code.
RAD Studio Dialogs and Commands ( see page 730) This section contains help for dialogs and menu commands in the RAD Studio
user interface.
Keyboard Mappings ( see page 1068) The following topics list the keyboard mappings available in RAD Studio. Use the
Tools Options Editor Options Key Mappings page to change the default
keyboard mapping.
Command Line Switches and File Extensions ( see page 1082) The following topic lists the IDE command line switches and options.
Together Reference ( see page 1086) This section contains links to the reference material for UML modeling with
Together.
279
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
Topics
Name Description
Delphi Compiler Directives (List) ( see page 280) The following topic lists the RAD Studio compiler directives.
Delphi Compiler Errors ( see page 311) The following topics describe the various types of compiler errors and warnings,
along with resolutions to many issues you may face while using this product.
Delphi Language Guide ( see page 512) The Delphi Language guide describes the Delphi language as it is used in
CodeGear development tools. This book describes the Delphi language on both
the Win32, and .NET development platforms. Specific differences in the language
between the two platforms are marked as appropriate.
Topics
Name Description
Delphi compiler directives ( see page 282) Each Delphi compiler directive is classified as either a switch, parameter, or
conditional compilation directive.
A compiler directive is a comment with a special syntax. Compiler directives can
be placed wherever comments are allowed. A compiler directive starts with a $
as the first character after the opening comment delimiter, immediately followed
by a name (one or more letters) that designates the particular directive. You can
include comments after the directive and any necessary parameters.
Three types of directives are described in the following topics:
280
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
281
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
A compiler directive is a comment with a special syntax. Compiler directives can be placed wherever comments are allowed. A
compiler directive starts with a $ as the first character after the opening comment delimiter, immediately followed by a name (one
or more letters) that designates the particular directive. You can include comments after the directive and any necessary
parameters.
• Switch directives turn particular compiler features on or off. For the single-letter versions, you add either + or - immediately
after the directive letter. For the long version, you supply the word "on" or "off."
* Switch directives are either global or local.
• Global directives affect the entire compilation and must appear before the declaration part of the program or the unit being
compiled.
• Local directives affect only the part of the compilation that extends from the directive until the next occurrence of the same
directive. They can appear anywhere.
Switch directives can be grouped in a single compiler directive comment by separating them with commas with no intervening
spaces. For example:
{$B+,R-,S-}
• Parameter directives. These directives specify parameters that affect the compilation, such as file names and memory sizes.
• Conditional directives. These directives cause sections of code to be compiled or suppressed based on specified
conditions, such as user-defined conditional symbols.
All directives, except switch directives, must have at least one space between the directive name and the parameters. Here are
some examples of compiler directives:
{$B+}
{$STACKCHECKS ON}
{$R- Turn off range checking}
{$I TYPES.INC}
{$M 32768,4096}
{$DEFINE Debug}
{$IFDEF Debug}
{$ENDIF}
You can insert compiler directives directly into your source code. You can also change the default directives for the
command-line compiler, dccil and the IDE, bds.exe.
The Project|Options dialog box contains many of the compiler directives; any changes you make to the settings there will affect
all units whenever their source code is recompiled in subsequent compilations of that project. If you change a compiler switch
and compile, none of your units will reflect the change; but if you Build All, all units for which you have source code will be
recompiled with the new settings.
When using the command-line compiler, you can specify compiler directives on the command line; for example,
3 DCCIL -$R+ MYPROG
If you are working in the Code editor and want a quick way to see what compiler directives are in effect, press Ctrl+O O. You will
see the current settings in the edit window at the top of your file.
See Also
List of Compiler Directives ( see page 280)
Conditional Compilation
282
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
Remarks
The $A directive controls alignment of fields in Delphi record types and class structures.
In the {$A1} or {$A-} state, fields are never aligned. All record and class structures are packed.
In the {$A2} state, fields in record types that are declared without the packed modifier and fields in class structures are aligned
on word boundaries.
In the {$A4} state, fields in record types that are declared without the packed modifier and fields in class structures are aligned
on double-word boundaries.
In the {$A8} or {$A+} state, fields in record types that are declared without the packed modifier and fields in class structures are
aligned on quad word boundaries.
Regardless of the state of the $A directive, variables and typed constants are always aligned for optimal access. In the {$A8}
state, execution will be faster.
See Also
Record types ( see page 566)
Remarks
The $APPTYPE directive controls whether to generate a Win32 console or graphical user interface application.
3
In the {$APPTYPE GUI} state, the compiler generates a graphical user interface application. This is the normal state for a Delphi
application.
In the {$APPTYPE CONSOLE} state (equivalent to the /CC command-line option), the compiler generates a console application.
When a console application is started, the Input and Output standard text files are automatically associated with the console
window.
Setting {$APPTYPE CONSOLE} can be convenient for debugging as it allows you to use WriteLn statements in your program
283
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
The IsConsole Boolean variable declared in the System unit can be used to detect whether a program is running as a console or
graphical user interface application.
The $APPTYPE directive is meaningful only in a program. It should not be used in a library, unit, or package.
Remarks
The $C directive enables or disables the generation of code for assertions in a Delphi source file. {$C+} is the default.
Since assertions are not usually used at runtime in shipping versions of a product, compiler directives that disable the generation
of code for assertions are provided. {$C-} will disable assertions.
Remarks
The $AUTOBOX directive controls whether value types are automatically “boxed” into reference types.
The following code will not compile by default; the compiler halts with a message that I and Obj have incompatible types.
var
I: Integer;
Obj: TObject;
begin
I:=5;
Obj:=I; // compilation error
end.
Inserting {$AUTOBOX ON} anywhere before the offending line will remove the error, so this code compiles:
var
3 I: Integer;
Obj: TObject;
begin
I:=5;
{$AUTOBOX ON}
Obj:=I; // I is autoboxed into a TObject
end.
Reference types can not be automatically “unboxed” into value types, so a typecast is required to turn the TObject into an
Integer:
284
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
var
I: Integer;
Obj: TObject;
begin
I:=5;
{$AUTOBOX ON}
Obj:=I; // OK
// I:=Obj; // Can't automatically unbox; compilation error
I:=Integer(Obj); // this works
end.
Turning on autoboxing can be convenient, but it makes Delphi less type safe, so it can be dangerous. With autoboxing, some
errors that would otherwise be caught during compilation may cause problems at runtime. Boxing values into object references
also consumes additional memory and degrades execution performance. With {$AUTOBOX ON}, you run the risk of not
realizing how much of this data conversion is happening silently in your code. {$AUTOBOX OFF} is recommended for improved
type checking and faster runtime execution.
Remarks
The $B directive switches between the two different models of Delphi code generation for the and and or Boolean operators.
In the {$B+} state, the compiler generates code for complete Boolean expression evaluation. This means that every operand of a
Boolean expression built from the and and or operators is guaranteed to be evaluated, even when the result of the entire
expression is already known.
In the {$B-} state, the compiler generates code for short-circuit Boolean expression evaluation, which means that evaluation
stops as soon as the result of the entire expression becomes evident in left to right order of evaluation.
See Also
Boolean operators ( see page 720)
Conditional symbols work like Boolean variables: They are either defined (true) or undefined (false). Any valid conditional symbol 3
is treated as false until it has been defined. The $DEFINE directive sets a specified symbol to true, and the $UNDEF directive
sets it to false. You can also define a conditional symbol by using the -D switch with the command-line compiler or by adding the
symbol to the Conditional Defines box on the Directories/Conditionals page of the Project|Options dialog.
The conditional directives $IFDEF, $IFNDEF, $IF, $ELSEIF, $ELSE, $ENDIF, and $IFEND allow you to compile or suppress
code based on the status of a conditional symbol. $IF and $ELSEIF allow you to base conditional compilation on declared Delphi
identifiers. $IFOPT compiles or suppresses code depending on whether a specified compiler switch is enabled.
285
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
For example,
{$DEFINE DEBUG}
{$IFDEF DEBUG}
Writeln('Debug is on.'); // this code executes
{$ELSE}
Writeln('Debug is off.'); // this code does not execute
{$ENDIF}
{$UNDEF DEBUG}
{$IFNDEF DEBUG}
Writeln('Debug is off.'); // this code executes
{$ENDIF}
Conditional-directive constructions can be nested up to 32 levels deep. For every {$IFxxx}, the corresponding {$ENDIF} or
{$IFEND} must be found within the same source file.
Conditional symbols must start with a letter, followed by any combination of letters, digits, and underscores; they can be of any
length, but only the first 255 characters are significant. The following standard conditional symbols are defined:
VER<nnn> Always defined, indicating the version number of the Delphi compiler. (Each compiler version has a corresponding
predefined symbol. For example, compiler version 18.0 has VER180 defined.)
MSWINDOWS Indicates that the operating environment is Windows. Use MSWINDOWS to test for any flavor of the Windows
platform instead of WIN32.
WIN32 Indicates that the operating environment is the Win32 API. Use WIN32 for distinguishing between specific Windows
platforms, such as 32-bit versus 64-bit Windows. In general, don't limit code to WIN32 unless you know for sure that the code will
not work in WIN64. Use MSWINDOWS instead.
CLR Indicates the code will be compiled for the .NET platform.
For example, to find out the version of the compiler and run-time library that was used to compile your code, you can use $IF
with the CompilerVersion, RTLVersion and other constants:
{$IFDEF CONDITIONALEXPRESSIONS}
{$IF CompilerVersion >= 17.0}
{$DEFINE HAS_INLINE}
{$IFEND}
{$IF RTLVersion >= 14.0}
{$DEFINE HAS_ERROUTPUT}
{$IFEND}
{$ENDIF}
Note: Conditional symbols are not Delphi identifiers and cannot be referenced in actual program code. Similarly, Delphi
identifiers cannot be referenced in any conditional directives other than $IF and $ELSEIF.
Note: Conditional definitions are evaluated only when source code is recompiled. If you change a conditional symbol's status
and then rebuild a project, source code in unchanged units may not be recompiled. Use Project|Build All Projects to ensure
3 everything in your project reflects the current status of conditional symbols.
See Also
Delphi Compiler Directives (List) ( see page 280)
286
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
Remarks
The $D directive enables or disables the generation of debug information. This information consists of a line-number table for
each procedure, which maps object-code addresses into source text line numbers.
For units, the debug information is recorded in the unit file along with the unit's object code. Debug information increases the size
of unit file and takes up additional memory when compiling programs that use the unit, but it does not affect the size or speed of
the executable program.
When a program or unit is compiled in the {$D+} state, the integrated debugger lets you single-step and set breakpoints in that
module.
The Include debug info (Project|Options|Linker) and Map file (Project|Options|Linker) options produce complete line information
for a given module only if you've compiled that module in the {$D+} state.
The $D switch is usually used in conjunction with the $L switch, which enables and disables the generation of local symbol
information for debugging.
Remarks
Defines a Delphi conditional symbol with the given name. The symbol is recognized for the remainder of the compilation of the
current module in which the symbol is declared, or until it appears in an {$UNDEF name} directive. The {$DEFINE name}
directive has no effect if name is already defined.
Remarks
The {$DENYPACKAGEUNIT ON} directive prevents the Delphi unit in which it appears from being placed in a package.
287
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
Remarks
The $D directive inserts the text you specify into the module description entry in the header of an executable, DLL, or package.
Traditionally the text is a name, version number, and copyright notice, but you may specify any text of your choosing. For
example:
{$D 'My Application version 12.5'}
The string can't be longer than 256 bytes. The description is usually not visible to end users. To mark you executable files with
descriptive text, version and copyright information for the benefit of end users, use version info resources.
Remarks
The {DESIGNONLY ON} directive causes the package where it occurs to be compiled for installation in the IDE.
See Also
Package-specific compiler directives ( see page 640)
3 Remarks
Switches between compiling and ignoring the source code delimited by the previous {$IFxxx} and the next {$ENDIF} or {$IFEND}.
288
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
Remarks
The $ELSEIF directive allows multi-part conditional blocks where at most one of the conditional blocks will be taken. $ELSEIF is
a combination of a $ELSE and a $IF.
For example:
{$IFDEF foobar}
do_foobar
{$ELSEIF RTLVersion >= 14}
blah
{$ELSEIF somestring = 'yes'}
beep
{$ELSE}
last chance
{$IFEND}
Of these four cases, only one will be taken. If none of the first three conditions is true, then the $ELSE clause will be taken.
$ELSEIF must be terminated by $IFEND. $ELSEIF cannot appear after $ELSE. Conditions are evaluated top to bottom like a
normal "if ... else if ... else " sequence. In the example above, if foobar is not defined, RTLVersion is 15, and somestring = 'yes',
only the "blah" block will be taken not the "beep" block, even though the conditions for both are true.
Remarks
Note: $IF and $ELSEIF directives terminate with $IFEND rather than $ENDIF.
For example, placing {$E deu} in a library module produces a DLL with a .deu extension: filename.deu. If you create a library
module that simply references German forms and strings, you could use this directive to produce a DLL with the .deu extension.
The startup code in the runtime library looks for a DLL whose extension matches the locale of the system—for German settings,
it looks for .deu—and loads resources from that DLL.
289
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
The {$ObjExportAll On} directive exports all symbols in the unit file in which it occurs. This allows the C++ compiler to create
packages containing Delphi-generated object files.
Remarks
Note: Note: The $X directive is provided for backward compatibility. You should not use the {$X-} mode when writing Delphi
applications.
• Function statements. In the {$X+} mode, function calls can be used as procedure calls; that is, the result of a function call can
be discarded, rather than passed to another function or used in an operation or assignment. Generally, the computations
performed by a function are represented through its result, so discarding the result makes little sense. Sometimes, however, a
function is called because it performs a task such as setting the value of a global variable, without producing a useful result.
• The Result variable. In the {$X+} mode, the predefined variable Result can be used within a function body to hold the
function's return value.
• Null-terminated strings. In the {$X+} mode, Delphi strings can be assigned to zero-based character arrays (array[0..X] of
Char), which are compatible with PChar types.
See Also
Function declarations ( see page 662)
The EXTERNALSYM directive prevents the specified Delphi symbol from appearing in header files generated for C++. If an
overloaded routine is specified, all versions of the routine are excluded from the header file.
290
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
Remarks
The $FINITEFLOAT directive controls the handling of floating point overflow and underflow, and invalid floating point operations
such as division by zero.
In the {$FINITEFLOAT ON} state, which is the default, the results of floating point calculations are checked, and an exception is
raised when there is an overflow, underflow, or invalid operation. In the {$FINITEFLOAT OFF} state, such floating point
calculations will return NAN, -INF, or +INF.
Extra runtime processing is required to check the results of floating point calculations and raise exceptions. If your Delphi code
uses floating point operations but does not require strict enforcement of overflow/underflow exceptions, you can turn
{$FINITEFLOAT OFF} to get slightly faster runtime execution.
Note: Most code in .NET runs without floating point checks. However, Delphi has traditionally provided strict floating point
semantics. If you have Delphi code that relies on exceptions to be raised in overflow and underflow conditions, you should retain
the default setting ({$FINITEFLOAT ON}).
See Also
Internal Data Formats ( see page 645)
Remarks
The $HINTS directive controls the generation of hint messages by the Delphi compiler.
In the {$HINTS ON} state, the compiler issues hint messages when detecting unused variables, unused assignments, for or
while loops that never execute, and so on. In the {$HINTS OFF} state, the compiler generates no hint messages.
By placing code between {$HINTS OFF} and {$HINTS ON} directives, you can selectively turn off hints that you don't care about. 3
For example,
{$HINTS OFF}
procedure Test;
var
I: Integer;
begin
end;
{$HINTS ON}
291
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
Because of the $HINTS directives the compiler will not generate an unused variable hint when compiling the procedure above.
The HPPEMIT directive adds a specified symbol to the header file generated for C++. Example: {$HPPEMIT 'typedef double
Weight' }.
HPPEMIT directives are output into the "user supplied" section at the top of the header file in the order in which they appear in
the Delphi file.
Remarks
Remarks
Compiles the Delphi source code that follows it if expression is true. expression must conform to Delphi syntax and return a
Boolean value; it may contain declared constants, constant expressions, and the functions Defined and Declared.
For example,
{$DEFINE CLX}
const LibVersion = 2.1;
{$IF Defined(CLX) and (LibVersion > 2.0) }
... // this code executes
{$ELSE}
... // this code doesn't execute
{$IFEND}
{$IF Defined(CLX) }
3 ... // this code executes
{$ELSEIF LibVersion > 2.0}
... // this code doesn't execute
{$ELSEIF LibVersion = 2.0}
... // this code doesn't execute
{$ELSE}
... // this code doesn't execute
{$IFEND}
{$IF Declared(Test)}
... // successful
{$IFEND}
292
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
The special functions Defined and Declared are available only within $IF and $ELSEIF blocks. Defined returns true if the
argument passed to it is a defined conditional symbol. Declared returns true if the argument passed to it is a valid declared
Delphi identifier visible within the current scope.
If the identifiers referenced in the conditional expression do not exist, the conditional expression will be evaluated as false:
{$IF NoSuchVariable > 5}
WriteLn('This line doesn''t compile');
{$IFEND}
The $IF and $ELSEIF directives are terminated with $IFEND, unlike other conditional directives that use the $ENDIF terminator.
This allows you to hide $IF blocks from earlier versions of the compiler (which do not support $IF or $ELSEIF) by nesting them
within old-style $IFDEF blocks. For example, the following construction would not cause a compilation error:
{$UNDEF NewEdition}
{$IFDEF NewEdition}
{$IF LibVersion > 2.0}
...
{$IFEND}
{$ENDIF}
$IF supports evaluation of typed constants, but the compiler doesn't allow typed constants within constant expressions. As a
result,
const Test: Integer = 5;
{$IF SizeOf(Test) > 2}
...
is valid, while
const Test: Integer = 5;
{$IF Test > 2 } // error
...
generates a compilation error.
If your code needs to be portable between various versions of Delphi, or platforms (such as .NET), you will need to test whether
or not this directive is supported by the compiler. You can surround your code with the following directives:
$IFDEF conditionalexpressions
. // code including IF directive
. // only executes if supported
$ENDIF
Note: To test if code is being compiled on the .NET platform, use the identifier CLR, for example, {$IF NOT DEFINED(CLR)}.
Remarks
3
The $IFEND directive terminates $IF and $ELSEIF. This allows $IF/$IFEND blocks to be hidden from older compilers inside of
$IFDEF/$ENDIF, since the older compilers won't recognize $IFEND as a directive. $IF can only be terminated with $IFEND. The
$IFDEF, $IFNDEF, $IFOPT directives can only be terminated with $ENDIF.
Note: Note: When hiding $IF inside $IFDEF/$ENDIF, do not use $ELSE with the $IF. Previous version compilers will interpret
the $ELSE as part of the $IFDEF, producing a compiler error. You can use an {$ELSEIF True} as a substitute for {$ELSE} in this
situation, since the $ELSEIF won't be taken if the $IF is taken first, and the older compilers will not interpret the $ELSEIF. Hiding
$IF for backwards compatibility is primarily an issue for third party vendors and application developers who need their code to
293
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
Remarks
Compiles the Delphi source code that follows it if name is not defined.
Remarks
Compiles the Delphi source code that follows it if switch is currently in the specified state. switch consists of the name of a switch
option, followed by a + or a - symbol. For example,
{$IFOPT R+}
Writeln('Compiled with range-checking');
{$ENDIF}
compiles the Writeln statement if the $R option is currently active.
The $IMAGEBASE directive controls the default load address for an application, DLL, or package. The number argument must
be a 32-bit integer value that specifies image base address. The number argument must be greater than or equal to $00010000,
and the lower 16 bits of the argument are ignored and should be zero. The number must be a multiple of 64K (that is, a hex
number must have zeros as the last 4 digits) otherwise it will be rounded down to the nearest multiple, and you will receive a
compiler message.
When a module (application or library) is loaded into the address space of a process, Windows will attempt to place the module
3
at its default image base address. If that does not succeed, that is if the given address range is already reserved by another
module, the module is relocated to an address determined at runtime by Windows.
There is seldom, if ever, any reason to change the image base address of an application. For a library, however, it is
recommended that you use the $IMAGEBASE directive to specify a non-default image base address, since the default image
base address of $00400000 will almost certainly never be available. The recommended address range of DLL images is
$40000000 to $7FFFFFFF. Addresses in this range are always available to a process in both Windows NT/2000 and Windows
95/98.
294
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
When Windows succeeds in loading a DLL (or package) at its image base address, the load time is decreased because
relocation fix-ups do not have to be applied. Furthermore, when the given address range is available in multiple processes that
use the library, code portions of the DLL's image can be shared among the processes, thus reducing load time and memory
consumption.
Note: Note: The $IMAGEBASE directive overrides any value supplied with the -K command line compiler directive option.
Remarks
The {$IMPLICITBUILD OFF} directive, intended only for packages, prevents the source file in which it occurs from being
implicitly recompiled later. Use {$IMPLICITBUILD OFF} in .dpk files when compiling packages that provide low-level
functionality, that change infrequently between builds, or whose source code will not be distributed. Use of {$IMPLICITBUILD
OFF} in unit source files is not recommended.
Remarks
The {$G-} directive disables creation of imported data references. Using {$G-} increases memory-access efficiency, but prevents
a packaged unit where it occurs from referencing variables in other packages.
The $I parameter directive instructs the compiler to include the named file in the compilation. In effect, the file is inserted in the
compiled text right after the {$I filename} directive. The default extension for filename is .pas. If filename does not specify a
directory path, then, in addition to searching for the file in the same directory as the current module, Delphi searches in the
directories specified in the Search path input box on the Directories/Conditionals page of the Project|Options dialog box (or in the
directories specified in a -I option on the dccil command line).
295
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
To specify a filename that includes a space, surround the file name with single quotation marks: {$I 'My file'}.
There is one restriction to the use of include files: An include file can't be specified in the middle of a statement part. In fact, all
statements between the begin and end of a statement part must exist in the same source file.
Remarks
The $I switch directive enables or disables the automatic code generation that checks the result of a call to an I/O procedure. I/O
procedures are described in the Delphi Language Guide. If an I/O procedure returns a nonzero I/O result when this switch is on,
an EInOutError exception is raised (or the program is terminated if exception handling is not enabled). When this switch is off,
you must check for I/O errors by calling IOResult.
See Also
Standard routines and I/O ( see page 692)
Scope Global
Remarks
$LIBPREFIX overrides the default 'lib' or 'bpl' prefix in the output file name. For example, you could specify
{$LIBPREFIX 'dcl'}
3
for a design-time package, or use the following directive to eliminate the prefix entirely:
$LIBSUFFIX adds a specified suffix to the output file name before the extension.
{$LIBSUFFIX '-2.1.3'}
296
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
in something.pas to generate
something-2.1.3.dll
$LIBVERSION adds a second extension to the output file name after the extension. For example, use
{$LIBVERSION '-2.1.3'}
in something.pas to generate
libsomething.dll.2.1.3
Remarks
The $L parameter instructs the compiler to link the named file with the program or unit being compiled. The $L directive is used
to link with code written in other languages for procedures and functions declared to be external. The named file must be an Intel
relocatable object file (.OBJ file). The default extension for filename is .OBJ. If filename does not specify a directory path, then, in
addition to searching for the file in the same directory as the current module, Delphi searches in the directories specified in the
Search path input box on the Directories/Conditionals page of the Project|Options dialog box (or in the directories specified in the
-O option on the dccil command line).
To specify a file name that includes a space, surround the file name with single quotation marks: {$L 'My file'}.
For further details about linking with assembly language, see online Help.
Remarks
The $L switch directive enables or disables the generation of local symbol information. Local symbol information consists of the
names and types of all local variables and constants in a module, that is, the symbols in the module's implementation part and
the symbols within the module's procedures and functions.
For units, the local symbol information is recorded in the unit file along with the unit's object code. Local symbol information
3
increases the size of unit files and takes up additional memory when compiling programs that use the unit, but it does not affect
the size or speed of the executable program.
When a program or unit is compiled in the {$L+} state, the integrated debugger lets you examine and modify the module's local
variables. Furthermore, calls to the module's procedures and functions can be examined via the View|Call Stack.
The $L switch is usually used in conjunction with the $D switch, which enables and disables the generation of line-number tables
for debugging. The $L directive is ignored if the compiler is in the {$D-} state.
297
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
Remarks
The $H directive controls the meaning of the reserved word string when used alone in a type declaration. The generic type
string can represent either a long, dynamically-allocated string (the fundamental type AnsiString) or a short, statically allocated
string (the fundamental type ShortString).
By default {$H+}, Delphi defines the generic string type to be the long AnsiString. All components in the component libraries are
compiled in this state. If you write components, they should also use long strings, as should any code that receives data from
component library string-type properties.
The {$H-} state is mostly useful for using code from versions of Delphi that used short strings by default. You can locally override
the meaning of string-type definitions to ensure generation of short strings. You can also change declarations of short string
types to string[255] or ShortString, which are unambiguous and independent of the $H setting.
Remarks
The $MINSTACKSIZE and $MAXSTACKSIZE directives are used in Win32 programming only.
The $M directive specifies an application's stack allocation parameters. minstacksize must be an integer number between 1024
and 2147483647 that specifies the minimum size of an application's stack, and maxstacksize must be an integer number
between minstacksize and 2147483647 that specifies the maximum size of an application's stack.
If there is not enough memory available to satisfy an application's minimum stack requirement, Windows will report an error upon
attempting to start the application.
An application's stack is never allowed to grow larger than the maximum stack size. Any attempt to grow the stack beyond the
3 maximum stack size causes an EStackOverflow exception to be raised.
The $MINSTACKSIZE and $MAXSTACKSIZE directives allow the minimum and maximum stack sizes to be specified
separately.
The memory allocation directives are meaningful only in a program. They should not be used in a library or a unit.
For portability considerations between Windows and Linux, you should use the long forms of these directives instead of $M.
298
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
Remarks
The Delphi message directive allows source code to emit hints, warnings, and errors just as the compiler does. This is similar to
#emit or pragma warn in C and C++.
The message type (HINT, WARN, ERROR, or FATAL) is optional. If no message type is indicated, the default is HINT. The text
string is required and must be enclosed in single quotes.
Examples:
{$MESSAGE 'Boo!'} emits a hint
{$Message Hint 'Feed the cats'} emits a hint
{$messaGe Warn 'Looks like rain.'} emits a warning
{$Message Error 'Not implemented'} emits an error, continues compiling
{$Message Fatal 'Bang. Yer dead.'} emits an error, terminates compiler
The $METHODINFO switch directive is only effective when runtime type information (RTTI) has been turned on with the
{$TYPEINFO ON} switch. In the {$TYPEINFO ON} state, the $METHODINFO directive controls the generation of more detailed
method descriptors in the RTTI for methods in an interface. Though {$TYPEINFO ON} will cause some RTTI to be generated
for published methods, the level of information is limited. The $METHODINFO directive generates much more detailed (and much
larger) RTTI for methods, which describes how the parameters of the method should be passed on the stack and/or in registers.
There is seldom, if ever, any need for an application to directly use the $METHODINFO compiler switch. The method information
adds considerable size to the executable file, and is not recommended for general use.
Note: The Delphi compiler's Win32 web service support code uses method information descriptors in order to pass parameters
received in a network packet to the target method. {$METHODINFO ON} is used only for web service interface types.
See Also
Runtime type information ($TYPEINFO directive) ( see page 304)
299
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
The $Z directive controls the minimum storage size of Delphi enumerated types.
An enumerated type is stored as an unsigned byte if the enumeration has no more than 256 values, and if the type was declared
in the {$Z1} state (the default). If an enumerated type has more than 256 values, or if the type was declared in the {$Z2} state, it
is stored as an unsigned word. Finally, if an enumerated type is declared in the {$Z4} state, it is stored as an unsigned double
word.
The {$Z2} and {$Z4} states are useful for interfacing with C and C++ libraries, which usually represent enumerated types as
words or double words.
Note: Note: For backwards compatibility with early versions of Delphi and CodeGear Pascal, the directives {$Z-} and {$Z+} are
also supported. They correspond to {$Z1} and {$Z4}, respectively.
Remarks
The $P directive is meaningful only for code compiled in the {$H-} state, and is provided for backwards compatibility with early
versions of Delphi and CodeGear Pascal. $P controls the meaning of variable parameters declared using the string keyword in
the {$H-} state. In the {$P-} state, variable parameters declared using the string keyword are normal variable parameters, but in
the {$P+} state, they are open string parameters. Regardless of the setting of the $P directive, the openstring identifier can
always be used to declare open string parameters.
The $O directive controls code optimization. In the {$O+} state, the compiler performs a number of code optimizations, such as
3 placing variables in CPU registers, eliminating common subexpressions, and generating induction variables. In the {$O-} state,
all such optimizations are disabled.
Other than for certain debugging situations, you should never have a need to turn optimizations off. All optimizations performed
by the Delphi compiler are guaranteed not to alter the meaning of a program. In other words, the compiler performs no "unsafe"
optimizations that require special awareness by the programmer.
Note: Note: The $O directive can only turn optimization on or off for an entire procedure or function. You can't turn optimization
on or off for a single line or group of lines within a routine.
300
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
Remarks
The $Q directive controls the generation of overflow checking code. In the {$Q+} state, certain integer arithmetic operations (+, -,
*, Abs, Sqr, Succ, Pred, Inc, and Dec) are checked for overflow. The code for each of these integer arithmetic operations is
followed by additional code that verifies that the result is within the supported range. If an overflow check fails, an EIntOverflow
exception is raised (or the program is terminated if exception handling is not enabled).
The $Q switch is usually used in conjunction with the $R switch, which enables and disables the generation of range-checking
code. Enabling overflow checking slows down your program and makes it somewhat larger, so use {$Q+} only for debugging.
The $U directive controls generation of floating-point code that guards against the flawed FDIV instruction exhibited by certain
early Pentium processors. Windows 95, Windows NT 3.51, and later contain code which corrects the Pentium FDIV bug
system-wide.
In the {$U+} state, all floating-point divisions are performed using a runtime library routine. The first time the floating-point
division routine is invoked, it checks whether the processor's FDIV instruction works correctly, and updates the TestFDIV
variable (declared in the System unit) accordingly. For subsequent floating-point divide operations, the value stored in TestFDIV
is used to determine what action to take.
Value Meaning
For processors that do not exhibit the FDIV flaw, {$U+} results in only a slight performance degradation. For a flawed Pentium
processor, floating-point divide operations may take up to three times longer in the {$U+} state, but they will always produce 3
correct results.
In the {$U-} state, floating-point divide operations are performed using in-line FDIV instructions. This results in optimum speed
and code size, but may produce incorrect results on flawed Pentium processors. You should use the {$U-} state only in cases
where you are certain that the code is not running on a flawed Pentium processor.
301
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
3.1.1.45 NODEFINE
Type Parameter
Syntax {$NODEFINE identifier}
The NODEFINE directive prevents the specified symbol from being included in the header file generated for C++, while allowing
some information to be output to the OBJ file. When you use NODEFINE, it is your responsibility to define any necessary types
with HPPEMIT. For example:
type
Temperature = type double;
{$NODEFINE Temperature}
{$HPPEMIT 'typedef double Temperature'}
The NOINCLUDE directive prevents the specified file from being included in header files generated for C++. For example,
{$NOINCLUDE Unit1} removes #include Unit1.
Remarks
The $R directive enables or disables the generation of range-checking code. In the {$R+} state, all array and string-indexing
expressions are verified as being within the defined bounds, and all assignments to scalar and subrange variables are checked
to be within range. If a range check fails, an ERangeError exception is raised (or the program is terminated if exception handling
is not enabled).
Enabling range checking slows down your program and makes it somewhat larger.
302
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
Remarks
In the default {$REALCOMPATIBILITY OFF} state, the generic Real type is equivalent to Double.
The REALCOMPATIBILITY switch provides backward compatibility for legacy code in which Real is used to represent the
6-byte real type now called Real48. In new code, use Real48 when you want to specify a 6-byte real. Note however, that the
Real48 type is deprecated on Delphi for .NET.
The region and endregion directives control the display of collapsible regions in the code editor. These directives are ignored
by the compiler.
To mark code as a region, surround it with the region and endregion directives. You may include a message that will be
displayed when the code is folded and hidden.
Remarks
3
The $R directive specifies the name of a resource file to be included in an application or library. The named file must be a
Windows resource file and the default extension for filenames is .res. To specify a file name that includes a space, surround the
file name with single quotation marks: {$R 'My file'}.
The * symbol has a special meaning in $R directives: it stands for the base name (without extension) of the source-code file
where the directive occurs. Usually, an application's resource (.res) file has the same name as its project (.dpr) file; in this case,
including {$R *.res} in the project file links the corresponding resource file to the application. Similarly, a form (.dfm or nfm) file
usually has the same name as its unit (.pas) file; including {$R *.nfm} in the .pas file links the corresponding form file to the
303
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
application.
{$R filename.res filename.rc} (where the two occurrences of 'filename' match) makes the .rc file appear in the Project Manager.
When the user opens the .rc file from the Project Manager, the String Table editor is invoked.
When a {$R filename} directive is used in a unit, the specified file name is simply recorded in the resulting unit file. No checks are
made at that point to ensure that the filename is correct and that it specifies an existing file.
When an application or library is linked (after compiling the program or library source file), the resource files specified in all used
units as well as in the program or library itself are processed, and each resource in each resource file is copied to the executable
being produced. During the resource processing phase, the linker searches for .res files in the same directory as the module
containing the $R directive, and in the directories specified in the Search path input box on the Directories/Conditionals page of
the Project|Options dialog box (or in the directories specified in a -R option on the dccil command line).
Remarks
The {$RUNONLY ON} directive causes the package where it occurs to be compiled as runtime only. Packages compiled with
{$RUNONLY ON} cannot be installed as design-time packages in the IDE.
See Also
Compiling packages ( see page 640)
The $M switch directive controls generation of runtime type information (RTTI). When a class is declared in the {$M+} state, or is
derived from a class that was declared in the {$M+} state, the compiler generates runtime type information for properties and
events that are declared in a published section. If a class is declared in the {$M+} state, and is not derived from a class that was
3 declared in the {$M} state, published sections are not allowed in the class. Note that if a class is forward declared, the first
declaration of the class must be declared with the $Mswitch.
When the $M switch is used to declare an interface, the compiler generates runtime type information for all properties. That is, for
interfaces, all members are treated as if they were published.
Note: The TPersistent class defined in the Classes unit of the component library is declared in the {$M+} state, so any class
derived from TPersistent will have RTTI generated for its published sections. The component library uses the runtime type
information generated for published sections to access the values of a component's properties when saving or loading form files.
304
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
Furthermore, the IDE uses a component's runtime type information to determine the list of properties to show in the Object
Inspector.
Note: The IInvokable interface defined in the System unit is declared in the {$M+} state, so any interface derived from
IInvokable will have RTTI generated. The routines in the IntfInfo unit can be used to retrieved the RTTI.
There is seldom, if ever, any need for an application to directly use the {$M}compiler switch.
See Also
Understanding Invokable Interfaces
Remarks
The $Y directive controls generation of symbol reference information used by the Project Manager, Code Explorer, and Code
editor. This information consists of tables that provide the source-code line numbers for all declarations of and (in the {$Y+}
state) references to identifiers in a module. For units, the information is recorded in the .dcu file along with the unit's object code.
Symbol reference information increases the size of .dcu files, but it does not affect the size or speed of the executable program.
When a program or unit is compiled in the default {$YD} (or {DEFINITIONINFO ON}) state, the compiler records information
about where each identifier is defined. For most identifiers—variables, constants, classes, and so forth—the compiler records the
location of the declaration. For procedures, functions, and methods, the compiler records the location of the implementation. This
enables Code editor browsing.
When a program or unit is compiled in the {$Y+} (or {REFERENCEINFO ON}) state, the compiler records information about
where every identifier is used as well as where it is defined. This enables the References page of the Project Browser.
When a program or unit is compiled in the {$Y-} (or {DEFINITIONINFO OFF} or {REFERENCEINFO OFF}) state, no symbol
reference information is recorded. This disables Code editor browsing and the References page of the Project Browser.
The $Y switch is usually used in conjunction with the $D and $L switches, which control generation of debug information and
local symbol information. The $Y directive has no effect unless both $D and $L are enabled.
Note: Generating full cross-reference information ({$Y+}) can slow the compile/link cycle, so you should not use this except
when you need the Project Manager References page.
3
305
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
Scope Global
Remarks
The $T directive controls the types of pointer values generated by the @ operator and the compatibility of pointer types.
In the {$T-} state, the result of the @ operator is always an untyped pointer (Pointer) that is compatible with all other pointer
types. When @ is applied to a variable reference in the {$T+} state, the result is a typed pointer that is compatible only with
Pointer and with other pointers to the type of the variable.
In the {$T-} state, distinct pointer types other than Pointer are incompatible (even if they are pointers to the same type). In the
{$T+} state, pointers to the same type are compatible.
Remarks
Undefines a previously defined conditional symbol. The symbol is forgotten for the remainder of the compilation of the current
source file or until it reappears in a $DEFINE directive. The $UNDEF directive has no effect if name is already undefined.
Conditional symbols defined with a command-line switch or through the Project|Options dialog are reinstated at the start of
compilation of each unit source file. Conditional symbols defined in a unit source file are forgotten when the compiler starts on
another unit.
The $UNSAFECODE directive controls whether the unsafe keyword is accepted by the compiler. With {$UNSAFECODE ON},
you can mark procedures and functions with the unsafe keyword, for example:
procedure unsafeProc; unsafe;
begin
end;
Note: Unsafe code will not pass PEVerify
3 , nor will any assembly or Delphi module that calls an unsafe procedure or function.
306
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
Remarks
The $V directive is meaningful only for Delphi code that uses short strings, and is provided for backwards compatibility with early
versions of Delphi and CodeGear Pascal.
The $V directive controls type checking on short strings passed as variable parameters. In the {$V+} state, strict type checking is
performed, requiring the formal and actual parameters to be of identical string types. In the {$V-} (relaxed) state, any short string
type variable is allowed as an actual parameter, even if the declared maximum length is not the same as that of the formal
parameter.
Remarks
The $WARN directive lets you control the display of groups of warning messages. These warnings relate to symbols or units that
use the hint directives, platform, deprecated, and library.
The identifier in the $WARN directive is optional and can have any of the following values:
SYMBOL_PLATFORM: Turns on or off all warnings about the platform directive on symbols in the current unit.
SYMBOL_LIBRARY: Turns on or off all warnings about the library directive on symbols in the current unit.
SYMBOL_DEPRECATED: Turns on or off all warnings about the deprecated directive on symbols in the current unit.
UNIT_DEPRECATED: Turns on or off all warnings about the deprecated directive applied to a unit declaration.
UNIT_LIBRARY: Turns on or off all warnings about the library directive in units where the library directive is specified.
UNIT_PLATFORM: Turns on or off all warnings about the platform directive in units where the platform directive is specified.
The only warnings that can be turned on/off using $WARN are the ones listed above.
The warnings set by the inline $WARN directive are carried for the compilation unit in which the directive appears, after which it
reverts to the previous state. The warnings set by a $WARN directive take effect from that point on in the file.
See Also 3
Declarations ( see page 705)
307
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
Remarks
The $WARNINGS directive controls the generation of compiler warnings. The $WARN directive lets control the display of groups
of warning messages.
In the {$WARNINGS ON} state, the compiler issues warning messages when detecting uninitialized variables, missing function
results, construction of abstract objects, and so on. In the {$WARNINGS OFF} state, the compiler generates no warning
messages.
By placing code between {$WARNINGS OFF} and {$WARNINGS ON} directives, you can selectively turn off warnings that you
don't care about.
Note: Note: The $WARNINGS directive only works at the procedure or function level granularity. That is, you can surround
entire procedures and functions with the $WARNINGS directive, but not blocks of statements within a procedure or function.
Remarks
The $WEAKPACKAGEUNIT directive affects the way a .dcu file is stored in a Delphi package's .dcp and .bpl files on the Win32
platform, or, analogously, how a .dcuil file is stored in the package's .dcpil and .dll files on the .NET platform. If
{$WEAKPACKAGEUNIT ON} appears in a unit file, the compiler omits the unit from bpls or dlls when possible, and creates a
non-packaged local copy of the unit when it is required by another application or package. A unit compiled with this directive is
said to be "weakly packaged."
For example, suppose a package called PACK contains only one unit, UNIT1. Suppose UNIT1 does not use any further units,
but it makes calls to RARE.DLL. If the {$WEAKPACKAGEUNIT ON} directive is inserted in UNIT1.pas before compiling, UNIT1
will not be included in PACK.BPL (or PACK.DLL on .NET); copies of RARE.DLL will not have to be distributed with PACK.
3 However, UNIT1 will still be included in PACK.dcp (or PACK.dcpil on .NET). If UNIT1 is referenced by another package or
application that uses PACK, it will be copied from PACK.dcp (or PACK.dcpil on .NET) and compiled directly into the project.
Now suppose a second unit, UNIT2, is added to PACK. Suppose that UNIT2 uses UNIT1. This time, even if PACK is compiled
with {$WEAKPACKAGEUNIT ON} in UNIT1.pas, the compiler will include UNIT1 in PACK.BPL (or PACK.DLL on .NET). But
other packages or applications that reference UNIT1 will use the (non-packaged) copy taken from PACK.dcp (or PACK.dcpil on
.NET).
Note: Note: Unit files containing the {$WEAKPACKAGEUNIT ON} directive must not have global variables, initialization
sections, or finalization sections.
308
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Directives (List)
The $WEAKPACKAGEUNIT directive is an advanced feature intended for developers who distribute their packages to other
programmers. It can help to avoid distribution of infrequently used DLLs, and to eliminate conflicts among packages that may
depend on the same external library.
For example, Delphi's PenWin unit references PENWIN.DLL. Most projects don't use PenWin, and most computers don't have
PENWIN.DLL installed on them. For this reason, the PenWin unit is weakly packaged in VCL60 (which encapsulates many
commonly-used Delphi components). When you compile a project that uses PenWin and the VCL60 package, PenWin is copied
from VCL60.DCP and bound directly into your project; the resulting executable is statically linked to PENWIN.DLL.
If PenWin were not weakly packaged, two problems would arise. First, VCL60 itself would be statically linked to PENWIN.DLL,
and so could not be loaded on any computer which didn't have PENWIN.DLL installed. Second, if someone tried to create a
package that contained PenWin, a compiler error would result because the PenWin unit would be contained in both VCL60 and
the new package. Thus, without weak packaging, PenWin could not be included in standard distributions of VCL60.
Remarks
The $W directive controls the generation of stack frames for procedures and functions. In the {$W+} state, stack frames are
always generated for procedures and functions, even when they're not needed. In the {$W-} state, stack frames are only
generated when they're required, as determined by the routine's use of local variables.
Some debugging tools require stack frames to be generated for all procedures and functions, but other than that you should
never have a need to use the {$W+} state.
The $J directive controls whether typed constants can be modified or not. In the {$J+} state, typed constants can be modified,
and are in essence initialized variables. In the {$J-} state, typed constants are truly constant, and any attempt to modify a typed
constant causes the compiler to report an error.
3
Writeable consts refers to the use of a typed const as a variable modifiable at runtime. For example:
const
foo: Integer = 12;
begin
foo := 14;
end.
With $WRITEABLECONST OFF, this code produces a compile error on the assignment to the foo variable in the begin..end
block. To fix it, change the const declaration to a var declaration.
309
Delphi Compiler Directives (List) RAD Studio (Common) 3.1 Delphi Reference
In early versions of Delphi and CodeGear Pascal, typed constants were always writeable, corresponding to the {$J+} state. Old
source code that uses writeable typed constants must be compiled in the {$J+} state, but for new applications it is recommended
that you use initialized variables and compile your code in the {$J-} state.
Microsoft relies on PE (portable executable) header flags to allow an application to indicate compatiblity with OS services or
request advanced OS services. These directives provide powerful options for tuning your applications on high-end NT systems.
Warning: There is no error checking or masking of bit values specified by these directives. If you set the wrong combination of
bits, you could corrupt your executable file.
These directives allow you to set flag bits in the PE file header Characteristics field and PE file optional header
DLLCharacteristics field, respectively. Most of the Characteristics flags, set using $SetPEFlags, are specifically for object files
and libraries. DLLCharacteristics, set using $SetPEOptFlags, are flags that describe when to call a DLL's entry point.
The <integer expression> in these directives can include Delphi constant identifiers, such as the IMAGE_FILE_xxxx constants
defined in Windows.pas. Multiple constants should be OR'd together.
You can include these directives in source code multiple times. The flag values specified by multiple directives are strictly
cumulative: if the first occurrence of the directive sets $03 and the second occurrence sets $10, the value written to the
executable file at link time will be $13 (plus whatever bits the linker normally sets in the PE flag fields).
These directives only affect the output file if included in source code prior to linking. This means you should place these
directives in a .dpr or .dpk file, not in a regular unit. Like the exe description directive, it's not an error to place these directives in
unit source code, but these directives in unit source will not affect the output file (exe or dll) unless the unit source is recompiled
at the time the output file is linked.
Remarks
This directive is used in Linux programming only. For information about the $M ($MINSTACKSIZE and $MAXSTACKSIZE)
3
directives in Windows, see the topic on Memory Allocation Sizes.
Use the $M directive to increase or decrease the amount of extra address space reserved for resources.
By default, the compiler reserves 1MB of address space, in addition to what the application actually uses at link time, for
resources. This extra address space is provided to accommodate localized versions of the application that incorporate larger
resource files than the original version. As long as there is sufficient reserved address space, you won't have to relink the entire
executable to produce a localized version.
310
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
For maximum portability between Windows and Linux platforms, you should use the long form of this directive
$RESOURCERESERVE and not $M.
See Also
Memory allocation sizes
Topics
Name Description
Error Messages ( see page 311) This section lists all the Delphi compiler error and warning messages of RAD
Studio.
Delphi Runtime Errors ( see page 509) Certain errors at runtime cause Delphi programs to display an error message and
terminate.
I/O Errors ( see page 510) I/O errors cause an exception to be thrown if a statement is compiled in the {$I+}
state. (If the application does not include the SysUtils class, the exception causes
the application to terminate).
Fatal errors ( see page 511) These errors always immediately terminate the program.
Operating system errors ( see page 512) All errors other than I/O errors and fatal errors are reported with the error codes
returned by the operating system.
Topics
Name Description
DisposeCount cannot be declared in classes with destructors ( see page 336) No further Help is available for this message or warning.
E2190: Thread local variables cannot be ABSOLUTE ( see page 336) A thread local variable cannot refer to another variable, nor can it reference an
absolute memory address.
E2249: Cannot use absolute variables when compiling to byte code ( see page The use of absolute variables is prohibited when compiling to byte code.
336)
E2373: Call to abstract method %s.%s ( see page 336) No further information is available for this error or warning.
E2371: ABSTRACT and FINAL cannot be used together ( see page 337) A class cannot be both final and abstract.
Final is a restrictive modifier used to prevent extension of a class (or prevent
overrides on methods), while the abstract modifier signals the intention to use a
class as a base class.
E2136: No definition for abstract method '%s' allowed ( see page 337) You have declared <name> to be abstract, but the compiler has found a
definition for the method in the source file. It is illegal to provide a definition for an
abstract declaration.
E2167: Abstract methods must be virtual or dynamic ( see page 337) When declaring an abstract method in a base class, it must either be of regular
virtual or dynamic virtual type.
E2383: ABSTRACT and SEALED cannot be used together ( see page 338) A class cannot be both sealed and abstract. 3
The sealed modifier is used to prevent inheritance of a class, while the abstract
modifier signals the intention to use a class as a base class.
E2247: Cannot take the address when compiling to byte code ( see page 338) The address-of operator, @, cannot be used when compiling to byte code.
E2251: Ambiguous overloaded call to '%s' ( see page 338) Based on the current overload list for the specified function, and the programmed
invocation, the compiler is unable to determine which version of the procedure
should be invoked.
E2099: Overflow in conversion or arithmetic operation ( see page 339) The compiler has detected an overflow in an arithmetic expression: the result of
the expression is too large to be represented in 32 bits.
Check your computations to ensure that the value can be represented by the
computer hardware.
311
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
E2307: NEW standard function expects a dynamic array type identifier ( see No further information is available for this error or warning.
page 339)
E2308: Need to specify at least one dimension for NEW of dynamic array ( see No further information is available for this error or warning.
page 339)
E2246: Need to specify at least one dimension for SetLength of dynamic array The standard procedure SetLength has been called to alter the length of a
( see page 339) dynamic array, but no array dimensions have been specified.
E2081: Assignment to FOR-Loop variable '%s' ( see page 340) It is illegal to assign a value to the for loop control variable inside the for loop.
If the purpose is to leave the loop prematurely, use a break or goto statement.
W1017: Assignment to typed constant '%s' ( see page 340) This warning message is currently unused.
E2117: 486/487 instructions not enabled ( see page 340) You should not receive this error as 486 instructions are always enabled.
E2116: Invalid combination of opcode and operands ( see page 340) You have specified an inline assembler statement which is not correct.
E2109: Constant expected ( see page 341) The inline assembler was expecting to find a constant but did not find one.
E2118: Division by zero ( see page 341) The inline assembler has encountered an expression which results in a division
by zero.
E2119: Structure field identifier expected ( see page 341) The inline assembler recognized an identifier on the right side of a '.', but it was
not a field of the record found on the left side of the '.'. One common, yet difficult
to realize, error of this sort is to use a record with a field called 'ch' - the inline
assembler will always interpret 'ch' to be a register name.
E2108: Memory reference expected ( see page 342) The inline assembler has expected to find a memory reference expression but
did not find one.
Ensure that the offending statement is indeed a memory reference.
E2115: Error in numeric constant ( see page 342) The inline assembler has found an error in the numeric constant you entered.
E2107: Operand size mismatch ( see page 343) The size required by the instruction operand does not match the size given.
E2113: Numeric overflow ( see page 343) The inline assembler has detected a numeric overflow in one of your
expressions.
E2112: Invalid register combination ( see page 344) You have specified an illegal combination of registers in a inline assembler
statement. Please refer to an assembly language guide for more information on
addressing modes allowed on the Intel 80x86 family.
E2111: Cannot add or subtract relocatable symbols ( see page 344) The inline assembler is not able to add or subtract memory address which may
be changed by the linker.
E2106: Inline assembler stack overflow ( see page 345) Your inline assembler code has exceeded the capacity of the inline assembler.
Contact CodeGear if you encounter this error.
E2114: String constant too long ( see page 345) The inline assembler has not found the end of the string that you specified. The
most likely cause is a misplaced closing quote.
E2105: Inline assembler syntax error ( see page 345) You have entered an expression which the inline assembler is unable to interpret
as a valid assembly instruction.
E2110: Type expected ( see page 346) Contact CodeGear if you receive this error.
E2448: An attribute argument must be a constant expression, typeof expression The Common Language Runtime specifies that an attribute argument must be a
or array constructor ( see page 346) constant expression, a typeof expression or an array creation expression.
Attribute arguments cannot be global variables, for example. Attribute instances
are constructed at compile-time and incorporated into the assembly metadata, so
no run-time information can be used to construct them.
E2045: Bad object file format: '%s' ( see page 346) This error occurs if an object file loaded with a $L or $LINK directive is not of the
correct format. Several restrictions must be met:
312
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
x1028: Bad global symbol definition: '%s' in object file '%s' ( see page 346) This warning is given when an object file linked in with a $L or $LINK directive
contains a definition for a symbol that was not declared in Delphi as an external
procedure, but as something else (e.g. a variable).
The definition in the object will be ignored in this case.
E2160: Type not allowed in OLE Automation call ( see page 346) If a data type cannot be converted by the compiler into a Variant, then it is not
allowed in an OLE automation call.
E2188: Published property '%s' cannot be of type %s ( see page 347) Published properties must be an ordinal type, Single, Double, Extended, Comp, a
string type, a set type which fits in 32 bits, or a method pointer type. When any
other property type is encountered in a published section, the compiler will
remove the published attribute -$M+
E2055: Illegal type in Read/Readln statement ( see page 348) This error occurs when you try to read a variable in a Read or Readln that is not
of a legal type.
Check the type of the variable and make sure you are not missing a
dereferencing, indexing or field selection operator.
E2053: Syntax error in real number ( see page 348) This error message occurs if the compiler finds the beginning of a scale factor
(an 'E' or 'e' character) in a number, but no digits follow it.
E2104: Bad relocation encountered in object file '%s' ( see page 348) You are trying to link object modules into your program with the $L compiler
directive. However, the object file is too complex for the compiler to handle. For
example, you may be trying to link in a C++ object file. This is not supported.
E2158: %s unit out of date or corrupted: missing '%s' ( see page 349) The compiler is looking for a special function which resides in System.dcu but
could not find it. Your System unit is either corrupted or obsolete.
Make sure there are no conflicts in your library search path which can point to
another System.dcu. Try reinstalling System.dcu. If neither of these solutions
work, contact CodeGear Developer Support.
E2159: %s unit out of date or corrupted: missing '%s.%s' ( see page 349) The compiler failed to find a special function in System, indicating that the unit
found in your search paths is either corrupted or obsolete.
E2150: Bad argument type in variable type array constructor ( see page 349) You are attempting to construct an array using a type which is not allowed in
variable arrays.
E2281: Type not allowed in Variant Dispatch call ( see page 350) This message indicates that you are trying to make a method call and are
passing a type that the compiler does not know how to marshall. Variants can
hold interfaces, but the interfaces can marshall only certain types.
On Windows, Delphi supports COM and SOAP interfaces and can call types that
these interfaces can marshall.
E2054: Illegal type in Write/Writeln statement ( see page 350) This error occurs when you try to output a type in a Write or Writeln statement
that is not legal.
E2297: Procedure definition must be ILCODE calling convention ( see page .NET managed code can only use the ILCODE calling convention.
350)
E2050: Statements not allowed in interface part ( see page 350) The interface part of a unit can only contain declarations, not statements.
Move the bodies of procedures to the implementation part.
x1012: Constant expression violates subrange bounds ( see page 351) This error message occurs when the compiler can determine that a constant is
outside the legal range. This can occur for instance if you assign a constant to a
variable of subrange type.
E2097: BREAK or CONTINUE outside of loop ( see page 351) The compiler has found a BREAK or CONTINUE statement which is not
contained inside a WHILE or REPEAT loop. These two constructs are only legal
in loops.
E2309: Attribute - Known attribute named argument cannot be an array ( see No further information is available for this error or warning.
page 352)
E2310: Attribute - A custom marshaler requires the custom marshaler type ( No further information is available for this error or warning.
see page 352)
E2327: Linker error while emitting attribute '%s' for '%s' ( see page 352) No further information is available for this error or warning.
E2311: Attribute - MarshalAs fixed string requires a size ( see page 352) No further information is available for this error or warning.
E2312: Attribute - Invalid argument to a known attribute ( see page 352) No further information is available for this error or warning.
E2313: Attribute - Known attribute cannot specify properties ( see page 352) No further information is available for this error or warning.
E2314: Attribute - The MarshalAs attribute has fields set that are not valid for the No further information is available for this error or warning.
specified unmanaged type ( see page 352)
E2315: Attribute - Known custom attribute on invalid target ( see page 352) No further information is available for this error or warning.
3
E2316: Attribute - The format of the GUID was invalid ( see page 353) No further information is available for this error or warning.
E2317: Attribute - Known custom attribute had invalid value ( see page 353) No further information is available for this error or warning.
E2318: Attribute - The MarshalAs constant size cannot be negative ( see page No further information is available for this error or warning.
353)
E2319: Attribute - The MarshalAs parameter index cannot be negative ( see No further information is available for this error or warning.
page 353)
E2320: Attribute - The specified unmanaged type is only valid on fields ( see No further information is available for this error or warning.
page 353)
313
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
E2321: Attribute - Known custom attribute has repeated named argument ( see No further information is available for this error or warning.
page 353)
E2322: Attribute - Unexpected type in known attribute ( see page 353) No further information is available for this error or warning.
E2323: Attribute - Unrecognized argument to a known custom attribute ( see No further information is available for this error or warning.
page 353)
E2324: Attribute - Known attribute named argument doesn't support variant ( No further information is available for this error or warning.
see page 353)
E2222: $WEAKPACKAGEUNIT & $DENYPACKAGEUNIT both specified ( see It is not legal to specify both $WEAKPACKAGEUNIT and
page 354) $DENYPACKAGEUNIT. Correct the source code and recompile.
E2276: Identifier '%s' cannot be exported ( see page 354) This message indicates that you are trying to export a function or procedure that
is tagged with the local directive. You also, cannot export threadvars and you
would receive this message if you try to do so.
E2071: This type cannot be initialized ( see page 354) File types (including type Text), and the type Variant cannot be initialized, that is,
you cannot declare typed constants or initialized variables of these types.
E2374: Cannot make unique type from %s ( see page 354) No further information is available for this error or warning.
E2223: $DENYPACKAGEUNIT '%s' cannot be put into a package ( see page You are attempting to put a unit which was compiled with $DENYPACKAGEUNIT
354) into a package. It is not possible to put a unit compiled with the
$DENYPACKAGEUNIT direction into a package.
E2217: Published field '%s' not a class or interface type ( see page 354) An attempt has been made to publish a field in a class which is not a class nor
interface type.
E2218: Published method '%s' contains an unpublishable type ( see page 355) This message is not used in dccil. The message applies only to Win32
compilations, where it indicates that a parameter or function result type in the
method is not a publishable type.
E2278: Cannot take address of local symbol %s ( see page 355) This message occurs when you try to call a symbol from within a procedure or
function that has been tagged with the local directive.
The local directive, which marks routines as unavailable for export, is
platform-specific and has no effect in Windows programming.
On Linux, the local directive is used for routines that are compiled into a library
but are not exported. This directive can be specified for standalone procedures
and functions, but not for methods. A routine declared with local, for example,
E2392: Can't generate required accessor method(s) for property %s.%s due to The CLR requires that property accessors be methods, not fields. The Delphi
name conflict with existing symbol %s in the same scope ( see page 355) language allows you to specify fields as property accessors. The Delphi compiler
will generate the necessary methods behind the scenes. CLS recommends a
specific naming convention for property accessor methods: get_propname and
set_propname. If the accessors for a property are not methods, or if the given
methods do not match the CLS name pattern, the Delphi compiler will attempt to
generate methods with CLS conforming names. If a method already exists in the
class that matches the CLS name pattern, but it is not associated with the
particular... more ( see page 355)
E2126: Cannot BREAK, CONTINUE or EXIT out of a FINALLY clause ( see Because a FINALLY clause may be entered and exited through the exception
page 356) handling mechanism or through normal program control, the explicit control flow
of your program may not be followed. When the FINALLY is entered through the
exception handling mechanism, it is not possible to exit the clause with BREAK,
CONTINUE, or EXIT - when the finally clause is being executed by the exception
handling system, control must return to the exception handling system.
W1018: Case label outside of range of case expression ( see page 356) You have provided a label inside a case statement which cannot be produced by
the case statement control variable. -W
E2326: Attribute '%s' can only be used once per target ( see page 357) This attribute can only be used once per target Attributes and their descendants
may be declared with an AttributeUsage Attribute which describes how a custom
Attribute may be used. If the use of an attribute violates
AttributeUsage.allowmultiple then this error will be raised.
E2325: Attribute '%s' is not valid on this target ( see page 357) Attribute is not valid on this target. Attributes and their descendants may be
declared with an AttributeUsage Attribute which describes how a custom Attribute
may be used. If the use of an attribute violates AttributeUsage.validon property
then this error will be raised. AttributeUsage.validon specifies the application
element that this attribute may be applied to.
E2358: Class constructors not allowed in class helpers ( see page 357) No further information is available for this error or warning.
3 E2360: Class constructors cannot have parameters ( see page 358) No further information is available for this error or warning.
E2340: Metadata - Data too large ( see page 358) No further information is available for this error or warning.
E2343: Metadata - Primary key column may not allow the null value ( see page No further information is available for this error or warning.
358)
E2341: Metadata - Column cannot be changed ( see page 358) No further information is available for this error or warning.
E2342: Metadata - Too many RID or primary key columns, 1 is max ( see page No further information is available for this error or warning.
358)
E2329: Metadata - Error occured during a read ( see page 358) No further information is available for this error or warning.
E2330: Metadata - Error occured during a write ( see page 358) No further information is available for this error or warning.
314
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
E2334: Metadata - Old version error ( see page 358) No further information is available for this error or warning.
E2331: Metadata - File is read only ( see page 358) No further information is available for this error or warning.
E2339: Metadata - The importing scope is not compatible with the emitting scope No further information is available for this error or warning.
( see page 358)
E2332: Metadata - An ill-formed name was given ( see page 358) No further information is available for this error or warning.
E2337: Metadata - There isn't .CLB data in the memory or stream ( see page No further information is available for this error or warning.
359)
E2338: Metadata - Database is read only ( see page 359) No further information is available for this error or warning.
E2335: Metadata - A shared mem open failed to open at the originally ( see No further information is available for this error or warning.
page 359)
E2336: Metadata - Create of shared memory failed. A memory mapping of the No further information is available for this error or warning.
same name already exists ( see page 359)
E2344: Metadata - Data too large ( see page 359) No further information is available for this error or warning.
E2333: Metadata - Data value was truncated ( see page 359) No further information is available for this error or warning.
F2047: Circular unit reference to '%s' ( see page 359) One or more units use each other in their interface parts.
As the compiler has to translate the interface part of a unit before any other unit
can use it, the compiler must be able to find a compilation order for the interface
parts of the units.
Check whether all the units in the uses clauses are really necessary, and
whether some can be moved to the implementation part of a unit instead.
E2123: PROCEDURE, FUNCTION, PROPERTY, or VAR expected ( see page The tokens that follow "class" in a member declaration inside a class type are
360) limited to procedure, function, var, and property.
E2061: Local class or interface types not allowed ( see page 360) Corresponds to object_local in previous compilers. Class and interface types
cannot be declared inside a procedure body.
E2435: Class member declarations not allowed in anonymous record or local Record types that are declared in local scopes or declared in-place in variable
record type ( see page 360) declarations can only contain field declarations. For advanced features in record
types (such as methods, properties, and nested types), the record type must be
an explicitly declared global type.
E2060: Class and interface types only allowed in type section ( see page 360) Class or interface types must always be declared with an explicit type declaration
in a type section. Unlike record types, they cannot be anonymous.
The main reason for this is that there would be no way you could declare the
methods of that type (since there is no type name).
Incorrect (attempting to declare a class type within a variable declaration):
E2355: Class property accessor must be a class field or class static method ( No further information is available for this error or warning.
see page 361)
E2128: %s clause expected, but %s found ( see page 361) The compiler was, due to the Delphi language syntax, expecting to find a clause1
in your program, but instead found clause2.
E2401: Failure loading .NET Framework %s: %08X ( see page 361) No further information is available for this error or warning.
x2421: Imported identifier '%s' conflicts with '%s' in '%s' ( see page 361) When importing type information from a .NET assembly, the compiler may
encounter symbols that do not conform to CLS specifications. One example of
this is case-sensitive versus case-insensitive identifiers. Another example is
having a property in a class with the same name as a method or field in the same
class. This error message indicates that same-named symbols were found in the
same scope (members of the same class or interface) in an imported assembly
and that only one of them will be accessible from Delphi syntax.
E2422: Imported identifier '%s' conflicts with '%s' in namespace '%s' ( see page When importing type information from a .NET assembly, the compiler may
361) encounter symbols that do not conform to CLS specifications. One example of
this is case-sensitive versus case-insensitive identifiers. Another example is
having a property in a class with the same name as a method or field in the same
class. This error message indicates that same-named symbols were found in the
same scope (members of the same class or interface) in an imported assembly
and that only one of them will be accessible from Delphi syntax.
H2384: CLS: overriding virtual method '%s.%s' visibility (%s) must match base No further information is available for this error or warning.
class '%s' (%s) ( see page 362)
E2431: for-in statement cannot operate on collection type '%s' because '%s' does A for-in statement can only operate on the following collection types:
not contain a member for '%s', or it is inaccessible ( see page 362) 3
• Primitive types that the compiler recognizes, such as
arrays, sets or strings
• Types that implement IEnumerable
• Types that implement the GetEnumerator pattern as
documented in the Delphi Language Guide
Ensure that the specified type meets these requirements.
315
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
W1024: Combining signed and unsigned types - widened both operands ( see To mathematically combine signed and unsigned types correctly the compiler
page 362) must promote both operands to the next larger size data type and then perform
the combination.
To see why this is necessary, consider two operands, an Integer with the value
-128 and a Cardinal with the value 130. The Cardinal type has one more digit of
precision than the Integer type, and thus comparing the two values cannot
accurately be performed in only 32 bits. The proper solution for the compiler is to
promote both these types to a larger, common, size and then to perform the
comparison.
The compiler... more ( see page 362)
E2008: Incompatible types ( see page 363) This error message occurs when the compiler expected two types to be
compatible (meaning very similar), but in fact, they turned out to be different. This
error occurs in many different situations - for example when a read or write
clause in a property mentions a method whose parameter list does not match the
property, or when a parameter to a standard procedure or function is of the
wrong type.
This error can also occur when two units both declare a type of the same name.
When a procedure from an imported unit has a parameter of the same-named
type,... more ( see page 363)
E2009: Incompatible types: '%s' ( see page 364) The compiler has detected a difference between the declaration and use of a
procedure.
E2010: Incompatible types: '%s' and '%s' ( see page 365) This error message results when the compiler expected two types to be
compatible (or similar), but they turned out to be different.
W1023: Comparing signed and unsigned types - widened both operands ( see To compare signed and unsigned types correctly the compiler must promote both
page 365) operands to the next larger size data type.
To see why this is necessary, consider two operands, a Shortint with the value
-128 and a Byte with the value 130. The Byte type has one more digit of
precision than the Shortint type, and thus comparing the two values cannot
accurately be performed in only 8 bits. The proper solution for the compiler is to
promote both these types to a larger, common, size and then to perform the
comparison.
W1021: Comparison always evaluates to False ( see page 366) The compiler has determined that the expression will always evaluate to False.
This most often can be the result of a boundary test against a specific variable
type, for example, a Integer against $80000000.
In versions of the Delphi compiler prior to 12.0, the hexadecimal constant
$80000000 would have been a negative Integer value, but with the introduction
of the int64 type, this same constant now becomes a positive int64 type. As a
result, comparisons of this constant against Integer variables will no longer
behave as they once did.
As this is a warning rather than an error, there is... more ( see page 366)
W1022: Comparison always evaluates to True ( see page 366) The compiler has determined that the expression will always evaluate to true.
This most often can be the result of a boundary test against a specific variable
type, for example, a Integer against $80000000.
In versions of the CodeGear Pascal compiler prior to 12.0, the hexadecimal
constant $80000000 would have been a negative Integer value, but with the
introduction of the int64 type, this same constant now becomes a positive int64
type. As a result, comparisons of this constant against Integer variables will no
longer behave as they once did.
As this is a warning rather than an error, there... more ( see page 366)
E2026: Constant expression expected ( see page 367) The compiler expected a constant expression here, but the expression it found
turned out not to be constant.
E2192: Constants cannot be used as open array arguments ( see page 367) Open array arguments must be supplied with an actual array variable, a
constructed array or a single variable of the argument's element type.
E2007: Constant or type identifier expected ( see page 368) This error message occurs when the compiler expects a type, but finds a symbol
that is neither a constant (a constant could start a subrange type), nor a type
identifier.
E2197: Constant object cannot be passed as var parameter ( see page 368) This error message is reserved.
E2177: Constructors and destructors not allowed in OLE automation section ( You have incorrectly tried to put a constructor or destructor into the 'automated'
see page 368) section of a class declaration.
3
x1020: Constructing instance of '%s' containing abstract method '%s.%s' ( see The code you are compiling is constructing instances of classes which contain
page 369) abstract methods.
E2402: Constructing instance of abstract class '%s' ( see page 370) No further information is available for this error or warning.
E2437: Constant declarations not allowed in anonymous record or local record Record types that are declared in local scopes or declared in-place in variable
type ( see page 370) declarations can only contain field declarations. For advanced features in record
types (such as methods, properties, and nested types), the record type must be
an explicitly declared global type.
E2241: C++ obj files must be generated (-jp) ( see page 370) Because of the language features used, standard C object files cannot be
generated for this unit. You must generate C++ object files.
E2412: CREATE expected ( see page 370) No further information is available for this error or warning.
316
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
E2306: 'Self' is initialized more than once ( see page 370) An inherited constructor has been initialized multiple times.
E2304: 'Self' is uninitialized. An inherited constructor must be called ( see page In Delphi for .NET, a constructor must always call an inherited constructor before
370) it may access or initialize any inherited class members. The compiler generates
an error if your constructor code does not call the inherited constructor (a valid
situation in Delphi for Win32), but it is important to examine your constructors to
make sure that you do not access any inherited class fields, directly or indirectly,
before the call to the inherited constructor.
Note: A constructor can initialize fields from its own class, prior to calling the
inherited constructor.
Example:
The class,
E2305: 'Self' might not have been initialized ( see page 371) In Delphi for .NET, a constructor must always call an inherited constructor before
it may access or initialize any inherited class members. The compiler generates
an error if your constructor code does not call the inherited constructor (a valid
situation in Delphi for Win32), but it is important to examine your constructors to
make sure that you do not access any inherited class fields, directly or indirectly,
before the call to the inherited constructor.
Note: A constructor can initialize fields from its own class, prior to calling the
inherited constructor.
E2302: 'Self' is uninitialized. An inherited constructor must be called before In Delphi for .NET, a constructor must always call an inherited constructor before
accessing ancestor field '%s' ( see page 371) it may access or initialize any inherited class members. The compiler generates
an error if your constructor code does not call the inherited constructor (a valid
situation in Delphi for Win32), but it is important to examine your constructors to
make sure that you do not access any inherited class fields, directly or indirectly,
before the call to the inherited constructor.
Note: A constructor can initialize fields from its own class, prior to calling the
inherited constructor.
E2303: 'Self' is uninitialized. An inherited constructor must be called before In Delphi for .NET, a constructor must always call an inherited constructor before
calling ancestor method '%s' ( see page 371) it may access or initialize any inherited class members. The compiler generates
an error if your constructor code does not call the inherited constructor (a valid
situation in Delphi for Win32), but it is important to examine your constructors to
make sure that you do not access any inherited class fields, directly or indirectly,
before the call to the inherited constructor.
Note: A constructor can initialize fields from its own class, prior to calling the
inherited constructor.
E2286: Coverage library name is too long: %s ( see page 371) This message is not used in this product.
H2455: Narrowing given wide string constant lost information ( see page 371) Any character in a WideString constant with ordinal value greater than 127 may
be replaced with "?" if the WideChar is not representable in the current locale
codepage.
H2451: Narrowing given WideChar constant (#$%04X) to AnsiChar lost An AnsiChar can only represent the first 256 values in a WideChar, so the
information ( see page 371) second byte of the WideChar is lost when converting it to an AnsiChar. You may
wish to use WideChar instead of AnsiChar to avoid information loss.
E2238: Default value required for '%s' ( see page 371) When using default parameters a list of parameters followed by a type is not
allowed; you must specify each variable and its default value individually.
E2237: Parameter '%s' not allowed here due to default value ( see page 372) When using default parameters a list of parameters followed by a type is not
allowed; you must specify each variable and its default value individually.
E2132: Default property must be an array property ( see page 373) The default property which you have specified for the class is not an array
property. Default properties are required to be array properties.
E2268: Parameters of this type cannot have default values ( see page 373) The default parameter mechanism incorporated into the Delphi compiler allows
only simple types to be initialized in this manner. You have attempted to use a
type that is not supported.
E2239: Default parameter '%s' must be by-value or const ( see page 374) Parameters which are given default values cannot be passed by reference.
E2131: Class already has a default property ( see page 374) You have tried to assign a default property to a class which already has defined a
default property.
E2146: Default values must be of ordinal, pointer or small set type ( see page You have declared a property containing a default clause, but the type property
375) type is incompatible with default values.
F2087: System unit incompatible with trial version ( see page 376) You are using a trial version of the software. It is incompatible with the application
you are trying to run. 3
E2144: Destination is inaccessible ( see page 376) The address to which you are attempting to put a value is inaccessible from
within the IDE.
E2453: Destination cannot be assigned to ( see page 376) The integrated debugger has determined that your assignment is not valid in the
current context.
E2290: Cannot mix destructors with IDisposable ( see page 376) The compiler will generate IDisposable support for a class that declares a
destructor override named "Destroy". You cannot manually implement
IDisposable and implement a destructor on the same class.
317
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
F2446: Unit '%s' is compiled with unit '%s' in '%s' but different version '%s' found This error occurs if a unit must be recompiled to take in changes to another unit,
( see page 376) but the source for the unit that needs recompilation is not found.
Note: This error message may be experienced when using inline functions.
Expansion of an inline function exposes its implementation to all units that call
the function. When a function is inline, modifications to that function must be
reflected with a recompile of every unit that uses that function. This is true even if
all of the modifications occur in the implementation
section. This is one way in which inlining can make your... more ( see page
376)
E2210: '%s' directive not allowed in in interface type ( see page 376) A directive was encountered during the parsing of an interface which is not
allowed.
E2228: A dispinterface type cannot have an ancestor interface ( see page 377) An interface type specified with dispinterface cannot specify an ancestor
interface.
E2230: Methods of dispinterface types cannot specify directives ( see page Methods declared in a dispinterface type cannot specify any calling convention
377) directives.
E2229: A dispinterface type requires an interface identification ( see page 378) When using dispinterface types, you must always be sure to include a GUID
specification for them.
E2183: Dispid clause only allowed in OLE automation section ( see page 378) A dispid has been given to a property which is not in an automated section.
E2274: property attribute 'label' cannot be used in dispinterface ( see page 379) You have added a label to a property defined in a dispinterface, but this is
disallowed by the language definition.
E2080: Procedure DISPOSE needs destructor ( see page 380) This error message is issued when an identifier given in the parameter list to
Dispose is not a destructor.
E2414: Disposed_ cannot be declared in classes with destructors ( see page Disposed_ cannot be declared in classes with destructors. If a class implements
381) the IDispose interface the compiler generates a field called Disposed_ to
determine whether or not the IDispose.Dispose method has already been called.
E2098: Division by zero ( see page 381) The compiler has detected a constant division by zero in your program.
Check your constant expressions and respecify them so that a division by zero
error will not occur.
E2293: Cannot have both a DLLImport attribute and an external or calling The compiler emits DLLImport attributes internally for external function
convention directive ( see page 381) declarations. This error is raised if you declare your own DLLImport attribute on a
function and use the external name clause on the function.
E2027: Duplicate tag value ( see page 381) This error message is given when a constant appears more than once in the
declaration of a variant record.
E2399: Namespace conflicts with unit name '%s' ( see page 381) No further information is available for this error or warning.
E2030: Duplicate case label ( see page 381) This error message occurs when there is more than one case label with a given
value in a case statement.
W1029: Duplicate %s '%s' with identical parameters will be inacessible from C++ An object file is being generated and Two, differently named, constructors or
( see page 382) destructors with identical parameter lists have been created; they will be
inaccessible if the code is translated to an HPP file because constructor and
destructor names are converted to the class name. In C++ these duplicate
declarations will appear to be the same function.
E2180: Dispid '%d' already used by '%s' ( see page 383) An attempt to use a dispid which is already assigned to another member of this
class.
E2301: Method '%s' with identical parameters and result type already exists ( Within a class, you cannot publish multiple overloaded methods with the same
see page 384) name. Maintenance of runtime type information requires a unique name for each
published member.
E2257: Duplicate implements clause for interface '%s' ( see page 384) The compiler has encountered two different property declarations which claim to
implement the same interface. An interface may be implemented by only one
property.
E2447: Duplicate symbol '%s' defined in namespace '%s' by '%s' and '%s' ( This error occurs when symbols from separate units are combined into a
see page 385) common namespace, and the same symbol name is in both units. In previous
versions of Delphi, these units may have compiled without error, because symbol
scope was defined by the unit alone. In RAD Studio, units must be inserted into
namespaces when generating the IL metadata. This may cause separate units to
be be combined into a single namespace.
To resolve this problem, you may wish to rename one of the symbols in the two
3 units, alias one of the symbols to the other, or change the unit... more ( see
page 385)
E2140: Duplicate message method index ( see page 385) You have specified an index for a dynamic method which is already used by
another dynamic method.
E2252: Method '%s' with identical parameters already exists ( see page 386) A method with an identical signature already exists in the data type.
E2266: Only one of a set of overloaded methods can be published ( see page Only one member of a set of overloaded functions may be published because the
386) RTTI generated for procedures only contains the name.
E2285: Duplicate resource id: type %d id %d ( see page 388) A resource linked into the project has the same type and name, or same type
and resource ID, as another resource linked into the project. (In Delphi, duplicate
resources are ignored with a warning. In Kylix, duplicates cause an error.)
318
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
E2407: Duplicate resource identifier %s found in unit %s(%s) and %s(%s) ( No further information is available for this error or warning.
see page 388)
E2284: Duplicate resource name: type %d '%s' ( see page 388) A resource linked into the project has the same type and name, or same type
and resource ID, as another resource linked into the project. (In Delphi, duplicate
resources are ignored with a warning. In Kylix, duplicates cause an error.)
E2429: Duplicate implementation for 'set of %s' in this scope ( see page 388) To avoid this error, declare an explicit set type identifier instead of using in-place
anonymous set expressions.
W1051: Duplicate symbol names in namespace. Using '%s.%s' found in %s. No further information is available for this error or warning.
Ignoring duplicate in %s ( see page 388)
E2413: Dynamic array type needed ( see page 388) No further information is available for this error or warning.
E2178: Dynamic methods and message handlers not allowed in OLE automation You have incorrectly put a dynamic or message method into an 'automated'
section ( see page 388) section of a class declaration.
E2378: Error while converting resource %s ( see page 389) No further information is available for this error or warning.
E2385: Error while signing assembly ( see page 389) No further information is available for this error or warning.
E2125: EXCEPT or FINALLY expected ( see page 389) The compiler was expecting to find a FINALLY or EXCEPT keyword, during the
processing of exception handling code, but did not find either.
E2029: %s expected but %s found ( see page 390) This error message appears for syntax errors. There is probably a typo in the
source, or something was left out. When the error occurs at the beginning of a
line, the actual error is often on the previous line.
E2191: EXPORTS allowed only at global scope ( see page 390) An EXPORTS clause has been encountered in the program source at a
non-global scope.
E2143: Expression has no value ( see page 390) You have attempted to assign the result of an expression, which did not produce
a value, to a variable.
E2353: Cannot extend sealed class '%s' ( see page 391) The sealed modifier is used to prevent inheritance (and thus extension) of a class.
E2078: Procedure FAIL only allowed in constructor ( see page 391) The standard procedure Fail can only be called from within a constructor - it is
illegal otherwise.
E2169: Field definition not allowed after methods or properties ( see page 391) You have attempted to add more fields to a class after the first method or
property declaration has been encountered. You must place all field definitions
before methods and properties.
E2175: Field definition not allowed in OLE automation section ( see page 391) You have tried to place a field definition in an OLE automation section of a class
declaration. Only properties and methods may be declared in an 'automated'
section.
E2124: Instance member '%s' inaccessible here ( see page 392) You are attempting to reference a instance member from within a class
procedure.
E2209: Field declarations not allowed in interface type ( see page 392) An interface has been encountered which contains definitions of fields; this is not
permitted.
x2044: Chmod error on '%s' ( see page 393) The file permissions are not properly set on a file. See the chmod man page for
more information.
x2043: Close error on '%s' ( see page 393) The compiler encountered an error while closing an input or output file.
This should rarely happen. If it does, the most likely cause is a full or bad disk.
F2039: Could not create output file '%s' ( see page 393) The compiler could not create an output file. This can be a compiled unit file (.dcu
), an executable file, a map file or an object file.
Most likely causes are a nonexistent directory or a write protected file or disk.
x2141: Bad file format: '%s' ( see page 393) The compiler state file has become corrupted. It is not possible to reload the
previous compiler state.
Delete the corrupt file.
E2288: File name too long (exceeds %d characters) ( see page 393) A file path specified in the compiler options exceeds the compiler's file buffer
length.
x1026: File not found: '%s' ( see page 393) This error message occurs when the compiler cannot find an input file. This can
be a source file, a compiled unit file (.dcuil file), an include, an object file or a
resource file.
Check the spelling of the name and the relevant search path.
F1027: Unit not found: '%s' or binary equivalents (%s) ( see page 394) This error message occurs when the compiler cannot find a referenced unit
(.dcuil) file.
Check the spelling of the referenced file name and the relevant search path. 3
x2041: Read error on '%s' ( see page 394) The compiler encountered a read error on an input file.
This should never happen - if it does, the most likely cause is corrupt data.
F2040: Seek error on '%s' ( see page 394) The compiler encountered a seek error on an input or output file.
This should never happen - if it does, the most likely cause is corrupt data.
E2002: File type not allowed here ( see page 394) File types are not allowed as value parameters and as the base type of a file type
itself. They are also not allowed as function return types, and you cannot assign
them - those errors will however produce a different error message.
x2042: Write error on '%s' ( see page 395) The compiler encountered a write error while writing to an output file.
Most likely, the output disk is full.
319
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
E2351: Final methods must be virtual or dynamic ( see page 395) No further information is available for this error or warning.
E2155: Type '%s' needs finalization - not allowed in file type ( see page 395) Certain types are treated specially by the compiler on an internal basis in that
they must be correctly finalized to release any resources that they might currently
own. Because the compiler cannot determine what type is actually stored in a
record's variant section at runtime, it is not possible to guarantee that these
special data types are correctly finalized.
E2154: Type '%s' needs finalization - not allowed in variant record ( see page Certain types are treated specially by the compiler on an internal basis in that
395) they must be correctly finalized to release any resources that they might currently
own. Because the compiler cannot determine what type is actually stored in a
record's variant section at runtime, it is not possible to guarantee that these
special data types are correctly finalized.
E2103: 16-Bit fixup encountered in object file '%s' ( see page 396) A 16-bit fixup has been found in one of the object modules linked to your
program with the $L compiler directive. The compiler only supports 32 bit fixups
in linked object modules.
Make sure that the linked object module is a 32 bit object module.
W1037: FOR-Loop variable '%s' may be undefined after loop ( see page 396) This warning is issued if the value of a for loop control variable is used after the
loop.
You can only rely on the final value of a for loop control variable if the loop is left
with a goto or exit statement.
The purpose of this restriction is to enable the compiler to generate efficient code
for the for loop.
W1015: FOR-Loop variable '%s' cannot be passed as var parameter ( see An attempt has been made to pass the control variable of a FOR-loop to a
page 397) procedure or function which takes a var parameter. This is a warning because
the procedure which receives the control variable is able to modify it, thereby
changing the semantics of the FOR-loop which issued the call.
E2032: For loop control variable must have ordinal type ( see page 398) The control variable of a for loop must have type Boolean, Char, WideChar,
Integer, an enumerated type, or a subrange type.
x1019: For loop control variable must be simple local variable ( see page 398) This error message is given when the control variable of a for statement is not a
simple variable (but a component of a record, for instance), or if it is not local to
the procedure containing the for statement.
For backward compatibility reasons, it is legal to use a global variable as the
control variable - the compiler gives a warning in this case. Note that using a
local variable will also generate more efficient code.
E2037: Declaration of '%s' differs from previous declaration ( see page 399) This error message occurs when the declaration of a procedure, function,
method, constructor or destructor differs from its previous (forward) declaration.
This error message also occurs when you try to override a virtual method, but the
overriding method has a different parameter list, calling convention etc.
E2065: Unsatisfied forward or external declaration: '%s' ( see page 400) This error message appears when you have a forward or external declaration of
a procedure or function, or a declaration of a method in a class or object type,
and you don't define the procedure, function or method anywhere.
Maybe the definition is really missing, or maybe its name is just misspelled.
Note that a declaration of a procedure or function in the interface section of a unit
is equivalent to a forward declaration - you have to supply the implementation
(the body of the procedure or function) in the implementation section.
Similarly, the declaration of a method in a... more ( see page 400)
W1011: Text after final 'END.' - ignored by compiler ( see page 401) This warning is given when there is still source text after the final end and the
period that constitute the logical end of the program. Possibly the nesting of
begin-end is inconsistent (there is one end too many somewhere). Check
whether you intended the source text to be ignored by the compiler - maybe it is
actually quite important.
E2127: 'GOTO %s' leads into or out of TRY statement ( see page 401) The GOTO statement cannot jump into or out of an exception handling
statement.
E2295: A class helper cannot introduce a destructor ( see page 402) Class helpers cannot declare destructors.
320
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
E2172: Necessary library helper function was eliminated by linker (%s) ( see The integrated debugger is attempting to use some of the compiler helper
page 402) functions to perform the requested evaluate. The linker, on the other hand,
determined that the helper function was not actually used by the program and it
did not link it into the program.
321
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
E2427: Only one of IID or GuidAttribute can be specified ( see page 407) The GUID or IID of your interface can be specified using square brackets at the
top of the interface declaration or using a .NET attribute before the interface
declaration. You may use either style of GUID or IID declaration, but not both
styles in the same type.
E2038: Illegal character in input file: '%s' (%s) ( see page 408) The compiler found a character that is illegal in Delphi programs.
This error message is caused most often by errors with string constants or
comments.
E2182: '%s' clause not allowed in OLE automation section ( see page 408) INDEX, STORED, DEFAULT and NODEFAULT are not allowed in OLE
automation sections.
E2231: '%s' directive not allowed in dispinterface type ( see page 409) You have specified a clause in a dispinterface type which is not allowed.
E2207: '%s' clause not allowed in interface type ( see page 409) The clause noted in the message is not allowed in an interface type. Typically
this error indicates that an illegal directive has been specified for a property field
in the interface.
E2176: Illegal type in OLE automation section: '%s' ( see page 410) <typename> is not an allowed type in an OLE automation section. Only a small
subset of all the valid Delphi language types are allowed in automation sections.
E2185: Overriding automated virtual method '%s' cannot specify a dispid ( see The dispid declared for the original virtual automated procedure declaration must
page 411) be used by all overriding procedures in derived classes.
E2068: Illegal reference to symbol '%s' in object file '%s' ( see page 412) This error message is given if an object file loaded with a $L or $LINK directive
contains a reference to a Delphi symbol that is not a procedure, function,
variable, typed constant or thread local variable.
E2139: Illegal message method index ( see page 412) You have specified value for your message index which <= 0.
E2224: $DESIGNONLY and $RUNONLY only allowed in package unit ( see The compiler has encountered either $designonly or $runonly in a source file
page 412) which is not a package. These directives affect the way that the IDE will treat a
package file, and therefore can only be contained in package source files.
E2184: %s section valid only in class types ( see page 412) Interfaces and records may not contain published sections.
Records may not contain protected sections.
W1043: Imagebase $%X is not a multiple of 64k. Rounding down to $%X ( see You can set an imagebase for a DLL to position it in a specific location in memory
page 413) using the $IMAGEBASE compiler directive. The $IMAGEBASE directive controls
the default load address for an application, DLL, or package. The number
specified as the imagebase in the directive must be a multiple of 64K (that is, a
hex number must have zeros as the last 4 digits), otherwise, it will be rounded
down to the nearest multiple, and you will receive this compiler message.
E2227: Imagebase is too high - program exceeds 2 GB limit ( see page 413) There are three ways to cause this error: 1. Specify a large enough imagebase
that, when compiled, the application code passes the 2GB boundary. 2. Specify
an imagebase via the command line which is above 2GB. 3. Specify an
imagebase via $imagebase which is above 2GB.
The only solution to this problem is to lower the imagebase address sufficiently
so that the entire application will fit below the 2GB limit.
E2260: Implements clause not allowed together with index clause ( see page You have tried to use an index clause with an implements clause. Index
413) specifiers allow several properties to share the same access method while
representing different values. The implements directive allows you to delegate
implementation of an interface to a property in the implementing class but it
cannot take an index specifier.
E2263: Implements getter cannot be dynamic or message method ( see page An attempt has been made to use a dynamic or message method as a property
413) accessor of a property which has an implements clause.
E2264: Cannot have method resolutions for interface '%s' ( see page 414) An attempt has been made to use a method resolution clause for an interface
named in an implements clause.
E2258: Implements clause only allowed within class types ( see page 415) The interface definition in this example attempts to use an implements clause
which causes the error.
E2259: Implements clause only allowed for properties of class or interface type An attempt has been made to use the implements clause with an improper type.
( see page 415) Only class or interface types may be used.
E2262: Implements getter must be %s calling convention ( see page 415) The compiler has encountered a getter or setter which does not have the correct
calling convention.
E2265: Interface '%s' not mentioned in interface list ( see page 416) An implements clause references an interface which is not mentioned in the
interface list of the class.
E2261: Implements clause only allowed for readable property ( see page 416) The compiler has encountered a "write only" property that claims to implement an
3 interface. A property must be read/write to use the implements clause.
x1033: Unit '%s' implicitly imported into package '%s' ( see page 417) The unit specified was not named in the contains clause of the package, but a
unit which has already been included in the package imports it.
This message will help the programmer avoid violating the rule that a unit may
not reside in more than one related package.
Ignoring the warning, will cause the unit to be put into the package. You could
also explicitly list the named unit in the contains clause of the package to
accomplish the same result and avoid the warning altogether. Or, you could alter
the package list to load the named unit from another... more ( see page 417)
W1040: Implicit use of Variants unit ( see page 417) If your application is using a Variant type, the compiler includes the Variant unit in
the uses clause but warns you that you should add it explicitly.
322
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
E2420: Interface '%s' used in '%s' is not yet completely defined ( see page 417) Interface used in is not yet completely defined. Forward declared interfaces must
be declared in the same type section that they are used in. As an example the
following code will not compile because of the above error message:
E2086: Type '%s' is not yet completely defined ( see page 418) This error occurs if there is either a reference to a type that is just being defined,
or if there is a forward declared class type in a type section and no final
declaration of that type.
E2195: Cannot initialize local variables ( see page 418) The compiler disallows the use of initialized local variables.
E2196: Cannot initialize multiple variables ( see page 419) Variable initialization can only occur when variables are declared individually.
E2194: Cannot initialize thread local variables ( see page 419) The compiler does not allow initialization of thread local variables.
E2072: Number of elements (%d) differs from declaration (%d) ( see page 420) This error message appears when you declare a typed constant or initialized
variable of array type, but do not supply the appropriate number of elements.
E2428: Field '%s' needs initialization - not allowed in CLS compliant value types CLS-compliant value types cannot have fields that require initialization. See
( see page 420) ECMA 335, Partition II, Section 12.
E2418: Type '%s' needs initialization - not allowed in variant record ( see page Type needs initialization - not allowed in variant record. Variant records do not
420) allow types that need initialization in their variant field list since each variant field
references the same memory location. As an example, the following code will not
compile because the array type needs to be initialized.
E2426: Inline function must not have asm block ( see page 421) Inline functions can not include an asm block. To avoid this error, remove the
inline directive from your function or use Pascal code to express the statements
in the asm block.
E2442: Inline directive not allowed in constructor or destructor ( see page 421) Remove the inline directive to prevent this error.
H2444: Inline function '%s' has not been expanded because accessing member An inline function cannot be expanded when the inline function body refers to a
'%s' is inaccessible ( see page 421) restricted member that is not accessible where the function is called.
For example, if an inline function refers to a strict private field and this function
is called from outside the class (e.g. from a global procedure), the field is not
accessible at the call site and the inline function is not expanded.
E2425: Inline methods must not be virtual nor dynamic ( see page 421) In order for an inline method to be inserted inline at compile-time, the method
must be bound at compile-time. Virtual and dynamic methods are not bound until
run-time, so they cannot be inserted inline. Make sure your method is static if you
wish it to be inline.
E2449: Inlined nested routine '%s' cannot access outer scope variable '%s' ( You can use the inline directive with nested procedures and functions. However,
see page 421) a nested procedure or function that refers to a variable that is local to the outer
procedure is not eligible for inlining.
H2445: Inline function '%s' has not been expanded because its unit '%s' is Inline functions are not expanded between circularly dependent units.
specified in USES statement of IMPLEMENTATION section and current function
is inline function or being inline function ( see page 421)
H2443: Inline function '%s' has not been expanded because unit '%s' is not This situation may occur if an inline function refers to a type in a unit that is not
specified in USES list ( see page 421) explicitly used by the function's unit. For example, this may happen if the function
uses inherited to refer to methods inherited from a distant ancestor, and that
ancestor's unit is not explicitly specified in the uses list of the function's unit.
If the inline function's code is to be expanded, then the unit that calls the function
must explicitly use the unit where the ancestor type is exposed.
E2441: Inline function declared in interface section must not use local symbol This error occurs when an inline function is declared in the interface section and
'%s' ( see page 422) it refers to a symbol that is not visible outside the unit. Expanding the inline
function in another unit would require accessing the local symbol from outside the
unit, which is not permitted.
To correct this error, move the local symbol declaration to the interface section,
or make it an instance variable or class variable of the function's class type.
E2382: Cannot call constructors using instance variables ( see page 422) No further information is available for this error or warning.
E2102: Integer constant too large ( see page 422) You have specified an integer constant that requires more than 64 bits to
represent.
F2084: Internal Error: %s%d ( see page 422) Occasionally when compiling an application in Delphi, the compile will halt and
display an error message that reads, for example:
E2232: Interface '%s' has no interface identification ( see page 423) You have attempted to assign an interface to a GUID type, but the interface was
not defined with a GUID.
E2291: Missing implementation of interface method %s.%s ( see page 423) This indicates that you have forgotten to implement a method required by an
interface supported by your class type. 3
E2211: Declaration of '%s' differs from declaration in interface '%s' ( see page A method declared in a class which implements an interface is different from the
423) definition which appears in the interface. Probable causes are that a parameter
type or return value is declared differently, the method appearing in the class is a
message method, the identifier in the class is a field or the identifier in the class
is a property, which does not match with the definition in the interface.
E2208: Interface '%s' already implemented by '%s' ( see page 425) The class specified by name2 has specified the interface name1 more than once
in the inheritance section of the class definition.
323
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
E2089: Invalid typecast ( see page 425) This error message is issued for type casts not allowed by the rules. The
following kinds of casts are allowed:
324
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
F2438: UCS-4 text encoding not supported. Convert to UCS-2 or UTF-8 ( see This error is encountered when a source file has a UCS-4 encoding, as indicated
page 430) by its Byte-Order-Mark (BOM). The compiler does not support compilation of
source files in UCS-4 Unicode encoding. To solve this problem, convert the
source file to UCS-2 or UTF-8 encoding.
E2386: Invalid version string '%s' specified in %s ( see page 430) No further information is available for this error or warning.
E2120: LOOP/JCXZ distance out of range ( see page 430) You have specified a LOOP or JCXZ destination which is out of range. You
should not receive this error as the jump range is 2Gb for LOOP and JCXZ
instructions.
E2049: Label declaration not allowed in interface part ( see page 430) This error occurs when you declare a label in the interface part of a unit.
E2073: Label already defined: '%s' ( see page 431) This error message is given when a label is set on more than one statement.
E2074: Label declared and referenced, but not set: '%s' ( see page 431) You declared and used a label in your program, but the label definition was not
encountered in the source code.
F2069: Line too long (more than 1023 characters) ( see page 432) This error message is given when the length of a line in the source file exceeds
255 characters.
Usually, you can divide the long line into two shorter lines.
If you need a really long string constant, you can break it into several pieces on
consecutive lines that you concatenate with the '+' operator.
E2364: Cross-assembly protected reference to [%s]%s.%s in %s.%s ( see In Delphi for .NET, members with protected visibility cannot be accessed outside
page 432) of the assembly in which they are defined. If possible, you may want to use the
publicly-exposed members of the class to accomplish your goal.
Other ways to resolve this error:
325
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
E2350: Metadata - No logical space left to create more user strings ( see page No further information is available for this error or warning.
436)
F2046: Out of memory ( see page 436) The compiler ran out of memory.
This should rarely happen. If it does, make sure your swap file is large enough
and that there is still room on the disk.
x1054: Linker error: %s ( see page 436) This message emits a warning or other text generated using the $MESSAGE
directive.
E2096: Method identifier expected ( see page 436) This error message will be issued in several different situations:
326
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
E2021: Class type required ( see page 441) In certain situations the compiler requires a class type:
327
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
W1039: No configuration files found ( see page 453) The compiler could not locate the configuration files referred to in the source
code.
E2256: Dispose not supported (nor necessary) for dynamic arrays ( see page The compiler has encountered a use of the standard procedure DISPOSE on a
453) dynamic array. Dynamic arrays are reference counted and will automatically free
themselves when there are no longer any references to them.
E2250: There is no overloaded version of '%s' that can be called with these An attempt has been made to call an overloaded function that cannot be resolved
arguments ( see page 454) with the current set of overloads.
E2450: There is no overloaded version of array property '%s' that can be used To correct this error, either change the arguments so that their types match a
with these arguments ( see page 454) version of the array property, or add a new overload of the array property with
types that match the arguments.
E2273: No overloaded version of '%s' with this parameter list exists ( see page An attempt has been made to call an overloaded procedure but no suitable
455) match could be found.
E2025: Procedure cannot have a result type ( see page 455) You have declared a procedure, but given it a result type. Either you really meant
to declare a function, or you should delete the result type.
W1035: Return value of function '%s' might be undefined ( see page 456) This warning is displayed if the return value of a function has not been assigned
a value on every code path.
To put it another way, the function could execute so that it never assigns
anything to the return value.
E2134: Type '%s' has no type info ( see page 457) You have applied the TypeInfo standard procedure to a type identifier which does
not have any run-time type information associated with it.
E2220: Never-build package '%s' requires always-build package '%s' ( see You are attempting to create a no-build package which requires an always-build
page 458) package. Since the interface of an always-build package can change at anytime,
and since giving the no-build flag instructs the compiler to assume that a package
is up-to-date, each no-build package can only require other packages that are
also marked no-build.
E2093: Label '%s' is not declared in current procedure ( see page 458) In contrast to standard Pascal, Borland's Delphi language does not allow a goto
to jump out of the current procedure.
However, his construct is mainly useful for error handling, and the Delphi
language provides a more general and structured mechanism to deal with errors:
exception handling.
x2269: Overriding virtual method '%s.%s' has lower visibility (%s) than base class The method named in the error message has been declared as an override of a
'%s' (%s) ( see page 459) virtual method in a base class, but the visibility in the current class is lower than
that used in the base class for the same method.
While the visibility rules of Delphil would seem to indicate that the function cannot
be seen, the rules of invoking virtual functions will cause the function to be
properly invoked through a virtual call.
Generally, this means that the method of the derived class was declared in a
private or protected section while the method of the base class... more ( see
page 459)
E2411: Unit %s in package %s refers to unit %s which is not found in any No further information is available for this error or warning.
package. Packaged units must refer only to packaged units ( see page 460)
E2236: Constructors and destructors must have %s calling convention ( see An attempt has been made to change the calling convention of a constructor or
page 460) destructor from the default calling convention.
E2179: Only register calling convention allowed in OLE automation section ( You have specified an illegal calling convention on a method appearing in an
see page 461) 'automated' section of a class declaration.
E2270: Published property getters and setters must have %s calling convention A property appearing in a published section has a getter or setter procedure that
( see page 462) does not have the correct calling convention.
E2391: Potentially polymorphic constructor calls must be virtual ( see page 462) No further information is available for this error or warning.
E2242: '%s' is not the name of a unit ( see page 462) The $NOINCLUDE directive must be given a known unit name.
E2064: Left side cannot be assigned to ( see page 462) This error message is given when you try to modify a read-only object like a
constant, a constant parameter, or the return value of function.
E2430: for-in statement cannot operate on collection type '%s' ( see page 463) A for-in statement can only operate on the following collection types:
328
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
E2058: Class, interface and object types only allowed in type section ( see Class or object types must always be declared with an explicit type declaration in
page 464) a type section - unlike record types, they cannot be anonymous.
The main reason for this is that there would be no way you could declare the
methods of that type - after all, there is no type name.
E2059: Local class, interface or object types not allowed ( see page 465) Class and object cannot be declared local to a procedure.
E2062: Virtual constructors are not allowed ( see page 465) Unlike class types, object types can only have static constructors.
E2439: Inline function must not have open array argument ( see page 466) To avoid this error, remove the inline directive or use an explicitly-declared
dynamic array type instead of an open array argument.
W1049: value '%s' for option %s was truncated ( see page 466) String based compiler options such as unit search paths have finite buffer limits.
This message indicates you have exceeded the buffer limit.
E2001: Ordinal type required ( see page 466) The compiler required an ordinal type at this point. Ordinal types are the
predefined types Integer, Char, WideChar, Boolean, and declared enumerated
types.
Ordinal types are required in several different situations:
329
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
W1032: Exported package threadvar '%s.%s' cannot be used outside of this Windows does not support the exporting of threadvar variables from a DLL, but
package ( see page 471) since using packages is meant to be semantically equivalent to compiling a
project without them, the Delphi compiler must somehow attempt to support this
construct.
This warning is to notify you that you have included a unit which contains a
threadvar in an interface into a package. While this is not illegal, you will not be
able to access the variable from a unit outside the package.
Attempting to access this variable may appear to succeed, but it actually did not.
A solution to this warning is... more ( see page 471)
E2213: Bad packaged unit format: %s.%s ( see page 471) When the compiler attempted to load the specified unit from the package, it was
found to be corrupt. This problem could be caused by an abnormal termination of
the compiler when writing the package file (for example, a power loss). The first
recommended action is to delete the offending DCP file and recompile the
package.
E2006: PACKED not allowed here ( see page 471) The packed keyword is only legal for set, array, record, object, class and file
types. In contrast to the 16-bit version of Delphi, packed will affect the layout of
record, object and class types.
E2394: Parameterless constructors not allowed on record types ( see page No further information is available for this error or warning.
472)
E2363: Only methods of descendent types may access protected symbol No further information is available for this error or warning.
[%s]%s.%s across assembly boundaries ( see page 472)
E2375: PRIVATE or PROTECTED expected ( see page 472) No further information is available for this error or warning.
W1045: Property declaration references ancestor private '%s.%s' ( see page This warning indicates that your code is not portable to C++. This is important for
472) component writers who plan to distribute custom components.
In the Delphi language, you can declare a base class with a private member, and
a child class in the same unit can refer to the private member. In C++, this
construction is not permitted. To fix it, change the child to refer to either a
protected member of the base class or a protected member of the child class.
Following is an example of code that would cause this error:
H2219: Private symbol '%s' declared but never used ( see page 472) The symbol referenced appears in a private section of a class, but is never used
by the class. It would be more memory efficient if you removed the unused
private field from your class definition.
E2357: PROCEDURE, FUNCTION, or CONSTRUCTOR expected ( see page No further information is available for this error or warning.
473)
E2122: PROCEDURE or FUNCTION expected ( see page 473) This error message is produced by two different constructs, but in both cases the
compiler is expecting to find the keyword 'procedure' or the keyword 'function'.
x2367: Case of property accessor method %s.%s should be %s.%s ( see page No further information is available for this error or warning.
474)
E2300: Cannot generate property accessor '%s' because '%s' already exists ( No further information is available for this error or warning.
see page 474)
E2370: Cannot use inherited methods for interface property accessors ( see No further information is available for this error or warning.
page 474)
H2369: Property accessor %s should be %s ( see page 474) No further information is available for this error or warning.
H2368: Visibility of property accessor method %s should match property %s.%s No further information is available for this error or warning.
( see page 474)
E2181: Redeclaration of property not allowed in OLE automation section ( see It is not allowed to move the visibility of a property into an automated section.
page 474)
E2206: Property overrides not allowed in interface type ( see page 475) A property which was declared in a base interface has been overridden in an
interface extension.
E2356: Property accessor must be an instance field or method ( see page 476) No further information is available for this error or warning.
E2434: Property declarations not allowed in anonymous record or local record Record types that are declared in local scopes or declared in-place in variable
type ( see page 476) declarations can only contain field declarations. For advanced features in record
types (such as methods, properties, and nested types), the record type must be
an explicitly declared global type.
E2148: Dynamic method or message handler not allowed here ( see page 476) Dynamic and message methods cannot be used as accessor functions for
properties.
3 E2233: Property '%s' inaccessible here ( see page 477) An attempt has been made to access a property through a class reference type.
It is not possible to access fields nor properties of a class through a class
reference.
E2275: property attribute 'label' cannot be an empty string ( see page 477) The error is output because the label attribute for g is an empty string.
E2292: '%s' must reference a property or field of class '%s' ( see page 478) In custom attribute declaration syntax, you can pass values to the constructor of
the attribute class, followed by name=value pairs, where name is a property or
field of the attribute class.
E2129: Cannot assign to a read-only property ( see page 478) The property to which you are attempting to assign a value did not specify a
'write' clause, thereby causing it to be a read-only property.
330
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
E2130: Cannot read a write-only property ( see page 479) The property from which you are attempting to read a value did not specify a
'read' clause, thereby causing it to be a write-only property.
E2362: Cannot access protected symbol %s.%s ( see page 480) No further information is available for this error or warning.
E2389: Protected member '%s' is inaccessible here ( see page 480) No further information is available for this error or warning.
H2244: Pointer expression needs no Initialize/Finalize - need ^ operator? ( see You have attempted to finalize a Pointer type.
page 480)
E2186: Published Real property '%s' must be Single, Real, Double or Extended You have attempted to publish a property of type Real, which is not allowed.
( see page 480) Published floating point properties must be Single, Double, or Extended.
E2187: Size of published set '%s' is >4 bytes ( see page 481) The compiler does not allow sets greater than 32 bits to be contained in a
published section. The size, in bytes, of a set can be calculated by
High(setname) div 8 - Low(setname) div 8 + 1. -$M+
E2361: Cannot access private symbol %s.%s ( see page 481) No further information is available for this error or warning.
E2390: Class must be sealed to call a private constructor without a type qualifier No further information is available for this error or warning.
( see page 481)
E2398: Class methods in record types must be static ( see page 482) No further information is available for this error or warning.
E2083: Order of fields in record constant differs from declaration ( see page This error message occurs if record fields in a typed constant or initialized
482) variable are not initialized in declaration order.
E2419: Record type too large: exceeds 1 MB ( see page 482) Records are limited to a size of 1MB according to the .NET SDK Documentation.
Refer to Partition II Medatada 21.8 ClassLayout: 0x0F
E2245: Recursive include file %s ( see page 482) The $I directive has been used to recursively include another file. You must
check to make sure that all include files terminate without having cycles in them.
F2092: Program or unit '%s' recursively uses itself ( see page 482) An attempt has been made for a unit to use itself.
E2214: Package '%s' is recursively required ( see page 483) When compiling a package, the compiler determined that the package requires
itself.
E2145: Re-raising an exception only allowed in exception handler ( see page You have used the syntax of the raise statement which is used to reraise an
483) exception, but the compiler has determined that this reraise has occurred outside
of an exception handler block. A limitation of the current exception handling
mechanism disallows reraising exceptions from nested exception handlers. for
the exception.
E2377: Unable to locate Borland.Delphi.Compiler.ResCvt.dll ( see page 484) No further information is available for this error or warning.
E2381: Resource string length exceeds Windows limit of 4096 characters ( see No further information is available for this error or warning.
page 484)
E2024: Invalid function result type ( see page 484) File types are not allowed as function result types.
Linker error: %s ( see page 484) The resource linker (RLINK32) has encountered an error while processing a
resource file. This error may be caused by any of the following reasons:
331
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
E2028: Sets may have at most 256 elements ( see page 486) This error message appears when you try to declare a set type of more than 256
elements. More precisely, the ordinal values of the upper and lower bounds of
the base type must be within the range 0..255.
E2282: Property setters cannot take var parameters ( see page 486) This message is displayed when you try to use a var parameter in a property
setter parameter. The parameter of a property setter procedure cannot be a var
or out parameter.
E2193: Slice standard function only allowed as open array argument ( see An attempt has been made to pass an array slice to a fixed size array. Array
page 487) slices can only be sent to open array parameters. none
E2454: Slice standard function not allowed for VAR nor OUT argument ( see You cannot write back to a slice of an array, so you cannot use the slice standard
page 487) function to pass an argument that is var or out. If you must modify the array,
either pass in the full array or use an array variable to hold the desired part of the
full array.
E2240: $EXTERNALSYM and $NODEFINE not allowed for '%s'; only global The $EXTERNALSYM and $NODEFINE directives can only be applied to global
symbols ( see page 487) symbols.
W1014: String constant truncated to fit STRING[%ld] ( see page 487) A string constant is being assigned to a variable which is not large enough to
contain the entire string. The compiler is alerting you to the fact that it is
truncating the literal to fit into the variable. -W
E2354: String element cannot be passed to var parameter ( see page 488) No further information is available for this error or warning.
E2056: String literals may have at most 255 elements ( see page 488) This error message occurs when you declare a string type with more than 255
elements, if you assign a string literal of more than 255 characters to a variable of
type ShortString, or when you have more than 255 characters in a single
character string.
Note that you can construct long string literals spanning more than one line by
using the '+' operator to concatenate several string literals.
E2408: Can't extract strong name key from assembly %s ( see page 489) No further information is available for this error or warning.
W1044: Suspicious typecast of %s to %s ( see page 489) This warning flags typecasts like PWideChar(String) or PChar(WideString) which
are casting between different string types without character conversion.
E2272: Cannot use reserved unit name '%s' ( see page 489) An attempt has been made to use one of the reserved unit names, such as
System, as the name of a user-created unit.
The names in the following list are currently reserved by the compiler.
• System
• SysInit
E2156: Expression too complicated ( see page 489) The compiler has encounter an expression in your source code that is too
complicated for it to handle.
Reduce the complexity of your expression by introducing some temporary
variables.
E2283: Too many local constants. Use shorter procedures ( see page 489) One or more of your procedures contain so many string constant expressions
that they exceed the compiler's internal storage limit. This can occur in code that
is automatically generated. To fix this, you can shorten your procedures or
declare contant identifiers instead of using so many literals in the code.
E2163: Too many conditional symbols ( see page 490) You have exceeded the memory allocated to conditional symbols defined on the
command line (including configuration files). There are 256 bytes allocated for all
the conditional symbols. Each conditional symbol requires 1 extra byte when
stored in conditional symbol area.
The only solution is to reduce the number of conditional compilation symbols
contained on the command line (or in configuration files).
E2226: Compilation terminated; too many errors ( see page 490) The compiler has surpassed the maximum number of errors which can occur in a
single compilation.
The only solution is to address some of the errors and recompile the project.
E2034: Too many actual parameters ( see page 490) This error message occurs when a procedure or function call gives more
parameters than the procedure or function declaration specifies.
Additionally, this error message occurs when an OLE automation call has too
many (more than 255), or too many named parameters.
E2436: Type declarations not allowed in anonymous record or local record type Record types that are declared in local scopes or declared in-place in variable
3 ( see page 491) declarations can only contain field declarations. For advanced features in record
types (such as methods, properties, and nested types), the record type must be
an explicitly declared global type.
E2005: '%s' is not a type identifier ( see page 491) This error message occurs when the compiler expected the name of a type, but
the name it found did not stand for a type.
x2243: Expression needs no Initialize/Finalize ( see page 491) You have attempted to use the standard procedure Finalize on a type that
requires no finalization.
E2100: Data type too large: exceeds 2 GB ( see page 492) You have specified a data type which is too large for the compiler to represent.
The compiler will generate this error for datatypes which are greater or equal to 2
GB in size. You must decrease the size of the description of the type.
332
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
E2101: Size of data type is zero ( see page 492) Record types must contain at least one instance data field. Zero-size records are
not allowed in .NET.
W1016: Typed constant '%s' passed as var parameter ( see page 492) This error message is reserved.
W1055: Published caused RTTI ($M+) to be added to type '%s' ( see page 492) You added a 'PUBLISHED' section to a class that was not compiled while the
{$M+}/{$TYPEINFO ON} switch was in effect, or without deriving from a class
compiled with the {$M+}/{$TYPEINFO ON} switch in effect.
The TypeInfo standard procedure requires a type identifier as its parameter. In
the code above, 'NotType' does not represent a type identifier.
To avoid this error, ensure that you compile while the {$M+}/{$TYPEINFO ON}
switch is on, or derive from a class that was compiled with {$M+}/{$TYPEINFO
ON} switch on.
E2133: TYPEINFO standard function expects a type identifier ( see page 493) You have attempted to obtain type information for an identifier which does not
represent a type.
E2147: Property '%s' does not exist in base class ( see page 493) The compiler believes you are attempting to hoist a property to a different
visibility level in a derived class, but the specified property does not exist in the
base class.
E2452: Unicode characters not allowed in published symbols ( see page 494) The VCL Run-Time Type Information (RTTI) subsystem and the streaming of
DFM files require that published symbols are non-Unicode (ANSI) characters.
Consider whether this symbol needs to be published, and if so, use ANSI
characters instead of Unicode.
W1041: Error converting Unicode char to locale charset. String truncated. Is your This message occurs when you are trying to convert strings in Unicode to your
LANG environment variable set correctly? ( see page 494) local character set and the string contains characters that are not valid for the
current locale. For example, this may occur when converting WideString to
AnsiString or if attempting to display Japanese characters in an English locale.
W1006: Unit '%s' is deprecated ( see page 494) The unit is deprecated, but continues to be available to support backward
compatibility.
The unit is tagged (using the deprecated hint directive) as no longer current and
is maintained for compatibility only. You should consider updating your source
code to use another unit, if possible.
The $WARN UNIT_DEPRECATED ON/OFF compiler directive turns on or off all
warnings about the deprecated directive in units where the deprecated directive
is specified.
W1007: Unit '%s' is experimental ( see page 494) An "experimental" directive has been used on an identifier. "Experimental"
indicates the presence of a class or unit which is incomplete or not fully tested.
F2048: Bad unit format: '%s' ( see page 495) This error occurs when a compiled unit file (.dcu file) has a bad format.
Most likely, the file has been corrupted. Recompile the file if you have the source.
If the problem persists, you may have to reinstall Delphi.
W1052: Can't find System.Runtime.CompilerServices.RunClassConstructor. Unit This warning indicates that the initialization order defined by the Delphi language,
initialization order will not follow uses clause order ( see page 495) that specified by the order of units in the uses clause, is not guaranteed.
The RunClassConstructor function is used to execute the initialization sections of
units used by the current unit in the order specified by the current unit's uses
clauses. This warning will be issued if the compiler cannot find this function in the
.NET Framework you are linking against. For example, it will occur when linking
against the .NET Compact Framework, which does not implement
RunClassConstructor.
W1004: Unit '%s' is specific to a library ( see page 495) The whole unit is tagged (using the library hint directive) as one that may not be
available in all libraries. If you are likely to use different libraries, it may cause a
problem.
The $WARN UNIT_LIBRARY ON/OFF compiler directive turns on or off all
warnings in units where the library directive is specified.
E1038: Unit identifier '%s' does not match file name ( see page 495) The unit name in the top unit is case sensitive and must match the name with
respect to upper- and lowercase letters exactly. The unit name is case sensitive
only in the unit declaration.
W1005: Unit '%s' is specific to a platform ( see page 495) The whole unit is tagged (using the platform hint directive) as one that contains
material that may not be available on all platforms. If you are writing
cross-platform applications, it may cause a problem. For example, a unit that
uses objects defined in OleAuto might be tagged using the PLATFORM directive
The $WARN UNIT_PLATFORM ON/OFF compiler directive turns on or off all
warnings about the platform directive in units where the platform directive is
3
specified.
E2070: Unknown directive: '%s' ( see page 495) This error message appears when the compiler encounters an unknown directive
in a procedure or function declaration.
The directive is probably misspelled, or a semicolon is missing.
E2328: Linker error while emitting metadata ( see page 496) No further information is available for this error or warning.
E2400: Unknown Resource Format '%s' ( see page 496) No further information is available for this error or warning.
E2216: Can't handle section '%s' in object file '%s' ( see page 496) You are trying to link object modules into your program with the $L compiler
directive. However, the object file is too complex for the compiler to handle. For
example, you may be trying to link in a C++ object file. This is not supported.
333
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
E2405: Unknown element type found importing signature of %s.%s ( see page No further information is available for this error or warning.
496)
E2417: Field offset cannot be determined for variant record because previous Private types in an assembly are not imported and are marked as having an
field type is unknown size record type ( see page 496) unreliable size. If a record is declared as having at least one private field or it has
one field whose type size is unreliable then this error will occur.
E2166: Unnamed arguments must precede named arguments in OLE You have attempted to follow named OLE Automation arguments with unnamed
Automation call ( see page 496) arguments.
E2289: Unresolved custom attribute: %s ( see page 497) A custom attribute declaration was not followed by a symbol declaration such as
a type, variable, method, or parameter declaration.
W1048: Unsafe typecast of '%s' to '%s' ( see page 497) You have used a data type or operation for which static code analysis cannot
prove that it does not overwrite memory. In a secured execution environment
such as .NET, such code is assumed to be unsafe and a potential security risk.
W1047: Unsafe code '%s' ( see page 497) You have used a data type or operation for which static code analysis cannot
prove that it does not overwrite memory. In a secured execution environment
such as .NET, such code is assumed to be unsafe and a potential security risk.
E2406: EXPORTS section allowed only if compiling with {$UNSAFECODE ON} No further information is available for this error or warning.
( see page 497)
W1046: Unsafe type '%s%s%s' ( see page 497) You have used a data type or operation for which static code analysis cannot
prove that it does not overwrite memory. In a secured execution environment
such as .NET, such code is assumed to be unsafe and a potential security risk.
E2396: Unsafe code only allowed in unsafe procedure ( see page 497) No further information is available for this error or warning.
E2395: Unsafe procedure only allowed if compiling with {$UNSAFECODE ON} No further information is available for this error or warning.
( see page 498)
E2397: Unsafe pointer only allowed if compiling with {$UNSAFECODE ON} ( No further information is available for this error or warning.
see page 498)
E2410: Unsafe pointer variables, parameters or consts only allowed in unsafe No further information is available for this error or warning.
procedure ( see page 498)
x1025: Unsupported language feature: '%s' ( see page 498) You are attempting to translate a Delphi unit to a C++ header file which contains
unsupported language features.
You must remove the offending construct from the interface section before the
unit can be translated.
E2057: Unexpected end of file in comment started on line %ld ( see page 498) This error occurs when you open a comment, but do not close it.
Note that a comment started with '{' must be closed with '}', and a comment
started with '(*' must be closed with '*)'.
E2280: Unterminated conditional directive ( see page 498) For every {$IFxxx}, the corresponding {$ENDIF} or {$IFEND} must be found
within the same source file. This message indicates that you do not have an
equal number of ending directives.
This error message is reported at the source line of the last $IF/$IFDEF/etc. with
no matching $ENDIF/$IFEND. This gives you a good place to start looking for the
source of the problem.
E2052: Unterminated string ( see page 498) The compiler did not find a closing apostrophe at the end of a character string.
Note that character strings cannot be continued onto the next line - however, you
can use the '+' operator to concatenate two character strings on separate lines.
H2164: Variable '%s' is declared but never used in '%s' ( see page 499) You have declared a variable in a procedure, but you never actually use it. -H
W1036: Variable '%s' might not have been initialized ( see page 499) This warning is given if a variable has not been assigned a value on every code
path leading to a point where it is used.
E2157: Element 0 inaccessible - use 'Length' or 'SetLength' ( see page 501) The Delphi String type does not store the length of the string in element 0. The
old method of changing, or getting, the length of a string by accessing element 0
does not work with long strings.
E2255: New not supported for dynamic arrays - use SetLength ( see page 502) The program has attempted to use the standard procedure NEW on a dynamic
array. The proper method for allocating dynamic arrays is to use the standard
procedure SetLength.
E2212: Package unit '%s' cannot appear in contains or uses clauses ( see The unit named in the error is a package unit and as such cannot be included in
page 502) your project. A possible cause of this error is that somehow a Delphi unit and a
package unit have been given the same name. The compiler is finding the
package unit on its search path before it can locate a same-named Delphi file.
3 Packages cannot be included in a project by inclusion of the package unit in the
uses clause.
F2063: Could not compile used unit '%s' ( see page 502) This fatal error is given when a unit used by another could not be compiled. In
this case, the compiler gives up compilation of the dependent unit because it is
likely very many errors will be encountered as a consequence.
E2090: User break - compilation aborted ( see page 502) This message is currently unused.
E2165: Compile terminated by user ( see page 502) You pressed Ctrl-Break during a compile.
E2142: Inaccessible value ( see page 502) You have tried to view a value that is not accessible from within the integrated
debugger. Certain types of values, such as a 0 length Variant-type string, cannot
be viewed within the debugger.
334
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
H2077: Value assigned to '%s' never used ( see page 503) The compiler gives this hint message if the value assigned to a variable is not
used. If optimization is enabled, the assignment is eliminated.
This can happen because either the variable is not used anymore, or because it
is reassigned before it is used.
E2088: Variable name expected ( see page 504) This error message is issued if you try to declare an absolute variable, but the
absolute directive is not followed by an integer constant or a variable name.
E2171: Variable '%s' inaccessible here due to optimization ( see page 504) The evaluator or watch statement is attempting to retrieve the value of <name>,
but the compiler was able to determine that the variables actual lifetime ended
prior to this inspection point. This error will often occur if the compiler determines
a local variable is assigned a value that is not used beyond a specific point in the
program's control flow.
E2033: Types of actual and formal var parameters must be identical ( see page For a variable parameter, the actual argument must be of the exact type of the
505) formal parameter.
E2277: Only external cdecl functions may use varargs ( see page 505) This message indicates that you are trying to implement a varargs routine. You
cannot implement varargs routines, you can only call external varargs.
F2051: Unit %s was compiled with a different version of %s.%s ( see page 505) This fatal error occurs when the declaration of symbol declared in the interface
part of a unit has changed, and the compiler cannot recompile a unit that relies
on this declaration because the source is not available to it.
There are several possible solutions - recompile Unit1 (assuming you have the
source code available), use an older version of Unit2 or change Unit2, or get a
new version of Unit1 from whoever has the source code.
This error can also occur when a unit in your project has the same name as a
standard Delphi unit.
For example, this may... more ( see page 505)
E2379: Virtual methods not allowed in record types ( see page 506) No further information is available for this error or warning.
E2423: Void type not usable in this context ( see page 506) The System type Void is not allowed to be used in some contexts. As an
example, the following code demostrates the contexts where type Void may not
be used.
E2221: $WEAKPACKAGEUNIT '%s' cannot have initialization or finalization code A unit which has been flagged with the $weakpackageunit directive cannot
( see page 506) contain initialization or finalization code, nor can it contain global data. The
reason for this is that multiple copies of the same weakly packaged units can
appear in an application, and then referring to the data for that unit becomes and
ambiguous proposition. This ambiguity is furthered when dynamically loaded
packages are used in your applications.
E2203: $WEAKPACKAGEUNIT '%s' contains global data ( see page 507) A unit which was marked with $WEAKPACKAGEUNIT is being placed into a
package, but it contains global data. It is not legal for such a unit to contain global
data or initialization or finalization code.
The only solutions to this problem are to remove the $WEAKPACKAGEUNIT
mark, or remove the global data from the unit before it is put into the package.
W1050: WideChar reduced to byte char in set expressions ( see page 507) "Set of char" in Win32 defines a set over the entire range of the Char type. Since
Char is a byte-sized type in Win32, this defines a set of maximum size containing
256 elements. In .NET, Char is a word-sized type, and this range (0..65535)
exceeds the capacity of the set type.
To accomodate existing code that uses this "Set of Char" syntax, the compiler
will treat the expression as "set of AnsiChar". The warning message reminds you
that the set can only store the boolean state of 256 distinct elements, not the full
range of the Char type.
E2152: Wrong or corrupted version of RLINK32.DLL ( see page 507) The internal consistency check performed on the RLINK32.DLL file has failed.
Contact CodeGear if you encounter this error.
E2015: Operator not applicable to this operand type ( see page 507) This error message is given whenever an operator cannot be applied to the
operands it was given - for instance if a boolean operator is applied to a pointer.
W1206: XML comment on '%s' has cref attribute '%s' that could not be resolved This warning message occurs when the XML has a cref attribute that cannot be
( see page 508) resolved.
This is a warning in XML documentation processing. The XML is well formed, but
the comment's meaning is questionable. XML cref references follow the .NET
style. See http://msdn2.microsoft.com/en-us/library/acd0tfbe.aspx for more
details. A documentation warning does not prevent building.
W1205: XML comment on '%s' has badly formed XML--'The character '%c' was
expected.' ( see page 508)
This warning message occurs when the expected character was not found in the
XML.
3
This is an error in XML documentation processing. The XML is not well formed.
This is a warning because a documentation error does not prevent building.
W1204: XML comment on '%s' has badly formed XML--'A name contained an This warning message occurs when a name in XML contains an invalid character.
invalid character.' ( see page 508) This is an error in XML documentation processing. The XML is not well formed.
This is a warning because a documentation error does not prevent building.
W1203: XML comment on '%s' has badly formed XML--'A name was started with This warning message occurs when an XML name was started with an invalid
an invalid character.' ( see page 508) character.
This is an error in XML documentation processing. The XML is not well formed.
This is a warning because a documentation error does not prevent building.
335
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
W1208: Parameter '%s' has no matching param tag in the XML comment for '%s' This warning message occurs when an XML Parameter has no matching param
(but other parameters do) ( see page 508) tag in the XML comment but other parameters do.
This is a warning in XML documentation processing. There is at least one tag,
but some parameters in the method don't have a tag. A documentation warning
does not prevent building.
W1207: XML comment on '%s' has a param tag for '%s', but there is no This warning message occurs when the XML contains a parameter tag for a
parameter by that name ( see page 508) nonexistent parameter.
This is a warning in XML documentation processing. The XML is well formed,
however, a tag was created for a parameter that doesn't exist in a method. A
documentation warning does not prevent building.
W1202: XML comment on '%s' has badly formed XML--'Reference to undefined This warning message occurs when XML references an undefined entity.
entity '%s'' ( see page 509) This is an error in XML documentation processing. The XML is not well formed.
This is a warning because a documentation error does not prevent building.
W1201: XML comment on '%s' has badly formed XML--'Whitespace is not This warning message occurs when the compiler encounters white space in a
allowed at this location.' ( see page 509) location in which white space is not allowed.
This is an error in XML documentation processing. The XML is not well formed.
This is a warning because a documentation error does not prevent building.
W1013: Constant 0 converted to NIL ( see page 509) The Delphi compiler now allows the constant 0 to be used in pointer expressions
in place of NIL. This change was made to allow older code to still compile with
changes which were made in the low-level RTL.
threadvar
secretNum : integer absolute $151;
begin
end.
The absolute directive is not allowed in a threadvar declaration section.
program Solve;
threadvar
secretNum : integer;
var
sNum : integer absolute $151;
begin
end.
There are two easy ways to solve a problem of this nature. The first is to remove the absolute directive from the threadvar
section. The second would be to move the absolute variable to a normal var declaration section.
3
3.1.2.1.3 E2249: Cannot use absolute variables when compiling to byte code
The use of absolute variables is prohibited when compiling to byte code.
336
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
Final is a restrictive modifier used to prevent extension of a class (or prevent overrides on methods), while the abstract modifier
signals the intention to use a class as a base class.
type
Base = class
procedure Foundation; virtual; abstract;
end;
procedure Base.Foundation;
begin
end;
begin
end.
Abstract methods cannot be defined. An error will appear at the point of Base.Foundation when you compile this program.
program Solve;
type
Base = class
procedure Foundation; virtual; abstract;
end;
procedure Derived.Foundation;
begin
end;
begin
end.
Two steps are required to solve this error. First, you must remove the definition of the abstract procedure which is declared in the
base class. Second, you must extend the base class, declare the abstract procedure as an 'override' in the extension, and then
provide a definition for the newly declared procedure.
type
Base = class
procedure DaliVision; abstract;
procedure TellyVision; abstract;
end;
337
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end.
The declaration above is in error because abstract methods must either be virtual or dynamic.
program Solve;
type
Base = class
procedure DaliVision; virtual; abstract;
procedure TellyVision; dynamic; abstract;
end;
begin
end.
It is possible to remove this error by either specifying 'virtual' or 'dynamic', whichever is most appropriate for your application.
The sealed modifier is used to prevent inheritance of a class, while the abstract modifier signals the intention to use a class as a
base class.
3.1.2.1.9 E2247: Cannot take the address when compiling to byte code
The address-of operator, @, cannot be used when compiling to byte code.
begin
f0(1);
end.
In this example, the default parameter that exists in one of the versions of f0 makes it impossible for the compiler to determine
which procedure should actually be called.
3
program Solve;
338
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
f0(1);
end.
The approach taken in this example was to remove the default parameter value. The result here is that the procedure taking only
one integer parameter will be called. It should be noted that this approach is the only way that the single-parameter function can
be called.
Check your computations to ensure that the value can be represented by the computer hardware.
3.1.2.1.13 E2308: Need to specify at least one dimension for NEW of dynamic
array
No further information is available for this error or warning.
var
arr : array of integer;
begin
SetLength(arr);
end.
The SetLength in the above example causes an error since no array dimensions have been specified.
program solve;
var
arr : array of integer;
3
begin
SetLength(arr, 151);
end.
To remove this error from your program, specify the number of elements you want the array to contain.
339
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
If the purpose is to leave the loop prematurely, use a break or goto statement.
program Produce;
var
I: Integer;
A: array [0..99] of Integer;
begin
for I := 0 to 99 do begin
if A[I] = 42 then
I := 99;
end;
end.
In this case, the programmer thought that assigning 99 to I would cause the program to exit the loop.
program Solve;
var
I: Integer;
A: array [0..99] of Integer;
begin
for I := 0 to 99 do begin
if A[I] = 42 then
Break;
end;
end.
Using a break statement is a cleaner way to exit out of a for loop.
procedure AssemblerExample;
asm
3 mov al, $0f0 * 16
end;
begin
end.
The inline assembler is not capable of storing the result of $f0 * 16 into the 'al' register—it simply won't fit.
program Solve;
procedure AssemblerExample;
asm
340
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
end.
Make sure that the type of both operands are compatible.
begin
end.
The inline assembler is not capable of performing a MOD operation on a Delphi variable, thus the above code will cause an
error.
Many of the inline assembler expressions require constants to assemble correctly. Change the offending statement to have a
assemble-time constant.
procedure AssemblerExample;
asm
dw 1000 / 0
end;
begin
end.
If you are using program constants instead of constant literals, this error might not be quite so obvious.
program Solve;
procedure AssemblerExample;
asm
dw 1000 / 10
end;
begin
end.
3
The solution, as when programming in high-level languages, is to make sure that you don't divide by zero.
341
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
program Produce;
type
Data = record
x : Integer;
end;
begin
end.
In this example, the inline assembler has recognized that 'y' is a valid identifier, but it has not found 'y' to be a member of the
type of 'd'.
program Solve;
type
Data = record
x : Integer;
end;
begin
end.
By specifying the proper variable name, the error will go away.
procedure AssemblerExample;
asm
mov al, $z0f0
end;
begin
3 end.
In the example above, the inline assembler was expecting to parse a hexadecimal constant, but it found an erroneous character.
program Solve;
procedure AssemblerExample;
asm
mov al, $f0
end;
342
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
end.
Make sure that the numeric constants you enter conform to the type that the inline assembler is expecting to parse.
var
v : Integer;
procedure Assembly;
asm
db offset v
end;
begin
end.
In the sample above, the compiler will complain because the 'offset' operator produces a 'dword', but the operator is expecting a
'byte'.
program Solve;
var
v : Integer;
procedure Assembly;
asm
dd offset v
end;
begin
end.
The solution, for this example, is to change the operator to receive a 'dword'. In the general case, you will need to closely
examine your code and ensure that the operator and operand sizes match.
procedure AssemblerExample;
asm
mov eax, $0ffffffffffffffffffffff
end;
begin
end. 3
Specifying a number which requires more than 32 bits to represent will elicit this error.
program Solve;
procedure AssemblerExample;
asm
mov al, $0ff
end;
343
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end.
Make sure that your numbers all fit in 32 bits.
procedure AssemblerExample;
asm
mov eax, [ecx + esp * 4]
end;
begin
end.
The right operand specified in this mov instruction is illegal.
program Solve;
procedure AssemblerExample;
asm
mov eax, [ecx + ebx * 4]
end;
begin
end.
The addressing mode specified by the right operand of this mov instruction is allowed.
var
a : array [1..10] of Integer;
endOfA : Integer;
procedure Relocatable;
begin
end;
procedure Assembly;
asm
mov eax, a + endOfA
end;
3 begin
end.
Global variables fall into the class of items which produce relocatable addresses, and the inline assembler is unable to add or
subtract these.
Make sure you don't try to add or subtract relocatable addresses from within your inline assembler statements.
344
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
procedure AssemblerExample;
asm
db 'Hello world. I am an inline assembler statement
end;
begin
end.
The inline assembler is unable to find the end of the string, before the end of the line, so it reports that the string is too long.
program Solve;
procedure AssemblerExample;
asm
db 'Hello world. I am an inline assembler statement'
end;
begin
end.
Adding the closing quote will vanquish this error.
procedure Assembly;
asm
adx eax, 151
end;
begin
end.
program Solve;
procedure Assembly;
asm
add eax, 151 3
end;
begin
end.
Examine the offending inline assembly statement and ensure that it conforms to the proper syntax.
345
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
3.1.2.1.34 x1028: Bad global symbol definition: '%s' in object file '%s'
This warning is given when an object file linked in with a $L or $LINK directive contains a definition for a symbol that was not
declared in Delphi as an external procedure, but as something else (e.g. a variable).
var
B : Base;
V : Variant;
346
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
V.Dispatch(B);
end.
A class cannot be converted into a Variant type, so it is not allowed in an OLE call.
program Solve;
type
Base = class
x : Integer;
end;
var
B : Base;
V : Variant;
begin
V.Dispatch(B.i);
end.
The only solution to this problem is to manually convert these data types to Variants or to only use data types that can
automatically be converted into a Variant.
type
TitleArr = array [0..24] of char;
NamePlate = class
private
titleStr : TitleArr;
published
property Title : TitleArr read titleStr write titleStr;
end;
begin
end.
An error is induced because an array is not one of the data types which can be published.
(*$TYPEINFO ON*)
program Solve;
type
TitleArr = integer;
NamePlate = class
titleStr : TitleArr; 3
published
property Title : TitleArr read titleStr write titleStr;
end;
begin
end.
Moving the property declaration out of the published section will avoid this error. Another alternative, as in this example, is to
change the type of the property to be something that can actually be published.
347
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
Check the type of the variable and make sure you are not missing a dereferencing, indexing or field selection operator.
program Produce;
type
TColor = (red,green,blue);
var
Color : TColor;
begin
Readln(Color); (*<-- Error message here*)
end.
We cannot read variables of enumerated types directly.
program Solve;
type
TColor = (red,green,blue);
var
Color : TColor;
InputString: string;
const
ColorString : array [TColor] of string = ('red', 'green', 'blue');
begin
Readln(InputString);
Color := red;
while (color < blue) and (ColorString[color] <> InputString) do
Inc(color);
end.
The solution is to read a string, and look up that string in an auxiliary table. In the example above, we didn't bother to do error
checking - any string will be treated as 'blue'. In practice, we would probably output an error message and ask the user to try
again.
348
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
Make sure there are no conflicts in your library search path which can point to another System.dcu. Try reinstalling System.dcu.
If neither of these solutions work, contact CodeGear Developer Support.
type
Fruit = (apple, orange, pear);
Data = record
x : Integer;
ch : Char;
end;
var
f : Fruit;
d : Data;
begin
Examiner([d]);
Examiner([f]);
end.
Both calls to Examiner will fail because enumerations and records are not supported in array constructors.
program Solve;
var
i : Integer;
r : Real;
v : Variant;
349
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
On Windows, Delphi supports COM and SOAP interfaces and can call types that these interfaces can marshall.
interface
3 procedure MyProc;
begin (*<-- Error message here*)
end;
implementation
begin
end.
We got carried away and gave MyProc a body right in the interface section.
unit Solve;
350
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
interface
procedure MyProc;
implementation
procedure MyProc;
begin
end;
begin
end.
We need move the body to the implementation section - then it's fine.
procedure Error;
var i : Integer;
begin
i := 0;
while i < 100 do
INC(i);
if odd(i) then begin
INC(i);
continue;
end;
end;
begin 3
end.
The example above shows how a continue statement could seem to be included in the body of a looping construct but, due to
the compound-statement nature of The Delphi language, it really is not.
program Solve;
procedure Error;
var i : Integer;
begin
351
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
i := 0;
while i < 100 do begin
INC(i);
if odd(i) then begin
INC(i);
continue;
end;
end;
end;
begin
end.
Often times it is a simple matter to create compound statement out of the looping construct to ensure that your CONTINUE or
BREAK statements are included.
3.1.2.1.51 E2327: Linker error while emitting attribute '%s' for '%s'
No further information is available for this error or warning.
3 3.1.2.1.55 E2314: Attribute - The MarshalAs attribute has fields set that are not
valid for the specified unmanaged type
No further information is available for this error or warning.
352
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
353
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
var
V: Variant = 0;
begin
end.
The example tries to declare an initialized variable of type Variant, which illegal.
program Solve;
var
V: Variant;
begin
V := 0;
end.
The solution is to initialize a normal variable with an assignment statement.
3
3.1.2.1.71 E2217: Published field '%s' not a class or interface type
An attempt has been made to publish a field in a class which is not a class nor interface type.
program Produce;
type
TBaseClass = class
published
x : Integer;
354
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end;
begin
end.
The program above generates an error because x is included in a published section, despite the fact that it is not of a type which
can be published.
program Solve;
type
TBaseClass = class
Fx : Integer;
published
property X : Integer read Fx write Fx;
end;
begin
end.
To solve this problem, all fields which are not class nor interface types must be removed from the published section of a class. If
it is a requirement that the field actually be published, then it can be accomplished by changing the field into a property, as was
done in this example.
The local directive, which marks routines as unavailable for export, is platform-specific and has no effect in Windows
programming.
On Linux, the local directive is used for routines that are compiled into a library but are not exported. This directive can be
specified for standalone procedures and functions, but not for methods. A routine declared with local, for example,
function Contraband(I: Integer): Integer; local;
does not refresh the EBX register and hence
355
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
If the given property's accessors are methods, name collisions prevent the compiler from producing a CLS conforming name, but
does not prevent the property from being usable.
However, if a name conflict prevents the compiler from generating an accessor method for a field accessor, the property is not
usable and you will receive this error.
procedure A0;
begin
try
(* try something that might fail *)
finally
break;
end;
end;
begin
end.
The program above attempts to exit the finally clause with a break statement. It is not legal to exit a FINALLY clause in this
manner.
program Solve;
procedure A0;
begin
try
(* try something that might fail *)
finally
end;
end;
begin
end.
The only solution to this error is to restructure your code so that the offending statement does not appear in the FINALLY clause.
var
TatesCompass : FourPoints;
begin
TatesCompass := e;
356
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
case TatesCompass OF
n: Writeln('North');
e: Writeln('East');
s: Writeln('West');
w: Writeln('South');
ne: Writeln('Northeast');
se: Writeln('Southeast');
sw: Writeln('Southwest');
nw: Writeln('Northwest');
end;
end.
It is not possible for a TatesCompass to hold all the values of the CompassPoints, and so several of the case labels will elicit
errors.
program Solve;
(*$WARNINGS ON*)
type
CompassPoints = (n, e, s, w, ne, se, sw, nw);
FourPoints = n..w;
var
TatesCompass : CompassPoints;
begin
TatesCompass := e;
case TatesCompass OF
n: Writeln('North');
e: Writeln('East');
s: Writeln('West');
w: Writeln('South');
ne: Writeln('Northeast');
se: Writeln('Southeast');
sw: Writeln('Southwest');
nw: Writeln('Northwest');
end;
end.
After examining your code to determine what the intention was, there are two alternatives. The first is to change the type of the
case statement's control variable so that it can produce all the case labels. The second alternative would be to remove any case
labels that cannot be produced by the control variable. The first alternative is shown in this example.
3.1.2.1.77 E2326: Attribute '%s' can only be used once per target
This attribute can only be used once per target Attributes and their descendants may be declared with an AttributeUsage
Attribute which describes how a custom Attribute may be used. If the use of an attribute violates AttributeUsage.allowmultiple
then this error will be raised.
357
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
3.1.2.1.82 E2343: Metadata - Primary key column may not allow the null value
No further information is available for this error or warning.
3.1.2.1.84 E2342: Metadata - Too many RID or primary key columns, 1 is max
No further information is available for this error or warning.
3.1.2.1.89 E2339: Metadata - The importing scope is not compatible with the
3 emitting scope
No further information is available for this error or warning.
358
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
3.1.2.1.91 E2337: Metadata - There isn't .CLB data in the memory or stream
No further information is available for this error or warning.
As the compiler has to translate the interface part of a unit before any other unit can use it, the compiler must be able to find a
compilation order for the interface parts of the units.
Check whether all the units in the uses clauses are really necessary, and whether some can be moved to the implementation
part of a unit instead.
unit A;
interface
uses B; (*A uses B, and B uses A*)
implementation
end.
3
unit B;
interface
uses A;
implementation
end.
The problem is caused because A and B use each other in their interface sections.
unit A;
interface
359
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
unit B;
interface
implementation
uses A; (*Moved to the implementation part*)
end.
You can break the cycle by moving one or more uses to the implementation part.
3.1.2.1.101 E2060: Class and interface types only allowed in type section
Class or interface types must always be declared with an explicit type declaration in a type section. Unlike record types, they
cannot be anonymous.
The main reason for this is that there would be no way you could declare the methods of that type (since there is no type name).
var
MyClass : class
Field: Integer;
end;
begin
end.
Correct:
3 program Solve;
type
TMyClass = class
Field: Integer;
end;
var
MyClass : TMyClass;
begin
360
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end.
type
CharDesc = class
vch : Char;
property Ch : Char;
end;
end.
The first declaration of a property must specify a read and write clause, and since both are missing on the 'Ch' property, an error
will result when compiling. In the case of properties, the original intention might have been to hoist a property defined in a base
class to another visibility level - for example, from public to private. In this case, the most probable cause of the error is that the
property name was not found in the base class. Make sure that you have spelled the property name correctly and that it is
actually contained in one of the parent classes.
program Produce;
type
CharDesc = class
vch : Char;
361
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
specifications. One example of this is case-sensitive versus case-insensitive identifiers. Another example is having a property in
a class with the same name as a method or field in the same class. This error message indicates that same-named symbols
were found in the same scope (members of the same class or interface) in an imported assembly and that only one of them will
be accessible from Delphi syntax.
3.1.2.1.107 H2384: CLS: overriding virtual method '%s.%s' visibility (%s) must
match base class '%s' (%s)
No further information is available for this error or warning.
• Primitive types that the compiler recognizes, such as arrays, sets or strings
• Types that implement IEnumerable
• Types that implement the GetEnumerator pattern as documented in the Delphi Language Guide
Ensure that the specified type meets these requirements.
See Also
Declarations and Statements ( see page 705)
To see why this is necessary, consider two operands, an Integer with the value -128 and a Cardinal with the value 130. The
Cardinal type has one more digit of precision than the Integer type, and thus comparing the two values cannot accurately be
performed in only 32 bits. The proper solution for the compiler is to promote both these types to a larger, common, size and then
to perform the comparison.
The compiler will only produce this warning when the size is extended beyond what would normally be used for calculating the
result.
{$APPTYPE CONSOLE}
program Produce;
var
i : Integer;
c : Cardinal;
3 begin
i := -128;
c := 130;
WriteLn(i + c);
end.
In the example above, the compiler warns that the expression will be calculated at 64 bits rather than the supposed 32 bits.
362
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
This error can also occur when two units both declare a type of the same name. When a procedure from an imported unit has a
parameter of the same-named type, and a variable of the same-named type is passed to that procedure, the error could occur.
unit unit1;
interface
type
ExportedType = (alpha, beta, gamma);
implementation
begin
end.
unit unit2;
interface
type
ExportedType = (alpha, beta, gamma);
implementation
procedure ExportedProcedure(v : ExportedType);
begin
end;
begin
end.
program Produce;
uses unit1, unit2;
var
A: array [0..9] of char;
I: Integer;
V : ExportedType;
begin
ExportedProcedure(v);
I:= Hi(A);
end.
The standard function Hi expects an argument of type Integer or Word, but we supplied an array instead. In the call to
ExportedProcedure, V actually is of type unit1.ExportedType since unit1 is imported prior to unit2, so an error will occur.
unit unit1;
interface
type
ExportedType = (alpha, beta, gamma);
3
implementation
begin
end.
unit unit2;
interface
type
ExportedType = (alpha, beta, gamma);
363
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
implementation
procedure ExportedProcedure(v : ExportedType);
begin
end;
begin
end.
program Solve;
uses unit1, unit2;
var
A: array [0..9] of char;
I: Integer;
V : unit2.ExportedType;
begin
ExportedProcedure(v);
I:= High(A);
end.
We really meant to use the standard function High, not Hi. For the ExportedProcedure call, there are two alternative solutions.
First, you could alter the order of the uses clause, but it could also cause similar errors to occur. A more robust solution is to fully
qualify the type name with the unit which declared the desired type, as has been done with the declaration for V above.
type
ProcedureParm0 = procedure; stdcall;
ProcedureParm1 = procedure(VAR x : Integer);
begin
TakesParm0(WrongConvention);
TakesParm1(WrongParms);
end.
3
The call of 'TakesParm0' will elicit an error because the type 'ProcedureParm0' expects a 'stdcall' procedure, whereas
'WrongConvention' is declared with the 'register' calling convention. Similarly, the call of 'TakesParm1' will fail because the
parameter lists do not match.
program Solve;
type
ProcedureParm0 = procedure; stdcall;
ProcedureParm1 = procedure(VAR x : Integer);
364
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
TakesParm0(RightConvention);
TakesParm1(RightParms);
end.
The solution to both of these problems is to ensure that the calling convention or the parameter lists matches the declaration.
begin
Proc( 22 / 7 ); (*Result of / operator is Real*)
end.
Here a C++ programmer thought the division operator / would give him an integral result - not the case in Delphi.
program Solve;
begin
Proc( 22 div 7 ); (*The div operator gives result type Integer*)
end.
The solution in this case is to use the integral division operator div - in general, you have to look at your program very careful to
decide how to resolve type incompatibilities.
3
3.1.2.1.113 W1023: Comparing signed and unsigned types - widened both
operands
To compare signed and unsigned types correctly the compiler must promote both operands to the next larger size data type.
To see why this is necessary, consider two operands, a Shortint with the value -128 and a Byte with the value 130. The Byte
type has one more digit of precision than the Shortint type, and thus comparing the two values cannot accurately be performed in
only 8 bits. The proper solution for the compiler is to promote both these types to a larger, common, size and then to perform the
365
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
comparison.
program Produce;
var
s : shortint;
b : byte;
begin
s := -128;
b := 130;
In versions of the Delphi compiler prior to 12.0, the hexadecimal constant $80000000 would have been a negative Integer value,
but with the introduction of the int64 type, this same constant now becomes a positive int64 type. As a result, comparisons of this
constant against Integer variables will no longer behave as they once did.
As this is a warning rather than an error, there is no standard method of addressing the problems: sometimes the warning can be
ignored, sometimes the code must be rewritten.
program Produce;
var
i : Integer;
c : Cardinal;
begin
c := 0;
i := 0;
if c < 0 then
WriteLn('false');
In versions of the CodeGear Pascal compiler prior to 12.0, the hexadecimal constant $80000000 would have been a negative
3
Integer value, but with the introduction of the int64 type, this same constant now becomes a positive int64 type. As a result,
comparisons of this constant against Integer variables will no longer behave as they once did.
As this is a warning rather than an error, there is no standard method of addressing the problems: sometimes the warning can be
ignored, sometimes the code must be rewritten.
program Produce;
var
i : Integer;
366
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
c : Cardinal;
begin
c := 0;
i := 0;
if c >= 0 then
WriteLn('true');
367
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
type
Base = class
automated
constructor HardHatBob;
destructor DemolitionBob;
end;
constructor Base.HardHatBob;
begin
end;
3 destructor Base.DemolitionBob;
begin
end;
begin
end.
It is not possible to declare a class constructor or destruction in an OLE automation section. The constructor and destructor
declarations in the above code will both elicit this error.
368
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
program Solve;
type
Base = class
constructor HardHatBob;
destructor DemolitionBob;
end;
constructor Base.HardHatBob;
begin
end;
destructor Base.DemolitionBob;
begin
end;
begin
end.
The only solution to this error is to move your declarations out of the automated section, as has been done in this example.
type
Base = class
procedure Abstraction; virtual; abstract;
end;
var
b : Base;
begin
b := Base.Create;
end.
An abstract procedure does not exist, so it becomes dangerous to create instances of a class which contains abstract
procedures. In this case, the creation of 'b' is the cause of the warning. Any invocation of 'Abstraction' through the instance of 'b'
created here would cause a runtime error. A hint will be issued that the value assigned to 'b' is never used.
program Solve;
(*$WARNINGS ON*)
(*$HINTS ON*)
type
Base = class
procedure Abstraction; virtual;
end;
3
var
b : Base;
procedure Base.Abstraction;
begin
end;
begin
b := Base.Create;
369
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
end.
One solution to this problem is to remove the abstract directive from the procedure declaration, as is shown here. Another
method of approaching the problem would be to derive a class from Base and then provide a concrete version of Abstraction. A
hint will be issued that the value assigned to 'b' is never used.
Note: A constructor can initialize fields from its own class, prior to calling the inherited constructor.
Example:
3 The class,
X=class
constructor Create;
end;
requires an inherited constructor in its Create method:
constructor X.Create;
begin
inherited Create;
370
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end;
Note: A constructor can initialize fields from its own class, prior to calling the inherited constructor.
Note: A constructor can initialize fields from its own class, prior to calling the inherited constructor.
Note: A constructor can initialize fields from its own class, prior to calling the inherited constructor.
371
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end.
The procedure definitions shown above will cause this error since it declares two parameters with a default value.
program Solve;
begin
end.
Depending on the desired result, there are different ways of approaching this problem. If only the last parameter is supposed to
have the default value, then take the approach shown in the first example. If both parameters are supposed to have default
values, then take the approach shown in the second example.
3.1.2.1.135 E2237: Parameter '%s' not allowed here due to default value
When using default parameters a list of parameters followed by a type is not allowed; you must specify each variable and its
default value individually.
program Produce;
begin
end.
The procedure definitions shown above will cause this error since it declares two parameters with a default value.
program Solve;
372
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
type
Base = class
function GetV : Char;
procedure SetV(x : Char);
begin
end.
When specifying a default property, you must make sure that it conforms to the array property syntax. The 'Data' property in the
above code specifies a 'Char' type rather than an array.
program Solve;
type
Base = class
function GetV(i : Integer) : Char;
procedure SetV(i : Integer; const x : Char);
begin
end.
By changing the specification of the offending property to an array, or by removing the 'default' directive, you can remove this
error.
3
3.1.2.1.137 E2268: Parameters of this type cannot have default values
The default parameter mechanism incorporated into the Delphi compiler allows only simple types to be initialized in this manner.
You have attempted to use a type that is not supported.
program Produce;
type
ArrayType = array [0..1] of integer;
373
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
end.
The only way to eliminate this error is to remove the offending parameter assignment or to change the type of the parameter to
one that can be initialized with a default value.
begin
end.
Since the parameter x is passed by reference in this example, it cannot be given a default value.
program Solve;
begin
end.
In this solution, the by-reference parameter has been changed into a const parameter. Alternatively it could have been changed
into a by-value parameter or the default value could have been removed.
3 type
Base = class
function GetV(i : Integer) : Char;
procedure SetV(i : Integer; const x : Char);
374
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end;
begin
end.
The Access property in the code above attempts to become the default property of the class, but Data has already been
specified as the default. There can be only one default property in a class.
program Solve;
type
Base = class
function GetV(i : Integer) : Char;
procedure SetV(i : Integer; const x : Char);
begin
end.
The solution is to remove the incorrect default property specifications from the program source.
3.1.2.1.140 E2146: Default values must be of ordinal, pointer or small set type
You have declared a property containing a default clause, but the type property type is incompatible with default values.
program Produce;
type
VisualGauge = class
pos : Single;
property Position : Single read pos write pos default 0.0;
end;
begin
end.
The program above creates a property and attempts to assign a default value to it, but since the type of the property does not
allow default values, an error is output.
program Produce;
type 3
VisualGauge = class
pos : Integer;
property Position : Integer read pos write pos default 0;
end;
begin
end.
When this error is encountered, there are two easy solutions: the first is to remove the default value definition, and the second is
375
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
to change the type of the property to one which allows a default value. Your program, however, may not be as simple to fix;
consider when you have a set property which is too large - it is this case which will require you to carefully examine your program
to determine the best solution to this problem.
3.1.2.1.145 F2446: Unit '%s' is compiled with unit '%s' in '%s' but different
version '%s' found
This error occurs if a unit must be recompiled to take in changes to another unit, but the source for the unit that needs
recompilation is not found.
Note: This error message may be experienced when using inline functions. Expansion of an inline function exposes its
implementation to all units that call the function. When a function is inline, modifications to that function must be reflected with a
recompile of every unit that uses that function. This is true even if all of the modifications occur in the implementation
section. This is one way in which inlining can make your units more interdependent, requiring greater effort to maintain binary
compatibility. This is of greatest importance to developers who distribute .dcu files without source code.
begin
end.
In this example, the compiler gives an error when it encounters the private directive, as it is not allowed in interface types.
program Solve;
type
IBaseIntf = interface
376
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
type
IBase = interface
end;
end;
begin
end.
In the example above, the error is caused because IExtend attempts to specify an ancestor interface type.
program Solve;
type
IBase = interface
end;
IExtend = dispinterface
['{00000000-0000-0000-0000-000000000000}']
end;
begin
end.
Generally there are two solutions when this error occurs: remove the ancestor interface declaration, or change the dispinterface
into a regular interface type. In the example above, the former approach was taken.
3
3.1.2.1.148 E2230: Methods of dispinterface types cannot specify directives
Methods declared in a dispinterface type cannot specify any calling convention directives.
program Produce;
type
IBase = dispinterface
377
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
['{00000000-0000-0000-0000-000000000000}']
procedure yamadama; register;
end;
begin
end.
The error in the example shown here is that the method 'yamadama' attempts to specify the register calling convention.
program Solve;
type
IBase = dispinterface
['{00000000-0000-0000-0000-000000000000}']
procedure yamadama;
end;
begin
end.
Since no dispinterface method can specify calling convention directives, the only solution to this problem is to remove the
offending directive, as shown in this example.
type
IBase = dispinterface
end;
begin
end.
In the example shown here, the dispinterface type does not include a GUID specification, and thus causes the compiler to emit
an error.
program Solve;
type
IBase = dispinterface
['{00000000-0000-0000-0000-000000000000}']
end;
begin
end.
Ensuring that each dispinterface has a GUID associated with it will cause this error to go away.
type
Base = class
v : integer;
procedure setV(x : integer);
function getV : integer;
property Value : integer read getV write setV dispid 151;
378
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end;
begin
end.
This program attempts to set the dispid for an OLE automation object, but the property has not been declared in an automated
section.
program Solve;
type
Base = class
v : integer;
procedure setV(x : integer);
function getV : integer;
automated
property Value : integer read getV write setV dispid 151;
end;
begin
end.
To solve the error, you can either remove the dispid clause from the property declaration, or move the property declaration into
an automated section.
type
T0 = dispinterface
['{15101510-1510-1510-1510-151015101510}']
function R : Integer;
property value : Integer label 'Key';
end;
begin 3
end.
Here an attempt is made to use a label attribute on a dispinterface property.
program Solve;
type
T0 = dispinterface
['{15101510-1510-1510-1510-151015101510}']
function R : Integer;
379
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end.
The only solution to this problem is to remove label attribute from the property definition.
type
PMyObject = ^TMyObject;
TMyObject = object
F: Integer;
constructor Init;
destructor Done;
end;
constructor TMyObject.Init;
begin
F := 42;
end;
destructor TMyObject.Done;
begin
end;
var
P: PMyObject;
begin
New(P, Init);
(*...*)
Dispose(P, Init); (*<-- Error message here*)
end.
In this example, we passed the constructor to Dispose by mistake.
program Solve;
type
PMyObject = ^TMyObject;
TMyObject = object
F: Integer;
constructor Init;
destructor Done;
end;
constructor TMyObject.Init;
begin
F := 42;
3 end;
destructor TMyObject.Done;
begin
end;
var
P: PMyObject;
begin
380
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
New(P, Init);
Dispose(P, Done);
end.
The solution is to either pass a destructor to Dispose, or to eliminate the second argument.
Check your constant expressions and respecify them so that a division by zero error will not occur.
begin
end.
program Solve;
type
VariantRecord = record
case Integer of
0: (IntField: Integer);
1: (RealField: Real);
end;
begin
end.
3
3.1.2.1.157 E2399: Namespace conflicts with unit name '%s'
No further information is available for this error or warning.
381
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
program Produce;
begin
Writeln( DigitCount(12345) );
end.
Here we did not pay attention and mentioned the case label 0 twice.
program Solve;
begin
Writeln( DigitCount(12345) );
end.
In general, the problem might not be so easy to spot when you have symbolic constants and ranges of case labels - you might
have to write down the real values of the constants to find out what is wrong.
382
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
implementation
constructor Base.ctor0(a, b, c : integer);
begin
end;
begin
end.
As can be seen in this example, the two constructors have the same signature and thus, when the file is compiled with one of the
-j options, will produce this warning.
unit Solve;
interface
type
Base = class
constructor ctor0(a, b, c : integer);
constructor ctor1(a, b, c : integer; dummy : integer = 0);
end;
implementation
constructor Base.ctor0(a, b, c : integer);
begin
end;
begin
end.
A simple method to solve this problem is to change the signature of one of constructors, for example, to add an extra parameter.
In the example above, a default parameter has been added to ctor1. This method of approaching this error has the benefit that
Delphi code using ctor1 does not need to be changed. C++ code, on the other hand, will have to specify the extra parameter to
allow the compiler to determine which constructor is desired.
type
Base = class
v : Integer;
procedure setV(x : Integer);
function getV : Integer;
automated
property Value : Integer read getV write setV dispid 151;
property SecondValue : Integer read getV write setV dispid 151; 3
end;
383
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end.
Each automated property's dispid must be unique, thus SecondValue is in error.
program Solve;
type
Base = class
v : Integer;
procedure setV(x : Integer);
function getV : Integer;
automated
property Value : Integer read getV write setV dispid 151;
property SecondValue : Integer read getV write setV dispid 152;
end;
begin
end.
Giving a unique dispid to SecondValue will remove the error.
3.1.2.1.161 E2301: Method '%s' with identical parameters and result type
already exists
Within a class, you cannot publish multiple overloaded methods with the same name. Maintenance of runtime type information
requires a unique name for each published member.
type
TSomeClass = class
published
function Func(P: Integer): Integer;
function Func(P: Boolean): Integer; // error
The only solution in this case is to remove one of the offending implements clauses.
384
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
To resolve this problem, you may wish to rename one of the symbols in the two units, alias one of the symbols to the other, or
change the unit names so that they do not contribute to the same namespace.
type
Base = class
procedure First(VAR x : Integer); message 151;
procedure Second(VAR x : Integer); message 151;
end;
begin
end.
The declaration of 'Second' attempts to reuse the same message index which is used by 'First'; this is illegal.
program Solve;
type
Base = class
procedure First(VAR x : Integer); message 151;
procedure Second(VAR x : Integer); message 152; (*change to unique index*)
end;
begin
385
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
end.
There are two straightforward solutions to this problem. First, if you really do not need to use the same message value, you can
change the message number to be unique. Alternatively, you could derive a new class from the base and override the behavior
of the message handler declared in the base class. Both options are shown in the above example.
type
t0 = class
procedure f0(a : integer); overload;
procedure f0(a : integer); overload;
end;
begin
end.
The error is produced here because there are two overloaded declarations for the same procedure.
program Solve;
type
t0 = class
procedure f0(a : integer); overload;
procedure f0(a : char); overload;
end;
begin
end.
There are different approaches to resolving this error. One approach is to remove the redundant declaration of the procedure.
Another approach, taken here, is to change the parameter type of the duplicate declarations so that it creates a unique version of
the overloaded procedure.
386
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end;
end.
In the example shown here, both overloaded p1 functions are contained in a published section, which is not allowed.
Further, since the $M+ state is used, the Extended class starts with published visibility, thus the error will also appear for this
class also.
(*$M+*)
(*$APPTYPE CONSOLE*)
program Solve;
type
Base = class
public
procedure p1(a : integer); overload;
published
procedure p1(a : boolean); overload;
end;
end.
The solution here is to ensure that no more than one member of a set of overloaded function appears in a published section. The
easiest way to achieve this is to change the visibility to public, protected or private; whichever is most appropriate.
387
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
type
Base = class
automated
procedure DynaMethod; dynamic;
procedure MessageMethod(VAR msg : Integer); message 151;
3 end;
procedure Base.DynaMethod;
begin
end;
procedure Base.MessageMethod;
begin
end;
begin
388
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end.
It is not possible to have a dynamic or message method declaration in an OLE automation section of a class. As such, the two
method declarations in the above program both produce errors.
program Solve;
type
Base = class
procedure DynaMethod; dynamic;
procedure MessageMethod(VAR msg : Integer); message 151;
end;
procedure Base.DynaMethod;
begin
end;
procedure Base.MessageMethod;
begin
end;
begin
end.
There are several ways to remove this error from your program. First, you could move any declaration which produces this error
out of the automated section, as has been done in this example. Alternatively, you could remove the dynamic or message
attributes of the method; of course, removing these attributes will not provide you with the desired behavior, but it will remove the
error.
begin
try
end;
end.
In the code above, the 'except' or 'finally' clause of the exception handling code is missing, so the compiler will issue an error.
3
program Solve;
begin
try
except
end;
end.
By adding the missing clause, the compiler will be able to complete the compilation of the code. In this case, the 'except' clause
will easily allow the program to finish.
389
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
procedure ExportedProcedure;
exports ExportedProcedure;
begin
end;
begin
end.
It is not allowed to have an EXPORTS clause anywhere but a global scope.
program Solve;
procedure ExportedProcedure;
begin
end;
exports ExportedProcedure;
begin
end.
The solution is to ensure that your EXPORTS clause is at a global scope and textually follows all procedures named in the
clause. As a general rule, EXPORTS clauses are best placed right before the source file's initialization code.
3
3.1.2.1.179 E2143: Expression has no value
You have attempted to assign the result of an expression, which did not produce a value, to a variable.
390
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
type
Base = class
procedure FirstMethod;
a : Integer;
end;
procedure Base.FirstMethod;
begin
end;
begin
end.
The declaration of 'a' after 'FirstMethod' will cause an error.
program Solve;
type
Base = class
a : Integer;
procedure FirstMethod;
end;
procedure Base.FirstMethod;
begin
end;
begin
end.
To solve this error, it is normally sufficient to move all field definitions before the first field or property declaration.
type
Base = class
automated
i : Integer;
391
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
end;
begin
end.
The declaration of 'i' in this class will cause the compile error.
program Solve;
type
Base = class
i : Integer;
automated
end;
begin
end.
Moving the declaration of 'i' out of the automated section will vanquish the error.
type
Base = class
Title : String;
begin
end.
Class procedures do not have an instance pointer, so they cannot access any methods or instance data of the class.
program Solve;
type
Base = class
Title : String;
begin
end.
The only solution to this error is to not access any member data or methods from within a class method.
392
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
program Produce;
type
IBaseIntf = interface
FVar : Integer;
property Value : Integer read FVar write FVar;
end;
begin
end.
The desire above is to have a property which has a value associated with it. However, as interfaces can have no fields, this idea
will not work.
program Solve;
IBaseIntf = interface
function Reader : Integer;
procedure Writer(a : Integer);
property Value : Integer read Reader write Writer;
end;
begin
end.
An elegant solution to the problem described above is to declare getter and setter procedures for the property. In this situation,
any class implementing the interface must provide a method which will be used to access the data of the class.
This should rarely happen. If it does, the most likely cause is a full or bad disk.
Most likely causes are a nonexistent directory or a write protected file or disk.
3
3.1.2.1.190 E2288: File name too long (exceeds %d characters)
A file path specified in the compiler options exceeds the compiler's file buffer length.
393
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
Check the spelling of the name and the relevant search path.
program Produce;
uses Borland.Vcl.SysUtilss; (*<-- Error message here*)
begin
end.
program Solve;
uses Borland.Vcl.SysUtils; (*Fixed typo*)
begin
end.
For a .dcuil file, failure to set the unit/library path for the compiler is a likely cause of this message. The only solution is to make
sure the named unit can be found along the library path.
Check the spelling of the referenced file name and the relevant search path.
This should never happen - if it does, the most likely cause is corrupt data.
This should never happen - if it does, the most likely cause is corrupt data.
begin
end.
In this example, the problem is that T is value parameter of type Text, which is a file type. Recall that whatever gets written to a
value parameter has no effect on the caller's copy of the variable - declaring a file as a value parameter therefore makes little
3 sense.
program Solve;
begin
394
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end.
Declaring the parameter as a var parameter solves the problem.
3.1.2.1.198 E2155: Type '%s' needs finalization - not allowed in file type
Certain types are treated specially by the compiler on an internal basis in that they must be correctly finalized to release any
resources that they might currently own. Because the compiler cannot determine what type is actually stored in a record's variant
section at runtime, it is not possible to guarantee that these special data types are correctly finalized.
program Produce;
type
Data = record
name : string;
end;
var
inFile : file of Data;
begin
end.
String is one of those data types which need finalization, and as such they cannot be stored in a File type.
program Solve;
type
Data = record
name : array [1..25] of Char;
end;
var
inFile : file of Data;
begin
end.
One simple solution, for the case of String, is to redeclare the type as an array of characters. For other cases which require
finalization, it becomes increasingly difficult to maintain a binary file structure with standard Pascal features, such as 'file of'. In
these situations, it is probably easier to write specialized file I/O routines. 3
3.1.2.1.199 E2154: Type '%s' needs finalization - not allowed in variant record
Certain types are treated specially by the compiler on an internal basis in that they must be correctly finalized to release any
resources that they might currently own. Because the compiler cannot determine what type is actually stored in a record's variant
section at runtime, it is not possible to guarantee that these special data types are correctly finalized.
program Produce;
395
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
type
Data = record
case kind:Char of
'A': (str : String);
end;
begin
end.
String is one of those types which requires special treatment by the compiler to correctly release the resources. As such, it is
illegal to have a String in a variant section.
program Solve;
type
Data = record
str : String;
end;
begin
end.
One solution to this error is to move all offending declarations out of the variant section. Another solution would be to use pointer
types (^String, for example) and manage the memory by yourself.
Make sure that the linked object module is a 32 bit object module.
You can only rely on the final value of a for loop control variable if the loop is left with a goto or exit statement.
The purpose of this restriction is to enable the compiler to generate efficient code for the for loop.
program Produce;
(*$WARNINGS ON*)
const
3 A : array [0..9] of Integer = (1,2,3,4,5,6,7,8,9,10);
begin
Writeln( Search(A,11) );
end.
In the example, the Result variable is used implicitly after the loop, but it is undefined if we did not find the value - hence the
warning.
program Solve;
(*$WARNINGS ON*)
396
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
const
A : array [0..9] of Integer = (1,2,3,4,5,6,7,8,9,10);
begin
Writeln( Search(A,11) );
end.
The solution is to assign the intended value to the control variable for the case where we don't exit the loop prematurely.
procedure p0;
var
i : Integer;
begin
for i := 0 to 1000 do
p1(i);
end;
begin
end.
In this example, the loop control variable, i, is passed to a procedure which receives a var parameter. This is the main cause of
the warning.
program Solve;
procedure p1(x : Integer);
begin
end;
procedure p0;
var
i : Integer;
begin
i := 0;
while i <= 1000 do 3
p1(i);
end;
begin
end.
The easiest way to approach this problem is to change the parameter into a by-value parameter. However, there may be a good
reason that it was a by-reference parameter in the begging, so you must be sure that this change of semantics in your program
397
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
does not affect other code. Another way to approach this problem is change the for loop into an equivalent while loop, as is done
in the above program.
3.1.2.1.203 E2032: For loop control variable must have ordinal type
The control variable of a for loop must have type Boolean, Char, WideChar, Integer, an enumerated type, or a subrange type.
program Produce;
var
x: Real;
begin (*Plot sine wave*)
for x := 0 to 2*pi/0.2 do (*<-- Error message here*)
Writeln( '*': Round((Sin(x*0.2) + 1)*20) + 1 );
end.
The example uses a variable of type Real as the for loop control variable, which is illegal.
program Solve;
var
x: Integer;
begin (*Plot sine wave*)
for x := 0 to Round(2*pi/0.2) do
Writeln( '*': Round((Sin(x*0.2) + 1)*20) + 1 );
end.
Instead, use the Integer ordinal type.
You may see this error if a FOR loop uses an Int64 or Variant control variable. This results from a limitation in the compiler which
you can work around by replacing the FOR loop with a WHILE loop.
3.1.2.1.204 x1019: For loop control variable must be simple local variable
This error message is given when the control variable of a for statement is not a simple variable (but a component of a record,
for instance), or if it is not local to the procedure containing the for statement.
For backward compatibility reasons, it is legal to use a global variable as the control variable - the compiler gives a warning in
this case. Note that using a local variable will also generate more efficient code.
program Produce;
var
I: Integer;
A: array [0..9] of Integer;
procedure Init;
begin
for I := Low(A) to High(a) do (*<-- Warning given here*)
A[I] := 0;
end;
begin
Init;
3 end.
program Solve;
var
A: array [0..9] of Integer;
procedure Init;
var
I: Integer;
begin
for I := Low(A) to High(a) do
A[I] := 0;
398
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end;
begin
Init;
end.
This error message also occurs when you try to override a virtual method, but the overriding method has a different parameter
list, calling convention etc.
program Produce;
type
MyClass = class
procedure Proc(Inx: Integer);
function Func: Integer;
procedure Load(const Name: string);
procedure Perform(Flag: Boolean);
constructor Create;
destructor Destroy(Msg: string); override; (*<-- Error message here*)
class function NewInstance: MyClass; override; (*<-- Error message here*)
end;
begin
end.
As you can see, there are a number of reasons for this error message to be issued.
3
program Solve;
type
MyClass = class
procedure Proc(Inx: Integer);
function Func: Integer;
procedure Load(const Name: string);
procedure Perform(Flag: Boolean);
constructor Create;
399
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end.
You need to carefully compare the 'previous declaration' with the one that causes the error to determine what is different
between the two.
Maybe the definition is really missing, or maybe its name is just misspelled.
Note that a declaration of a procedure or function in the interface section of a unit is equivalent to a forward declaration - you
have to supply the implementation (the body of the procedure or function) in the implementation section.
Similarly, the declaration of a method in a class or object type is equivalent to a forward declaration.
program Produce;
type
TMyClass = class
constructor Create;
end;
400
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
end.
The definition of Sum in the above example has an easy-to-spot typo.
program Solve;
type
TMyClass = class
constructor Create;
end;
constructor TMyClass.Create;
begin
end;
begin
end.
The solution: make sure the definitions of your procedures, functions and methods are all there, and spelled correctly.
begin
end.
Text here is ignored by Delphi 16-bit - Delphi 32-bit or Kylix gives a warning.
program Solve;
begin
end.
begin
goto 1;
try
1:
except
goto 2;
401
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
end;
2:
end.
Both GOTO statements in the above code are incorrect. It is not possible to jump into, or out of, exception handling blocks.
The ideal solution to this problem is to avoid using GOTO statements altogether, however, if that is not possible you will have to
perform more detailed analysis of the program to determine the correct course of action.
402
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
3.1.2.1.211 W1010: Method '%s' hides virtual method of base type '%s'
You have declared a method which has the same name as a virtual method in the base class. Your new method is not a virtual
method; it will hide access to the base's method of the same name.
program Produce;
type
Base = class
procedure VirtuMethod; virtual;
procedure VirtuMethod2; virtual;
end;
procedure Base.VirtuMethod;
begin
end;
procedure Base.VirtuMethod2;
begin
end;
procedure Derived.VirtuMethod;
begin
end;
procedure Derived.VirtuMethod2;
begin
end;
begin
end.
Both methods declared in the definition of Derived will hide the virtual functions of the same name declared in the base class.
program Solve;
type
Base = class
procedure VirtuMethod; virtual;
procedure VirtuMethod2; virtual;
end;
procedure Base.VirtuMethod;
begin
end; 3
procedure Base.VirtuMethod2;
begin
end;
procedure Derived.VirtuMethod;
begin
end;
procedure Derived.Virtu2Method;
403
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end;
begin
end.
There are three alternatives to take when solving this warning.
First, you could specify override to make the derived class' procedure also virtual, and thus allowing inherited calls to still
reference the original procedure.
Secondly, you could change the name of the procedure as it is declared in the derived class. Both methods are exhibited in this
example.
Finally, you could add the reintroduce directive to the procedure declaration to cause the warning to be silenced for that
particular method.
type
Base = class
v : integer;
end;
begin
end.
Derived.v overrides, and thus hides, Base.v; it will not be possible to access Base.v in any variable of type Derived without a
typecast.
(*$WARNINGS ON*)
program Solve;
type
Base = class
v : integer;
end;
404
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
Since long strings dynamically size themselves, no analog to the HIGH function can be used.
This error can be caused if you are porting a 16-bit application, in which case the only string type available was a short string. If
this is the case, you can turn off the long strings with the $H command line switch or the long-form directive $LONGSTRINGS.
If the HIGH was applied to a string parameter, but you still wish to use long strings, you could change the parameter type to
'openstring'.
program Produce;
var
i : Integer;
s : String;
begin
s := 'Hello Developers of the World';
i := HIGH(s);
end.
In the example above, the programmer attempted to apply the standard function HIGH to a long string variable. This cannot be
done.
(*$LONGSTRINGS OFF*)
program Solve;
var
i : Integer;
s : String;
begin
s := 'Hello Developers of the World';
i := HIGH(s);
end.
By disabling long string parameters, the application of HIGH to a string variable is now allowed.
type
I0 = interface (IUnknown)
procedure p0(var x : Integer); 3
end;
405
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end.
The example shown here declares the interface and class methods differently. While they are equivalent in Delphi, they are not
so in C++.
program Solve;
uses Windows;
type
I0 = interface (IUnknown)
procedure p0(var x : Integer);
end;
begin
end.
The easiest solution to this problem is to match the class-declared methods to be identical to the interface-declared methods.
The $WARN SYMBOL_DEPRECATED ON/OFF compiler directive turns on or off all warnings about the deprecated directive
on symbols in the current unit.
The $WARN SYMBOL_LIBRARY ON/OFF compiler directive turns on or off all warnings about the library directive on symbols
in the current unit.
406
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
The $WARN SYMBOL_PLATFORM ON/OFF compiler directive turns on or off all warnings about the platform directive on
symbols in the current unit.
407
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
This error message is caused most often by errors with string constants or comments.
program Produce;
begin
Writeln("Hello world!"); (*<-- Error messages here*)
end.
Here a programmer fell back to C++ habits and quoted a string with double quotes.
program Solve;
begin
Writeln('Hello world!'); (*Need single quotes in Delphi*)
end.
The solution is to use single quotes. In general, you need to delete the illegal character.
type
Base = class
v : integer;
procedure setV(x : integer);
function getV : integer;
automated
property Value : integer read getV write setV nodefault;
end;
begin
end.
Including a NODEFAULT clause on an automated property is not allowed.
program Solve;
type
Base = class
3 v : integer;
procedure setV(x : integer);
function getV : integer;
automated
property Value : integer read getV write setV;
end;
408
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
end.
Removing the offending clause will cause the error to go away. Alternatively, moving the property out of the automated section
will also make the error go away.
type
IBase = dispinterface
['{00000000-0000-0000-0000-000000000000}']
function Get : Integer;
begin
end.
program Solve;
type
IBase = dispinterface
['{00000000-0000-0000-0000-000000000000}']
function Get : Integer;
begin
end.
409
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end.
The solution to problems of this nature are to remove the offending directive. Of course, it is best to understand the desired
behavior and to implement it in some other fashion.
type
Base = class
function GetC : Char;
procedure SetC(c : Char);
automated
property Ch : Char read GetC write SetC dispid 151;
end;
begin
end.
Since the character type is not one allowed in the 'automated' section, the declaration of 'Ch' will produce an error when
compiled.
program Solve;
type
Base = class
function GetC : String;
procedure SetC(c : String);
automated
property Ch : String read GetC write SetC dispid 151;
end;
begin
end.
There are two solutions to this problem. The first is to move the offending declaration out of the 'automated' section. The second
is to change the offending type to one that is allowed in 'automated' sections.
410
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
type
Base = class
automated
procedure Automatic; virtual; dispid 151;
end;
procedure Base.Automatic;
begin
end;
procedure Derived.Automatic;
begin
end;
begin
end.
The overriding declaration of Base.Automatic, in Derived (Derived.Automatic) erroneously attempts to define another dispid for
the procedure.
program Solve;
type
Base = class
automated
procedure Automatic; virtual; dispid 151;
end;
procedure Base.Automatic;
begin
end;
procedure Derived.Automatic;
begin 3
end;
begin
end.
By removing the offending dispid clause, the program will now compile.
411
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
type
Base = class
procedure Dynamo(VAR x : Integer); message -151;
end;
begin
end.
The specification of -151 as the message index is illegal in the above example.
program Solve;
type
Base = class
procedure Dynamo(VAR x : Integer); message 151;
end;
begin
end.
Always make sure that your message index values are >= 1.
412
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
The only solution to this problem is to lower the imagebase address sufficiently so that the entire application will fit below the
2GB limit.
3.1.2.1.236 E2260: Implements clause not allowed together with index clause
You have tried to use an index clause with an implements clause. Index specifiers allow several properties to share the same
access method while representing different values. The implements directive allows you to delegate implementation of an
interface to a property in the implementing class but it cannot take an index specifier.
T0 = class(TInterfacedObject, I0)
function getter : I0; dynamic;
property p0 : I0 read getter implements I0;
end;
end.
As shown in the example here, it is an error to use the dynamic modifier on a getter for a property which has an implements
clause. 3
program Produce;
type
I0 = interface
end;
T0 = class(TInterfacedObject, I0)
function getter : I0;
property p0 : I0 read getter implements I0;
end;
413
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
end.
To remove this error from your programs, remove the offending dynamic or method declaration.
T0 = class(TInterfacedObject, I0)
procedure I0.i0p0 = proc0;
function getter : I0;
procedure proc0(a : char);
property p0 : I0 read getter implements I0;
end;
T0 = class(TInterfacedObject, I0)
function getter : I0;
procedure i0p0(a : char);
property p0 : I0 read getter implements I0;
end;
414
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
The only solution for this error is to correct the implements clause so that it refers to a class or interface type, or to remove the
offending clause altogether.
T0 = class(TInterfacedObject, I0)
function getter : I0; cdecl;
property p0 : I0 read getter implements I0; 3
end;
415
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
type
I0 = interface
end;
T0 = class(TInterfacedObject, I0)
function getter : I0;
property p0 : I0 read getter implements I0;
end;
416
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
program Solve;
type
IMyInterface = interface
end;
This message will help the programmer avoid violating the rule that a unit may not reside in more than one related package.
Ignoring the warning, will cause the unit to be put into the package. You could also explicitly list the named unit in the contains
clause of the package to accomplish the same result and avoid the warning altogether. Or, you could alter the package list to
load the named unit from another package.
package Produce;
contains Classes;
end.
In the above program, Classes uses (either directly or indirectly) 'consts', 'TypInfo', and 'SysUtils'. We will get a warning message
for each of these units.
package Solve;
contains consts, TypInfo, SysUtils, Classes;
end.
The best solution for this problem is to explicitly name all the units which will be imported into the package in the contains clause,
as has been done here.
3.1.2.1.246 E2420: Interface '%s' used in '%s' is not yet completely defined
Interface used in is not yet completely defined. Forward declared interfaces must be declared in the same type section that they
are used in. As an example the following code will not compile because of the above error message:
program Project3;
{$APPTYPE CONSOLE} 3
type
TInterface = interface;
TFoo = class
type
TBar = class(TObject, TInterface)
procedure Bar;
end;
417
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
end;
TInterface = interface
procedure Intf;
end;
procedure TFoo.TBar.Bar;
begin
end;
begin
end.
type
TListEntry = record
Next: ^TListEntry; (*<-- Error message here*)
Data: Integer;
end;
TMyClass = class; (*<-- Error message here*)
TMyClassRef = class of TMyClass;
TMyClasss = class (*<-- Typo ...*)
(*...*)
end;
begin
end.
The example tries to refer to record type before it is completely defined. Also, because of a typo, the compiler never sees a
complete declaration for TMyClass.
program Solve;
type
PListEntry = ^TListEntry;
TListEntry = record
Next: PListEntry;
Data: Integer;
end;
TMyClass = class;
TMyClassRef = class of TMyClass;
TMyClass = class
(*...*)
end;
begin
end.
3
The solution for the first problem is to introduce a type declaration for an auxiliary pointer type. The second problem is fixed by
spelling TMyClass correctly.
418
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
var
j : Integer;
procedure Show;
var i : Integer = 151;
begin
end;
begin
end.
The declaration and initialization of 'i' in procedure 'Show' is illegal.
program Solve;
var
j : Integer;
procedure Show;
var i : Integer;
begin
i := 151;
end;
begin
j := 0;
end.
You can use a programmatic style to set all variables to known values.
var
i, j : Integer = 151, 152;
begin
end.
The compiler will disallow the declaration and initialization of more than one variable at a time.
program Solve;
var
i : Integer = 151;
j : Integer = 152;
begin
end.
Simple declare each variable by itself to allow initialization.
3
3.1.2.1.250 E2194: Cannot initialize thread local variables
The compiler does not allow initialization of thread local variables.
program Produce;
threadvar
tls : Integer = 151;
419
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end.
The declaration and initialization of 'tls' above is not allowed.
program Solve;
threadvar
tls : Integer;
var
A : array [1..10] of Integer = (1,2,3,4,5,6,7,8,9);
begin
end.
The example declares an array of 10 elements, but the initialization only supplies 9 elements.
program Solve;
var
A : array [1..10] of Integer = (1,2,3,4,5,6,7,8,9,10);
begin
end.
We just had to supply the missing element to make the compiler happy. When initializing bigger arrays, it can be sometimes hard
to see whether you have supplied the right number of elements. To help with that, you layout the source file in a way that makes
counting easy (e.g. ten elements to a line), or you can put the index of an element in comments next to the element itself.
3.1.2.1.253 E2418: Type '%s' needs initialization - not allowed in variant record
Type needs initialization - not allowed in variant record. Variant records do not allow types that need initialization in their variant
3 field list since each variant field references the same memory location. As an example, the following code will not compile
because the array type needs to be initialized.
program Project3;
{$APPTYPE CONSOLE}
type
TFoo = record
case Boolean of
True: (bar: Integer);
420
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end.
3.1.2.1.256 H2444: Inline function '%s' has not been expanded because
accessing member '%s' is inaccessible
An inline function cannot be expanded when the inline function body refers to a restricted member that is not accessible where
the function is called.
For example, if an inline function refers to a strict private field and this function is called from outside the class (e.g. from a
global procedure), the field is not accessible at the call site and the inline function is not expanded.
3.1.2.1.258 E2449: Inlined nested routine '%s' cannot access outer scope
variable '%s'
You can use the inline directive with nested procedures and functions. However, a nested procedure or function that refers to a
variable that is local to the outer procedure is not eligible for inlining.
3.1.2.1.259 H2445: Inline function '%s' has not been expanded because its unit
'%s' is specified in USES statement of IMPLEMENTATION section and current
function is inline function or being inline function
Inline functions are not expanded between circularly dependent units.
3
3.1.2.1.260 H2443: Inline function '%s' has not been expanded because unit
'%s' is not specified in USES list
This situation may occur if an inline function refers to a type in a unit that is not explicitly used by the function's unit. For example,
this may happen if the function uses inherited to refer to methods inherited from a distant ancestor, and that ancestor's unit is
not explicitly specified in the uses list of the function's unit.
If the inline function's code is to be expanded, then the unit that calls the function must explicitly use the unit where the ancestor
421
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
type is exposed.
3.1.2.1.261 E2441: Inline function declared in interface section must not use
local symbol '%s'
This error occurs when an inline function is declared in the interface section and it refers to a symbol that is not visible outside
the unit. Expanding the inline function in another unit would require accessing the local symbol from outside the unit, which is not
permitted.
To correct this error, move the local symbol declaration to the interface section, or make it an instance variable or class variable
of the function's class type.
const
VeryBigHex = $80000000000000001;
begin
end.
The constant in the above example is too large to represent in 64 bits, thus the compiler will output an error.
program Solve;
const
BigHex = $8000000000000001;
begin
end.
Check the constants that you have specified and ensure that they are representable in 64 bits.
See Also
Resolving internal errors ( see page 130)
422
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
type
IBase = interface
end;
var
g : TGUID;
begin
g := IBase;
p(IBase);
end.
In this example, the IBase type is defined but it is not given an interface, and is thus cannot be assigned to a GUID type.
program Solve;
type
IBase = interface
['{00000000-0000-0000-0000-000000000000}']
end;
var
g : TGUID;
begin
g := IBase;
p(IBase);
end.
To solve the problem, you must either not attempt to assign an interface type without a GUID to a GUID type, or you must assign
a GUID to the interface when it is defined. In this solution, a GUID has been assigned to the interface type when it is defined.
type
IBaseIntf = interface
423
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end.
Generally, as in this example, errors of this type are plain enough to be easily visible. However, as can be seen with p1, things
can be more subtle. Since p1 is overriding a procedure from the inherited class, p1 also inherits the virtuality of the procedure
defined in the base class.
program Solve;
type
IBaseIntf = interface
procedure p0(var x : Shortint);
procedure p1(var x : Integer);
procedure p2(var x : Integer);
end;
424
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
end.
One approach to solving this problem is to use a message resolution clause for each problematic identifier, as is done in the
example shown here. Another viable approach, which requires more thoughtful design, would be to ensure that the class
identifiers are compatible to the interface identifiers before compilation.
begin
end.
In this example, the IBaseIntf interface is specified multiple times in the inheritance section of the definition of TBaseClass. As a
class can not implement the same interface more than once, this cause the compiler to emit the error message.
program Solve;
type
IBaseIntf = interface
end;
begin
end.
The only solution to this error message is to ensure that a particular interface appears no more than once in the inheritance
section of a class definition.
3
3.1.2.1.269 E2089: Invalid typecast
This error message is issued for type casts not allowed by the rules. The following kinds of casts are allowed:
425
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
Writeln( Integer(Pi) );
end.
This programmer thought he could cast a floating point constant to Integer, like in C.
program Solve;
begin
Writeln( Trunc(Pi) );
end.
In the Delphi language, we have separate Transfer functions to convert floating point values to integer.
See your operating system documentation for details on how to install codepages.
(*$IFDEF*)
(*$ENDIF*)
begin
end.
The $IFDEF conditional directive is incorrectly specified here and will result in an error.
program Solve;
(*$IFDEF WIN32*)
(*$ENDIF*)
begin
end.
The solution to the problem is to ensure that a symbol to test follows the appropriate directives.
426
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
• The compiler found a $ELSE or $ENDIF directive, but no preceding $IFDEF, $IFNDEF or $IFOPT directive.
• (*$IFOPT*) was not followed by a switch option and a + or -.
• The long form of a switch directive was not followed by ON or OFF.
• A directive taking a numeric parameter was not followed by a valid number.
• The $DESCRIPTION directive was not followed by a string.
• The $APPTYPE directive was not followed by CONSOLE or GUI.
• The $ENUMSIZE directive (short form $Z) was not followed by 1,2 or 4.
begin
(*$If O+*) (*<-- Error here*)
Writeln('Optimizations are ON');
(*$Else*) (*<-- Error here*)
Writeln('Optimizations are OFF');
(*$Endif*) (*<-- Error here*)
Writeln('Hello world!');
end.
The example shows three typical error situations, and the last two errors are caused by the compiler not having recognized $If.
(*$Description 'Copyright CodeGear 2007'*) (*Need string*)
program Solve;
(*$AppType Console*) (*AppType*)
begin
(*$IfOpt O+*) (*IfOpt*)
Writeln('Optimizations are ON');
(*$Else*) (*Now fine*)
Writeln('Optimizations are OFF');
(*$Endif*) (*Now fine*)
Writeln('Hello world!');
end.
So $Description needs a quoted string, we need to spell $AppType right, and checking options is done with $IfOpt. With these
changes, the example compiles fine.
3.1.2.1.273 E2298: read/write not allowed for CLR events. Use Include/Exclude
procedure
Multicast events cannot be assigned to or read from like traditional Delphi read/write events.
type
Base = class
procedure Msg1(x : Integer); message 151;
procedure Msg2(VAR x, y : Integer); message 152;
end;
427
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end.
The obvious error in the first case is that the parameter is not VAR. The error in the second case is that more than one
parameter is declared.
program Solve;
type
Base = class
procedure Msg1(VAR x : Integer); message 151;
procedure Msg2(VAR y : Integer); message 152;
end;
begin
end.
The solution in both cases was to only specify one, VAR, parameter in the message method declaration.
3.1.2.1.275 E2294: A class helper that descends from '%s' can only help
classes that are descendents '%s'
The object type specified in the "for" clause of a class helper declaration is not a descendent of the object type specified in the
"for" clause of the class helper's ancestor type.
3.1.2.1.277 E2387: The key container name '%s' does not exist
No further information is available for this error or warning.
3
428
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
If you receive this error, use a static or ragged (non-rectangular) array. See the Delphi Language Guide for details.
See Also
Structured Types ( see page 566)
type
Base = class
protected
Caption : String;
Title : String;
property TitleProp : string read Title write Title;
end;
begin
end.
The intent of the redeclaration of 'Derived.Title' is to change the field which is used to read and write the property 'Title' as well as
hoist it to 'public' visibility. Unfortunately, the programmer really meant to use 'TitleProp', not 'Title'.
program Solve;
(*$WARNINGS ON*)
type
Base = class
protected
Caption : String;
Title : String;
property TitleProp : string read Title write Title;
end;
3
Derived = class (Base)
public
property TitleProp read Caption write Caption;
property Title : string read Caption write Caption;
end;
begin
end.
There are a couple ways of approaching this error. The first, and probably the most commonly taken, is to specify the real
429
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
property which is to be redeclared. The second, which can be seen in the redeclaration of 'Title' addresses the problem by
explicitly creating a new property, with the same name as a field in the base class. This new property will hide the base field,
which will no longer be accessible without a typecast. (Note: If you have warnings turned on, the redeclaration of 'Title' will issue
a warning notifying you that the redeclaration will hide the base class' member.)
3.1.2.1.284 E2416: Could not import package '%s' because it contains system
unit '%s'
The Borland.Delphi.System unit may only be loaded from the Borland.Delphi.dll package. This error will occur if
Borland.Delphi.System is attempted to be loaded from an alternative package.
430
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
unit Solve;
interface
implementation
label 99;
begin
99:
end.
You have to move it to the implementation section.
3.1.2.1.290 E2074: Label declared and referenced, but not set: '%s'
You declared and used a label in your program, but the label definition was not encountered in the source code.
program Produce;
procedure Labeled;
label 10;
begin
goto 10;
end;
begin
end.
Label 10 is declared and used in the procedure 'Labeled', but the compiler never finds a definition of the label.
program Produce;
procedure Labeled;
label 10;
begin 3
goto 10;
10:
end;
begin
end.
The simple solution is to ensure that a declared and used label has a definition, in the same scope, in your program.
431
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
Usually, you can divide the long line into two shorter lines.
If you need a really long string constant, you can break it into several pieces on consecutive lines that you concatenate with the
'+' operator.
• Increase the visibility of the member from protected to public, so it can be accessed outside of its assembly.
• “Link in” the assembly where the protected member is defined, so that this assembly is incorporated into the assembly you are
building, and the access will be inside the assembly.
See Also
Classes and Objects ( see page 514)
3.1.2.1.293 W1053: Local PInvoke code has not been made because external
routine '%s' in package '%s' is defined using package local types in its custom
attributes
This warning may arise when an external package uses PInvoke to access Win32 library code, and that package exposes the
PInvoke definition through a public export. In these cases the compiler will attempt to link directly to the Win32 library by copying
the PInvoke definition to the local assembly, rather than linking to the public export in the external package. This is more secure
and can also improve runtime performance.
This warning message is issued if the compiler is unable to emit the PInvoke definition locally, because the external assembly
uses locally-defined types for a custom attribute. To avoid this warning, you must change the named package so that it does not
use locally-defined types for a custom attribute in an exported function or procedure.
For example, in the following code, the unit ExternalPackagedUnit exposes the external function Beep in kernel32
through the TFoo.Beep function, with the MyAttribute custom attribute:
unit ExternalPackagedUnit;
interface
3
function Beep(dwFreq, dwDuration: MyLongWord): Boolean; static; stdcall;
implementation
type
MyAttribute = class(System.Attribute)
.
.
.
end;
432
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
[MyAttribute]
function Beep(dwFreq, dwDuration: LongWord): Boolean; stdcall; external 'kernel32' name 'Beep';
end.
If one attempts to compile a program which uses ExternalPackagedUnit, then because the MyAttribute type is
locally-defined in ExternalPackagedUnit the compiler will be unable to link directly to the Beep function in kernel32, and
this warning will be issued. In the example, this problem can be solved by making the MyAttribute type public (by moving its
declaration from the implementation section to the interface section), or by removing the custom attribute from the Beep
function.
See Also
Using Platform Invoke with RAD Studio
This is illegal, because the local procedure could then be called even if the enclosing procedure is not active. This situation
would cause the program to crash if the local procedure tried to access any variables of the enclosing procedure.
program Produce;
var
P: Procedure;
procedure Outer;
procedure Local;
begin
Writeln('Local is executing');
end;
begin
P := Local; (*<-- Error message here*)
end;
begin
Outer;
P;
end.
The example tries to assign a local procedure to a procedure variable. This is illegal because it is unsafe at runtime.
program Solve;
var
P: Procedure;
procedure NonLocal;
begin 3
Writeln('NonLocal is executing');
end;
procedure Outer;
begin
P := NonLocal;
end;
begin
433
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
Outer;
P;
end.
The solution is to move the local procedure out of the enclosing one.
procedure NoTLS;
threadvar
x : Integer;
begin
end;
begin
end.
A thread variable cannot be declared local to a procedure.
program Solve;
threadvar
x : Integer;
procedure YesTLS;
var
localX : Integer;
begin
end;
begin
end.
There are two simple alternatives for avoiding this error. First, the threadvar section can be moved to a local scope. Secondly,
the threadvar in the procedure could be changed into a normal var section. Note that if compiler hints are turned on, a hint about
localX being declared but not used will be emitted.
434
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
else
Writeln('Unexpected result');
end;
end.
In the example above, the compiler gives an error rather than treating the ranges as empty. Most likely, the reversal of the
bounds was not intentional.
program Solve;
type
SubrangeType = 0..1;
begin
case True of
False..True:
Writeln('Expected result');
else
Writeln('Unexpected result');
end;
end.
Make sure you have specified the bounds in the correct order.
function TFoo.PublicFunc:Integer;
begin
Result := Self.PrivateMember;
end;
Because Result := Self.PrivateMember; will be inserted wherever PublicFunc is called, PrivateMember must be
accessible in any such location.
To correct this error, remove the inline directive or adjust the visibility of the inline method or the member it accesses.
435
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
3.1.2.1.304 E2346: Metadata - A guid was not provided where one was required
No further information is available for this error or warning.
3.1.2.1.305 E2350: Metadata - No logical space left to create more user strings
No further information is available for this error or warning.
This should rarely happen. If it does, make sure your swap file is large enough and that there is still room on the disk.
• Properties in an automated section must use methods for access, they cannot use fields in their read or write clauses.
• You tried to call a class method with the "ClassType.MethodName" syntax, but "MethodName" was not the name of a method.
• You tried calling an inherited with the "Inherited MethodName" syntax, but "MethodName" was not the name of a method.
program Produce;
type
3 TMyBase = class
Field: Integer;
end;
TMyDerived = class (TMyBase)
Field: Integer;
function Get: Integer;
Automated
property Prop: Integer read Field; (*<-- Error message here*)
end;
436
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
end.
The example tried to declare an automated property that accesses a field directly. The second error was caused by trying to get
at a field of the base class - this is also not legal.
program Solve;
type
TMyBase = class
Field: Integer;
end;
TMyDerived = class (TMyBase)
Field: Integer;
function Get: Integer;
Automated
property Prop: Integer read Get;
end;
begin
Writeln( TMyDerived.Create.Prop );
end.
The first problem is fixed by accessing the field via a method. The second problem can be fixed by casting the Self pointer to the
base class type, and accessing the field off of that.
437
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
(*$Else*)
Writeln('Compiled without optimizations');
(*Endif*)
end. (*<-- Error message here*)
In this example, we left out the $ character in the (*$Endif*) directive, so the compiler mistook it for a comment.
program Solve;
(*$APPTYPE CONSOLE*)
begin
(*$IfOpt O+*)
Writeln('Compiled with optimizations');
(*$Else*)
Writeln('Compiled without optimizations');
(*$Endif*)
end.
The solution is to make sure all the conditional directives have a valid $ENDIF directive.
3.1.2.1.312 E2403: Add or remove accessor for event '%s' cannot be found
No further information is available for this error or warning.
3.1.2.1.313 E2253: Ancestor type '%s' does not have an accessible default
constructor
The ancestor of the class being compiled does not have an accessible default constructor. This error only occurs with the byte
code version of the compiler.
438
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
The solution to this problem is to ensure that the DCP file for the named package is in one of the units named in the library path.
Leaving off the type is legal for constant and variable parameters.
program Produce;
begin 3
end.
We intended procedure P to have two integer parameters, but we put a semicolon instead of a comma after the first parameters.
The function ComputeHash was supposed to have an untyped first parameter, but untyped parameters must be either variable
or constant parameters - they cannot be value parameters.
program Solve;
439
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
end;
begin
end.
The solution in this case was to fix the type in P's parameter list, and to declare the Buffer parameter to ComputeHash as a
constant parameter, because we don't intend to modify it.
440
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
var
P: ^TIntArray;
I: Integer;
begin
Writeln(P^[I]); (*Actually, P[I] would also be legal*)
end.
In The Delphi language, we must tell the compiler that we intend P to point to an array of integers.
This is only allowed for class methods and constructors, not normal methods and destructors.
program Produce;
441
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
type
TMyClass = class
(*...*)
end;
var
MyClass: TMyClass;
begin
MyClass := TMyClass.Create; (*Fine, constructor*)
Writeln(TMyClass.ClassName); (*Fine, class method*)
TMyClass.Destroy; (*<-- Error message here*)
end.
The example tries to destroy the type TMyClass - this doesn't make sense and is therefore illegal.
program Solve;
type
TMyClass = class
(*...*)
end;
var
MyClass: TMyClass;
begin
MyClass := TMyClass.Create; (*Fine, constructor*)
Writeln(TMyClass.ClassName); (*Fine, class method*)
MyClass.Destroy; (*Fine, called on instance*)
end.
As you can see, we really meant to destroy the instance of the type, not the type itself.
type
Base = class
end;
var
b : Base;
procedure P;
var ch : Char;
begin
ch := b[1];
end;
begin
end.
The example above elicits an error because 'Base' does not declare an array property, and 'b' is not an array itself.
3 program Solve;
type
Base = class
function GetChar(i : Integer) : Char;
property data[i : Integer] : Char read GetChar; default;
end;
var
b : Base;
442
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
procedure P;
var ch : Char;
begin
ch := b[1];
ch := b.data[1];
end;
begin
end.
When you have declared a default property for a class, you can use the class instance variable in array expression, as if the
class instance variable itself were actually an array. Alternatively, you can use the name of the property as the actual array
accessor.
Note: If you have hints turned on, you will receive two warnings about the value assigned to 'ch' never being used.
var
r : string;
type
Base = class
t : string;
property Title : string read Title write Title;
property Caption : string read r write r;
end;
begin
end.
The two properties in this code both cause errors. The first causes an error because it is not possible to specify the property itself
as the read & write methods. The second causes an error because 'r' is not a member of the Base class.
program Solve;
type
Base = class
t : string;
property Title : string read t write t;
end;
begin
end.
To solve this error, make sure that all read & write clauses for properties specify a valid field or method identifier that is a 3
member of the class which owns the property.
443
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
MyObject = class
end;
MyInterface = interface(MyObject)
end;
begin
end.
In this example, the type 'Base' is erroneously declared since 'Name' is not declared as an interface type. Likewise, 'MyInterface'
is incorrectly declared because its ancestor interface was not declared as such.
3
program Solve;
type
BaseInterface = interface
end;
MyInterface = interface(BaseInterface)
end;
444
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
end.
The best solution when encountering this error is to reexamine the source code to determine what was really intended. If a class
is to implement an interface, it must first be explicitly derived from a base type such as TObject. When extended, interfaces can
only have a single interface as its ancestor.
In the example above, the interface is properly derived from another interface and the object definition correctly specifies a base
so that interfaces can be specified.
begin
if 2*2 <> 4 then
goto Exit; (*<-- Error message here: Exit is also a standard procedure*)
(*...*)
Exit: (*Additional error messages here*)
end.
program Solve;
label
Exit; (*Labels must be declared in Delphi*)
begin
if 2*2 <> 4 then
goto Exit;
(*...*)
Exit:
end.
3.1.2.1.334 E2075: This form of method call only allowed in methods of derived
types
This error message is issued if you try to make a call to a method of an ancestor type, but you are in fact not in a method.
program Produce;
type
TMyClass = class
constructor Create;
end;
procedure Create;
begin
inherited Create; (*<-- Error message here*)
end;
begin
end. 3
The example tries to call an inherited constructor in procedure Create, which is not a method.
program Solve;
type
TMyClass = class
constructor Create;
end;
445
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
constructor TMyclass.Create;
begin
inherited Create;
end;
begin
end.
The solution is to make sure you are in fact in a method when using this form of call.
446
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
end.
The procedure f0(a : integer; ch : char) causes the error since it is not marked with the overload keyword.
program solve;
begin
end.
If the procedure is intended to be an overloaded version, then mark it as overload. If it is not intended to be an overloaded
version, then change its name.
447
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
3.1.2.1.339 E2267: Previous declaration of '%s' was not marked with the
'overload' directive
There are two solutions to this problem. You can either remove the attempt at overloading or you can mark the original
declaration with the overload directive. The example shown here marks the original declaration.
program Produce;
type
Base = class
procedure func(a : integer);
procedure func(a : char); overload;
end;
end.
This example attempts to overload the char version of func without marking the first version of func as overloadable.
You must mark all functions to be overloaded with the overload directive. If overload were not required on all versions it would be
possible to introduce a new method which overloads an existing method and then a simple recompilation of the source could
produce different behavior.
program Solve;
type
Base = class
procedure func(a : integer); overload;
procedure func(a : char); overload;
end;
end.
3 var
y : procedure;
exports y;
begin
end.
It is not possible to export variables from a built-in library, even though the variable is of 'procedure' type.
program Solve;
448
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
procedure ExportMe;
begin
end;
exports ExportMe;
begin
end.
Always be sure that all the identifiers listed in an EXPORTS clause truly represent procedures.
The declaration of a property specifies a name and a type, and includes at least one access specifier. The syntax of a property
declaration is:
property propertyName[indexes]: type index integerConstant specifiers;
where:
— Each parameter declaration has the form identifier1, ..., identifiern: type
— type must be a predefined or previously declared type identifier. That is, property declarations like property Num: 0..9 ... are
invalid.
— specifiers is a sequence of read, write, stored, default (or nodefault), and implements specifiers.
Every property declaration must have at least one read or write specifier.
For more information, see the 'About Properties' topic in the on-line Help.
type
RecordDesc = class
ch : Char;
end;
var
pCh : PChar;
r : RecordDesc;
procedure A; 3
begin
pCh.ch := 'A'; (* case 1 *)
449
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
program Solve;
type
RecordDesc = class
ch : Char;
end;
var
r : RecordDesc;
procedure A;
begin
r.ch := 'A'; (* case 1 *)
begin
end.
Here Sum is meant to be function, we have not told the compiler about it.
program Solve;
begin
end.
Just make sure you specify the result type.
3
450
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
3.1.2.1.346 E2082: TYPEOF can only be applied to object types with a VMT
This error message is issued if you try to apply the standard function TypeOf to an object type that does not have a virtual
method table.
A simple workaround is to declare a dummy virtual procedure to force the compiler to generate a VMT.
program Produce;
type
TMyObject = object
procedure MyProc;
end;
procedure TMyObject.MyProc;
begin
(*...*)
end;
var
P: Pointer;
begin
P := TypeOf(TMyObject); (*<-- Error message here*)
end.
The example tries to apply the TypeOf standard function to type TMyObject which does not have virtual functions, and therefore
no virtual function table (VMT).
program Solve;
3
type
TMyObject = object
procedure MyProc;
procedure Dummy; virtual;
end;
procedure TMyObject.MyProc;
begin
(*...*)
end;
451
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
procedure TMyObject.Dummy;
begin
end;
var
P: Pointer;
begin
P := TypeOf(TMyObject);
end.
The solution is to introduce a dummy virtual function, or to eliminate the call to TypeOf.
3.1.2.1.349 E2409: Fully qualified nested type name %s exceeds 1024 byte limit
No further information is available for this error or warning.
3 program Produce;
type
PMyObject = ^TMyObject;
TMyObject = object
F: Integer;
constructor Init;
destructor Done;
end;
constructor TMyObject.Init;
452
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
F := 42;
end;
destructor TMyObject.Done;
begin
end;
var
P: PMyObject;
begin
New(P, Done); (*<-- Error message here*)
end.
By mistake, we called New with the destructor, not the constructor.
program Solve;
type
PMyObject = ^TMyObject;
TMyObject = object
F: Integer;
constructor Init;
destructor Done;
end;
constructor TMyObject.Init;
begin
F := 42;
end;
destructor TMyObject.Done;
begin
end;
var
P: PMyObject;
begin
New(P, Init);
end.
Make sure you give the New standard function a constructor, or no additional argument at all.
3.1.2.1.352 E2256: Dispose not supported (nor necessary) for dynamic arrays
The compiler has encountered a use of the standard procedure DISPOSE on a dynamic array. Dynamic arrays are reference
counted and will automatically free themselves when there are no longer any references to them.
3
program Produce;
var
arr : array of integer;
begin
SetLength(arr, 10);
Dispose(arr);
end.
The use of DISPOSE on the dynamic array arr causes the error in this example.
453
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
program Produce;
var
arr : array of integer;
begin
SetLength(arr, 10);
end.
The only solution here is to remove the offending use of DISPOSE
begin
f0(1.2);
end.
The overloaded procedure f0 has two versions: one which takes a char and one which takes an integer. However, the call to f0
uses a floating point type, which the compiler cannot resolve into neither a char nor an integer.
program Solve;
begin
f0(1);
end.
You can solve this problem in two ways: either supply a parameter type which can be resolved into a match of an overloaded
procedure, or create a new version of the overloaded procedure which matches the parameter type.
In the example above, the parameter type has been modified to match one of the existing overloaded versions of f0.
454
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
3.1.2.1.355 E2273: No overloaded version of '%s' with this parameter list exists
An attempt has been made to call an overloaded procedure but no suitable match could be found.
program overload;
procedure f(x : Char); overload;
begin
end;
begin
f(1.0);
end.
In the use of f presented here, the compiler is unable to find a suitable match (using the type compatibility & overloading rules)
given the actual parameter 1.0.
program overload;
procedure f(x : char); overload;
begin
end;
begin
f(1);
end.
Here, the call to f has been changed to pass an integer as the actual parameter which will allow the compiler to find a suitable
match. Another approach to solving this problem would be to introduce a new procedure which takes a floating point parameter.
begin
Writeln( DotProduct(C,C) );
end.
Here DotProduct was really meant to be a function, we just happened to use the wrong keyword...
455
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
program Solve;
const
C: array [1..3] of Double = (1,2,3);
begin
Writeln( DotProduct(C,C) );
end.
Just make sure you specify a result type when you declare a function, and no result type when you declare a procedure.
To put it another way, the function could execute so that it never assigns anything to the return value.
program Produce;
(*$WARNINGS ON*)
var
B: Boolean;
C: (Red,Green,Blue);
begin
B := False;
end.
The problem with procedure IfStatement and CaseStatement is that the result is not assigned in every code path. In
TryStatement, the compiler assumes that an exception could happen before Result is assigned.
456
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
program Solve;
(*$WARNINGS ON*)
var
B: Boolean;
C: (Red,Green,Blue);
begin
B := False;
end.
The solution is to make sure there is an assignment to the result variable in every possible code path.
type
Data = record
end;
var 3
v : Pointer;
begin
v := TypeInfo(Data);
end.
Record types do not generate type information, so this use of TypeInfo is illegal.
program Solve;
457
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
type
Base = class
end;
var
v : Pointer;
begin
v := TypeInfo(Base);
end.
A class does generate RTTI, so the use of TypeInfo here is perfectly legal.
(*$IMPLICITBUILD OFF*)
package NoBuild;
requires Base;
end.
In this example, the NoBuild package requires a package which was compiled in the always-build compiler state.
(*$IMPLICITBUILD OFF*)
package Base;
end.
(*$IMPLICITBUILD OFF*)
package NoBuild;
requires Base;
end.
The solution used in this example was to turn Base into a never-build package. Another viable option would have been to
remove the (*$IMPLICITBUILD OFF*) from the NoBuild package, thereby turning it into an always-build package.
However, his construct is mainly useful for error handling, and the Delphi language provides a more general and structured
mechanism to deal with errors: exception handling.
program Produce;
label 99;
3
procedure MyProc;
begin
(*Something goes very wrong...*)
goto 99;
end;
begin
MyProc;
99:
458
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
Writeln('Fatal error');
end.
The example above tries to halt computation by doing a non-local goto.
program Solve;
uses SysUtils;
procedure MyProc;
begin
(*Something goes very wrong...*)
raise Exception.Create('Fatal error');
end;
begin
try
MyProc;
except
on E: Exception do Writeln(E.Message);
end;
end.
In our solution, we used exception handling to stop the program. This has the advantage that we can also pass an error
message. Another solution would be to use the standard procedures Halt or RunError.
3.1.2.1.361 x2269: Overriding virtual method '%s.%s' has lower visibility (%s)
than base class '%s' (%s)
The method named in the error message has been declared as an override of a virtual method in a base class, but the visibility
in the current class is lower than that used in the base class for the same method.
While the visibility rules of Delphil would seem to indicate that the function cannot be seen, the rules of invoking virtual functions
will cause the function to be properly invoked through a virtual call.
Generally, this means that the method of the derived class was declared in a private or protected section while the method of the
base class was declared in a protected or pubic (including published) section, respectively.
unit Produce;
interface
type
Base = class(TObject)
public
procedure VirtualProcedure(X: Integer); virtual;
end;
Extended = class(Base)
protected
procedure VirtualProcedure(X: Integer); override;
end;
implementation
3
procedure Base.VirtualProcedure(X: Integer);
begin
end;
459
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
In practice this is never harmful, but it can be confusing to someone reading documentation and observing the visibility attributes
of the document.
This hint will only be produced for classes appearing in the interface section of a unit.
unit Solve;
interface
type
Base = class(TObject)
public
procedure VirtualProcedure(X: Integer); virtual;
end;
Extended = class(Base)
public
procedure VirtualProcedure(X: Integer); override;
end;
implementation
3 type
TBase = class
constructor Create; pascal;
end;
constructor TBase.Create;
begin
end;
begin
end.
460
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
program Solve;
type
TBase = class
constructor Create;
end;
constructor TBase.Create;
begin
end;
begin
end.
The only viable approach when this error has been issued by the compiler is to remove the offending calling convention directive
from the constructor or destructor definition, as has been done in this example.
type
Base = class
automated
procedure Method; cdecl;
end;
begin
end.
The language specification disallows all calling conventions except 'register' in an OLE automation section. The offending
statement is 'cdecl' in the above code.
program Solve;
type
Base = class
automated
procedure Method; register;
procedure Method2;
end;
procedure Base.Method2;
begin
3
end;
begin
end.
There are three solutions to this error. The first is to specify no calling convention on methods declared in an auto section. The
second is to specify only the register calling convention. The third is to move the offending declaration out of the automation
section.
461
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
implementation
function Base.getter : Integer;
begin getter := 0;
end;
end.
This example declares the getter function getter for the published property Value to be of cdecl calling convention, which
produces the error.
unit Solve;
interface
type
Base = class
public
function getter : Integer;
published
property Value : Integer read getter;
end;
implementation
function Base.getter : Integer;
begin getter := 0;
end;
end.
The only solution to this problem is to declare the getter function to match the correct calling convention, which is the default. As
can be seen in this example, no calling convention is specified.
462
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
const
c = 1;
function f: PChar;
begin
f := 'Hello'; (*This is fine - we are setting the return value*)
end;
begin
c := 2; (*<-- Error message here*)
f := 'h'; (*<-- Error message here*)
end.
The example assigns to constant parameter, to a constant, and to the result of a function call. All of these are illegal.
program Solve;
var
c : Integer = 1; (*Use an initialized variable*)
function f: PChar;
begin
f := 'Hello'; (*This is fine - we are setting the return value*)
end;
begin
c := 2;
f^ := 'h'; (*This compiles, but will crash at runtime*)
end.
There two ways you can solve this kind of problem: either you change the definition of whatever you are assigning to, so the
assignment becomes legal, or you eliminate the assignment.
• Primitive types that the compiler recognizes, such as arrays, sets or strings
• Types that implement IEnumerable
• Types that implement the GetEnumerator pattern as documented in the Delphi Language Guide
Ensure that the specified type meets these requirements.
See Also 3
Declarations and Statements ( see page 705)
463
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
program Produce;
(*$HINTS ON*)
var
i : Integer;
begin
i := 0;
WHILE FALSE AND (i < 100) DO
INC(i);
end.
The compiler determines that 'FALSE AND (i < 100)' always evaluates to FALSE, and then easily determines that the loop will
not be executed.
program Solve;
(*$HINTS ON*)
var
i : Integer;
begin
i := 0;
WHILE i < 100 DO
INC(i);
end.
The solution to this hint is to check the boolean expression used to control while statements is not always FALSE. In the for
loops you should make sure that (upper bound - lower bound) >= 1.
You may see this warning if a FOR loop increments its control variable from a value within the range of Longint to a value
outside the range of Longint. For example:
var I: Cardinal;
begin
For I := 0 to $FFFFFFFF do
...
This results from a limitation in the compiler which you can work around by replacing the FOR loop with a WHILE loop.
3.1.2.1.371 E2248: Cannot use old style object types when compiling to byte
code
Old-style Object types are illegal when compiling to byte code.
3.1.2.1.372 E2058: Class, interface and object types only allowed in type
section
Class or object types must always be declared with an explicit type declaration in a type section - unlike record types, they
cannot be anonymous.
3 The main reason for this is that there would be no way you could declare the methods of that type - after all, there is no type
name.
program Produce;
var
MyClass : class
Field: Integer;
end;
464
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
end.
The example tries to declare a class type within a variable declaration - that is not legal.
program Solve;
type
TMyClass = class
Field: Integer;
end;
var
MyClass : TMyClass;
begin
end.
The solution is to introduce a type declaration for the class type. Alternatively, you could have changed the class type to a record
type.
procedure MyProc;
type
TMyClass = class
Field: Integer;
end;
begin
(*...*)
end;
begin
end.
So MyProc tries to declare a class type locally, which is illegal.
program Solve;
type
TMyClass = class
Field: Integer;
end;
procedure MyProc;
begin
(*...*)
end;
begin
end.
3
The solution is to move out the declaration of the class or object type to the global scope.
465
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
type
TMyObject = object
constructor Init; virtual;
end;
constructor TMyObject.Init;
begin
end;
begin
end.
The example tries to declare a virtual constructor, which does not really make sense for object types and is therefore illegal.
program Solve;
type
TMyObject = object
constructor Init;
end;
constructor TMyObject.Init;
begin
end;
begin
end.
The solution is to either make the constructor static, or to use a new-style class type which can have a virtual constructor.
3.1.2.1.375 E2439: Inline function must not have open array argument
To avoid this error, remove the inline directive or use an explicitly-declared dynamic array type instead of an open array
argument.
See Also
Parameters ( see page 672)
466
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
program Produce;
type
TByteSet = set of 0..7;
var
BitCount: array [TByteSet] of Integer;
begin
end.
The index type of an array must be an ordinal type - type TByteSet is a set, not an ordinal.
program Solve;
type
TByteSet = set of 0..7;
var
BitCount: array [Byte] of Integer;
begin
end.
Supply an ordinal type as the array index type.
implementation
function Base.getter : Integer;
begin getter := 0;
end;
end.
The overloaded function getter in the above example will cause this error.
unit Solve;
interface
type
Base = class
public
function getter : Integer;
property Value : Integer read getter;
end;
3
implementation
function Base.getter : Integer;
begin getter := 0;
end;
end.
The only solution when this problem occurs is to remove the offending overload specifications, as is shown in the above example.
467
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
type
Base = class
procedure Title; virtual;
end;
procedure Base.Title;
begin
end;
procedure Derived.Titl;
begin
end;
begin
end.
A common cause of this error is a simple typographical error in your source code. Make sure that the name used as the
'override' procedure is spelled the same as it is in the base class. In other situations, the base class will not provide the desired
procedure: it is those situations which will require much deeper analysis to determine how to solve the problem.
program Solve;
type
Base = class
procedure Title; virtual;
end;
procedure Base.Title;
begin
end;
3 procedure Derived.Title;
begin
end;
begin
end.
The solution (in this example) was to correct the spelling of the procedure name in Derived.
468
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
type
Base = class
procedure StaticMethod;
end;
procedure Base.StaticMethod;
begin
end;
procedure Derived.StaticMethod;
begin
end;
begin
end.
The example above elicits an error because Base.StaticMethod is not declared to be a virtual method, and as such it is not
possible to override its declaration.
program Solve;
type
Base = class
procedure StaticMethod;
end;
procedure Base.StaticMethod;
begin
end;
procedure Derived.StaticMethod;
begin
end;
begin 3
end.
The only way to remove this error from your program, when you don't have the source for the base classes, is to remove the
'override' specification from the declaration of the derived method. If you have source to the base classes, you could, with careful
consideration, change the base's method to be declared as one of the virtual types. Be aware, however, that this change can
have a drastic affect on your programs.
469
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
3.1.2.1.384 E2199: Packages '%s' and '%s' both contain unit '%s'
The project you are trying to compile is using two packages which both contain the same unit. It is illegal to have two packages
which are used in the same project containing the same unit since this would cause an ambiguity for the compiler.
The only solution to this problem is to redesign your package hierarchy to remove the ambiguity.
It is an error to have to related packages contain the same unit. The solution to this problem is to remove the unit from one of the
packages or to remove the relation between the two packages.
3.1.2.1.386 W1031: Package '%s' will not be written to disk because -J option
is enabled
The compiler can't write the package to disk because the -J option is attempting to create an object file.
The only solution to this error is to manually recompile the offending package. Be sure to specify the never-build switch, if it is
still desired.
470
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
implementation
begin
WriteLn(System.RandSeed);
end.
program u1;
uses u0;
end.
In the above example, u0 should be compiled alone. Then, u1 should be compiled with CLXxx (where xx represents the version).
The problem occurs because u0 is compiled under the premise that it will never use data which resides in a package.
(*$IMPORTEDDATA ON*)
unit u0;
interface
implementation
begin
WriteLn(System.RandSeed);
end.
program u1;
uses u0;
end.
To alleviate the problem, it is generally easiest to turn on the $IMPORTEDDATA switch and recompile the unit that produces the
error.
This warning is to notify you that you have included a unit which contains a threadvar in an interface into a package. While this is
not illegal, you will not be able to access the variable from a unit outside the package.
Attempting to access this variable may appear to succeed, but it actually did not.
A solution to this warning is to move the threadvar to the implementation section and provide function which will retrieve the
variables value.
471
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
program Solve;
type
SmallReal = Single;
begin
end.
In the Delphi language, you can declare a base class with a private member, and a child class in the same unit can refer to the
private member. In C++, this construction is not permitted. To fix it, change the child to refer to either a protected member of the
base class or a protected member of the child class.
procedure Base.Init;
begin
end;
begin
472
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end.
Here we have declared a private variable which is never used. The message will be emitted for this case.
program Solve;
program Produce;
type
Base = class
private
FVar : Integer;
procedure Init;
end;
procedure Base.Init;
begin
FVar := 0;
end;
begin
end.
There are various solutions to this problem, and since this message is not an error message, all are correct. If you have included
the private field for some future use, it would be valid to ignore the message. Or, if the variable is truly superfluous, it can be
safely removed. Finally, it might have been a programming oversight not to use the variable at all; in this case, simply add the
code you forgot to implement.
type
Base = class
class AProcedure; (*case 1*)
end;
begin
end.
In both cases above, the word 'procedure' should follow the keyword 'class'.
program Solve;
3
type
Base = class
class procedure AProcedure;
end;
begin
473
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
end.
As can be seen, adding the keyword 'procedure' removes the error from this program.
type
Base = class
v : Integer;
s : String;
protected
property Name : String read s write s;
property Value : Integer read v write v;
end;
3 Derived = class (Base)
public
property Name; (* Move Name to a public visibility by redeclaration *)
automated
property Value;
end;
begin
end.
474
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
In the above example, Name is moved from a private visibility in Base to public visibility in Derived by redeclaration. The same
idea is attempted on Value, but an error results.
program Solve;
type
Base = class
v : Integer;
s : String;
protected
property Name : String read s write s;
property Value : Integer read v write v;
end;
begin
end.
It is not possible to change the visibility of a property to an automated section, therefore the solution to this problem is to not
redeclare properties of base classes in automated sections.
begin
end.
The error in the example is that Extension attempts to override the Value property.
program Solve;
type
Base = interface
function Reader : Integer;
function Writer(a : Integer);
property Value : Integer read Reader write Writer; 3
end;
begin
end.
475
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
A solution to this error is to rename the offending property. Another, more robust, approach is to determine the original intent and
restructure the system design to solve the problem.
type
Base = class
v : Integer;
procedure SetV(x : Integer); dynamic;
function GetV : Integer; message;
property Velocity : Integer read GetV write v;
property Value : Integer read v write SetV;
end;
begin
end.
Both 'Velocity' and 'Value' above are in error since they both have illegal accessor functions assigned to them.
program Solve;
type
Base = class
v : Integer;
procedure SetV(x : Integer);
function GetV : Integer;
3 property Velocity : Integer read GetV write v;
property Value : Integer read v write SetV;
end;
476
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
end.
The solution taken in this is example was to remove the offending compiler directives from the procedure declarations; this may
not be the right solution for you. You may have to closely examine the logic of your program to determine how best to provide
accessor functions for your properties.
type
TBase = class
public
FX : Integer;
property X : Integer read FX write FX;
end;
var
BaseRef : TBaseClass;
x : Integer;
begin
BaseRef := TBase;
x := BaseRef.X;
end.
Attempting to access the property X in the example above causes the compiler to issue an error.
program Solve;
type
TBase = class
public
FX : Integer;
property X : Integer read FX write FX;
end;
var
BaseRef : TBaseClass;
x : Integer;
begin
BaseRef := TBase;
end.
There is no other solution to this problem than to remove the offending property access from your source code. If you wish to 3
access properties or fields of a class, then you need to create an instance variable of that class type and gain access through
that variable.
477
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
interface
type
T0 = class
f : integer;
property g : integer read f write f label '';
end;
implementation
begin
end.
In this solution, the label attribute has been replaced by a non-zero length string.
unit Solve;
interface
type
T0 = class
f : integer;
property g : integer read f write f label 'LabelText';
end;
implementation
begin
end.
type
Base = class
s : String;
var
c : Base;
procedure DiddleTitle
begin
if c.Title = '' then
c.Title := 'Super Galactic Invaders with Turbo Gungla Sticks';
begin
end.
If a property does not specify a 'write' clause, it effectively becomes a read-only property; it is not possible to assign a value to a
property which is read-only, thus the compiler outputs an error on the assignment to 'c.Title'.
program Solve;
type
478
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
Base = class
s : String;
var
c : Base;
procedure DiddleTitle
var title : String;
begin
title := c.Title;
if Title = '' then
Title := 'Super Galactic Invaders with Turbo Gungla Sticks';
(*perform other work on title*)
end;
begin
end.
One solution, if you have source code, is to provide a write clause for the read-only property - of course, this could dramatically
alter the semantics of the base class and should not be taken lightly. Another alternative would be to introduce an intermediate
variable which would contain the value of the read-only property - it is this second alternative which is shown in the code above.
type
Base = class
s : String;
var
c : Base;
s : String;
begin
s := c.Password;
end.
Since c.Password has not specified a read clause, it is not possible to read its value.
program Solve;
type
Base = class
s : String;
3
property Password : String read s write s;
end;
var
c : Base;
s : String;
begin
s := c.Password;
end.
479
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
One easy solution to this problem, if you have source code, would be to add a read clause to the write-only property. But, adding
a read clause is not always desirable and could lead to holes in a security system. Consider, for example, a write-only property
called 'Password', as in this example: you certainly wouldn't want to casually allow programs using this class to read the stored
password. If a property was created as write-only, there is probably a good reason for it and you should reexamine why you
need to read this property.
var
str : String;
pstr : PString;
begin
str := 'Sharene';
pstr := @str;
Finalize(pstr); (*note: do not attempt to use 'str' after this*)
end.
In this example the pointer, pstr, is passed to the Finalize procedure. This causes an hint since pointers do not require
finalization.
program Solve;
var
str : String;
pstr : PString;
begin
str := 'Sharene';
pstr := @str;
Finalize(pstr^); (*note: do not attempt to use 'str' after this*)
end.
The solution to this problem is to apply the ^ operator to the pointer which is passed to the Finalization procedure.
3
3.1.2.1.418 E2186: Published Real property '%s' must be Single, Real, Double
or Extended
You have attempted to publish a property of type Real, which is not allowed. Published floating point properties must be Single,
Double, or Extended.
program Produce;
type
480
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
Base = class
R : Real48;
published
property RVal : Real read R write R;
end;
end.
The published Real48 property in the program above must be either removed, moved to an unpublished section or changed into
an acceptable type.
program Produce;
type
Base = class
R : Single;
published
property RVal : Single read R write R;
end;
end.
This solution changed the property into a real type that will actually produce run-time type information.
begin
end.
(*$TYPEINFO ON*)
program Solve;
type
CharSet = set of 'A'..'Z';
NamePlate = class
Characters : CharSet;
published
property TooBig : CharSet read Characters write Characters ;
end;
begin
end.
481
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
type
TPoint = record
X, Y: Integer;
end;
var
Point : TPoint = (Y: 123; X: 456);
begin
end.
The example tries to initialize first Y, then X, in the opposite order from the declaration.
program Solve;
type
TPoint = record
X, Y: Integer;
end;
var
Point : TPoint = (X: 456; Y: 123);
begin
end.
The solution is to adjust the order of initialization to correspond to the declaration order.
3
3.1.2.1.426 F2092: Program or unit '%s' recursively uses itself
An attempt has been made for a unit to use itself.
unit Produce;
interface
uses Produce;
implementation
begin
482
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end.
In the above example, the uses clause specifies the same unit, which causes the compiler to emit an error message.
unit Solve;
interface
implementation
begin
end.
The only solution to this problem is to remove the offending uses clause.
end.
The error is caused because it is not legal for a package to require itself.
The only solution to this problem is to remove the recursive use of the package.
procedure RaiseException;
begin
raise; (*case 1*)
try
raise; (*case 2*)
except
try
raise; (*case 3*)
except
end;
raise;
end;
end;
begin
end.
There are several reasons why this error might occur. First, you might have specified a raise with no exception constructor
outside of an exception handler. Secondly, you might be attempting to reraise an exception in the try block of an exception 3
handler. Thirdly, you might be attempting to reraise the exception in an exception handler nested in another exception handler.
program Solve;
uses SysUtils;
procedure RaiseException;
begin
raise Exception.Create('case 1');
try
raise Exception.Create('case 2');
483
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
except
try
raise Exception.Create('case 3');
except
end;
raise;
end;
end;
begin
end.
One solution to this error is to explicitly raise a new exception; this is probably the intention in situations like 'case 1' and 'case 2'.
For the situation of 'case 3', you will have to examine your code to determine a suitable workaround which will provide the
desired results.
begin
end.
You cannot return a file from a function.
program Solve;
begin
end.
You can 'return' the file as a variable parameter. Alternatively, you can also allocate a file dynamically and return a pointer to it.
3
3.1.2.1.432 Linker error: %s
The resource linker (RLINK32) has encountered an error while processing a resource file. This error may be caused by any of
the following reasons:
• You have used a duplicate resource name. Rename one of the resources.
• You have a corrupted resource file. You need to replace it with another version that is not corrupted or remove it.
484
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
• You are using an unsupported resource type, such as a 16-bit resource or form template.
• If converting resources such as 16-bit icons to 32-bit, the resource linker may have encountered problems.
In 16-bit versions of CodeGear Pascal, segment/offset pairs were used to declare absolute variables, and as arguments to the
Ptr standard function.
Note that absolute addresses should not be used in 32-bit protected mode programs. Instead appropriate Win32 API functions
should be called.
program Produce;
var
VideoMode : Integer absolute $0040:$0049;
begin
Writeln( Byte(Ptr($0040,$0049)^) );
end.
program Solve;
(*This version will compile, but will not run; absolute addresses are to be carefully avoided*)
var
VideoMode : Integer absolute $0040*16+$0049;
begin
Writeln( Byte(Ptr($0040*16+$0049)^) );
end.
var
b : Integer;
485
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
begin
if b = 10 then
b := 0;
else
b := 10;
end.
The Delphi language does not allow a ';' to be placed directly before an ELSE statement. In the code above, an error will be
flagged because of this fact.
program Solve;
var
b : Integer;
begin
if b = 10 then
b := 0
else
b := 10;
if b = 10 then begin
b := 0;
end
else begin
b := 10;
end;
end.
There are two easy solutions to this problem. The first is to remove the offending ';'. The second is to create compound
statements for each part of the IF-ELSE. If $HINTS are turned on, you will receive a hint about the value assigned to 'b' is never
used.
3 We need to make sure the upper and lower bounds and in the range 0..255.
486
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
type
IntegerArray = array [1..10] OF Integer;
var
SliceMe : array [1..200] OF Integer;
type
IntegerArray = array [1..10] OF Integer;
var
SliceMe : array [1..200] OF Integer;
3.1.2.1.440 E2454: Slice standard function not allowed for VAR nor OUT
argument
You cannot write back to a slice of an array, so you cannot use the slice standard function to pass an argument that is var or
out. If you must modify the array, either pass in the full array or use an array variable to hold the desired part of the full array.
3.1.2.1.441 E2240: $EXTERNALSYM and $NODEFINE not allowed for '%s'; only
global symbols
3
The $EXTERNALSYM and $NODEFINE directives can only be applied to global symbols.
487
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
(*$WARNINGS ON*)
const
Title = 'Super Galactic Invaders with Turbo Gungla Sticks';
Subtitle = 'Copyright (c) 2002 by Frank Borland';
type
TitleString = String[25];
SubtitleString = String[18];
var
ProgramTitle : TitleString;
ProgramSubtitle : SubtitleString;
begin
ProgramTitle := Title;
ProgramSubtitle := Subtitle;
end.
The two string constants are assigned to variables which are too short to contain the entire string. The compiler will truncate the
strings and perform the assignment.
program Solve;
(*$WARNINGS ON*)
const
Title = 'Super Galactic Invaders with Turbo Gungla Sticks';
Subtitle = 'Copyright (c) 2002';
type
TitleString = String[55];
SubtitleString = String[18];
var
ProgramTitle : TitleString;
ProgramSubtitle : SubtitleString;
begin
ProgramTitle := Title;
ProgramSubtitle := Subtitle;
end.
There are two solutions to this problem, both of which are demonstrated in this example. The first solution is to increase the size
of the variable to hold the string. The second is to reduce the size of the string to fit in the declared size of the variable.
Note that you can construct long string literals spanning more than one line by using the '+' operator to concatenate several
string literals.
program Produce;
var
LongString : string[256]; (*<-- Error message here*)
begin
488
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
end.
In the example above, the length of the string is just one beyond the limit.
program Solve;
var
LongString : AnsiString;
begin
end.
The most convenient solution is to use the new long strings - then you don't even have to spend any time thinking about what a
reasonable maximum length would be.
The names in the following list are currently reserved by the compiler.
• System
• SysInit
unit System;
interface
implementation
begin
end.
The name of the unit in this example is illegal because it is reserved for use by the compiler.
unit MySystem;
interface
implementation
begin
end.
The only solution to this problem is to use a different name for the unit.
489
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
The only solution is to reduce the number of conditional compilation symbols contained on the command line (or in configuration
files).
The only solution is to address some of the errors and recompile the project.
Additionally, this error message occurs when an OLE automation call has too many (more than 255), or too many named
parameters.
program Produce;
begin
Writeln( Max(1,2,3) ); (*<-- Error message here*)
end.
It would have been convenient for Max to accept three parameters...
program Solve;
begin
Writeln( Max([1,2,3]) );
3 end.
Normally, you would change to call site to supply the right number of parameters. Here, we have chose to show you how to
implement Max with an unlimited number of arguments. Note that now you have to call it in a slightly different way.
490
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
begin
end.
The example erroneously uses the name of the variable, not the name of the type, as the type of the argument.
program Solve;
type
TMyClass = class
Field: Integer;
end;
var
MyClass: TMyClass;
begin
end.
Make sure the offending identifier is indeed a type - maybe it was misspelled, or another identifier of the same name hides the
one you meant to refer to.
begin
Finalize(ch);
end.
In this example, the Delphi type Char needs no finalization.
491
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
The usual solution to this problem is to remove the offending use of Finalize.
type
EnormousArray = array [0..MaxLongint] OF Longint;
BigRecord = record
points : array [1..10000] of Extended;
end;
var
data : array [0..500000] of BigRecord;
begin
end.
It is easily apparent to see why these declarations will elicit error messages.
program Solve;
type
EnormousArray = array [0..MaxLongint DIV 8] OF Longint;
DataPoints = ^DataPointDesc;
DataPointDesc = array [1..10000] of Extended;
BigRecord = record
points : DataPoints;
end;
var
data : array [0..500000] OF BigRecord;
begin
end.
The easy solution to avoid this error message is to make sure that the size of your data types remain under 2Gb in size. A more
complicated method would involve the restructuring of your data, as has been begun with the BigRecord declaration.
The TypeInfo standard procedure requires a type identifier as its parameter. In the code above, 'NotType' does not represent a
type identifier.
492
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
To avoid this error, ensure that you compile while the {$M+}/{$TYPEINFO ON} switch is on, or derive from a class that was
compiled with {$M+}/{$TYPEINFO ON} switch on.
var
p : Pointer;
procedure NotType;
begin
end;
begin
p := TypeInfo(NotType);
end.
The TypeInfo standard procedure requires a type identifier as it's parameter. In the code above, 'NotType' does not represent a
type identifier.
program Solve;
type
Base = class
end;
var
p : Pointer;
begin
p := TypeInfo(Base);
end.
By ensuring that the parameter used for TypeInfo is a type identifier, you will avoid this error.
type
Base = class
private
a : Integer;
property BaseProp : integer read a write a;
end;
3
Derived = class (Base)
ch : Char;
property Alpha read ch write ch; (*case 1*)
property BesaProp; (*case 2*)
end;
begin
end.
There are two basic causes of this error. The first is the specification of a new property without specifying a type; this usually is
493
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
not supposed to be a movement to a new visibility level. The second is the specification of a property which should exist in the
base class, but is not found by the compiler; the most likely cause for this is a simple typo (as in "BesaProp"). In the second form,
the compiler will also output errors that a read or write clause was expected.
program Solve;
type
Base = class
private
a : Integer;
property BaseProp : integer read a write a;
end;
begin
end.
The solution for the first case is to supply the type of the property. The solution for the second case is to check the spelling of the
property name.
The unit is tagged (using the deprecated hint directive) as no longer current and is maintained for compatibility only. You should
consider updating your source code to use another unit, if possible.
The $WARN UNIT_DEPRECATED ON/OFF compiler directive turns on or off all warnings about the deprecated directive in
3 units where the deprecated directive is specified.
494
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
Most likely, the file has been corrupted. Recompile the file if you have the source. If the problem persists, you may have to
reinstall Delphi.
The RunClassConstructor function is used to execute the initialization sections of units used by the current unit in the order
specified by the current unit's uses clauses. This warning will be issued if the compiler cannot find this function in the .NET
Framework you are linking against. For example, it will occur when linking against the .NET Compact Framework, which does
not implement RunClassConstructor.
The $WARN UNIT_LIBRARY ON/OFF compiler directive turns on or off all warnings in units where the library directive is
specified.
3.1.2.1.469 E1038: Unit identifier '%s' does not match file name
The unit name in the top unit is case sensitive and must match the name with respect to upper- and lowercase letters exactly.
The unit name is case sensitive only in the unit declaration.
The $WARN UNIT_PLATFORM ON/OFF compiler directive turns on or off all warnings about the platform directive in units
where the platform directive is specified.
3
3.1.2.1.471 E2070: Unknown directive: '%s'
This error message appears when the compiler encounters an unknown directive in a procedure or function declaration.
procedure P; stcall;
begin
495
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
end;
procedure Q forward;
begin
end.
In the declaration of P, the calling convention "stdcall" is misspelled. In the declaration of Q and GetLastError, we're missing a
semicolon.
program Solve;
procedure P; stdcall;
begin
end;
procedure Q; forward;
begin
end.
The solution is to make sure the directives are spelled correctly, and that the necessary semicolons are there.
496
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
program Produce;
var
ole : variant;
var
ole : variant;
497
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
You must remove the offending construct from the interface section before the unit can be translated.
Note that a comment started with '{' must be closed with '}', and a comment started with '(*' must be closed with '*)'.
program Produce;
(*Let's start a comment here but forget to close it
begin
end.
So the example just didn't close the comment.
program Solve;
(*Let's start a comment here and not forget to close it*)
begin
end.
Doing so fixes the problem.
This error message is reported at the source line of the last $IF/$IFDEF/etc. with no matching $ENDIF/$IFEND. This gives you a
good place to start looking for the source of the problem.
498
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
Note that character strings cannot be continued onto the next line - however, you can use the '+' operator to concatenate two
character strings on separate lines.
program Produce;
begin
Writeln('Hello world!); (*<-- Error message here -*)
end.
We just forgot the closing quote at the string - no big deal, happens all the time.
program Solve;
begin
Writeln('Hello world!');
end.
So we supplied the closing quote, and the compiler is happy.
procedure Local;
var i : Integer;
begin
end;
begin
end.
program Solve;
(*$HINTS ON*)
procedure Local;
begin
end;
begin
end.
One simple solution is to remove any unused variable from your procedures. However, unused variables can also indicate an
error in the implementation of your algorithm.
procedure Simple;
var
I : Integer;
begin
Writeln(I); (*<-- Warning here*)
end;
499
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
procedure IfStatement;
var
I : Integer;
begin
if B then
I := 42;
Writeln(I); (*<-- Warning here*)
end;
procedure CaseStatement;
var
I: Integer;
begin
case C of
Red..Blue: I := 42;
end;
Writeln(I); (*<-- Warning here*)
end;
procedure TryStatement;
var
I: Integer;
begin
try
I := 42;
except
Writeln('Should not get here!');
end;
Writeln(I); (*<-- Warning here*)
end;
begin
B := False;
end.
In an if statement, you have to make sure the variable is assigned in both branches. In a case statement, you need to add an
else part to make sure the variable is assigned a value in every conceivable case. In a try-except construct, the compiler
assumes that assignments in the try part may in fact not happen, even if they are at the very beginning of the try part and so
simple that they cannot conceivably cause an exception.
program Solve;
(*$WARNINGS ON*)
var
B: Boolean;
C: (Red,Green,Blue);
procedure Simple;
var
I : Integer;
begin
I := 42;
Writeln(I);
end;
procedure IfStatement;
3 var
I : Integer;
begin
if B then
I := 42
else
I := 0;
Writeln(I); (*Need to assign I in the else part
end;
procedure CaseStatement;
500
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
var
I: Integer;
begin
case C of
Red..Blue: I := 42;
else I := 0;
end;
Writeln(I); (*Need to assign I in the else part*)
end;
procedure TryStatement;
var
I: Integer;
begin
I := 0;
try
I := 42;
except
Writeln('Should not get here!');
end;
Writeln(I); (*Need to assign I before the try*)
end;
begin
B := False;
end.
The solution is to either add assignments to the code paths where they were missing, or to add an assignment before a
conditional statement or a try-except construct.
var
str : String;
len : Integer;
begin
str := 'Kojo no tsuki';
len := str[0];
end.
Here the program is attempting to get the length of the string by directly accessing the first element. This is not legal.
program Solve;
var
str : String;
len : Integer;
begin 3
str := 'Kojo no tsuki';
len := Length(str);
end.
You can use the SetLength and Length standard procedures to provide the same functionality as directly accessing the first
element of the string. If hints are turned on, you will receive a warning about the value of 'len' not being used.
501
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
3.1.2.1.494 E2255: New not supported for dynamic arrays - use SetLength
The program has attempted to use the standard procedure NEW on a dynamic array. The proper method for allocating dynamic
arrays is to use the standard procedure SetLength.
program Produce;
var
arr : array of integer;
begin
new(arr, 10);
end.
The standard procedure NEW cannot be used on dynamic arrays.
program Solve;
var
arr : array of integer;
begin
SetLength(arr, 10);
end.
Use the standard procedure SetLength to allocate dynamic arrays.
502
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
This can happen because either the variable is not used anymore, or because it is reassigned before it is used.
program Produce;
(*$HINTS ON*)
procedure Simple;
var
I: Integer;
begin
I := 42; (*<-- Hint message here*)
end;
procedure Propagate;
var
I: Integer;
K: Integer;
begin
I := 0; (*<-- Hint message here*)
Inc(I); (*<-- Hint message here*)
K := 42;
while K > 0 do begin
if Odd(K) then
Inc(I); (*<-- Hint message here*)
Dec(K);
end;
end;
procedure TryFinally;
var
I: Integer;
begin
I := 0; (*<-- Hint message here*)
try
I := 42;
finally
Writeln('Reached finally');
end;
Writeln(I); (*Will always write 42 - if an exception happened,
we wouldn't get here*)
end;
begin
end.
In procedure Propagate, the compiler is smart enough to realize that as variable I is not used after the while loop, it does not
need to be incremented inside the while, and therefore the increment and the assignment before the while loop are also
superfluous.
In procedure TryFinally, the assignment to I before the try-finally construct is not necessary. If an exception happens, we don't 3
execute the Writeln statement at the end, so the value of I does not matter. If no exception happens, the value of I seen by the
Writeln statement is always 42. So the first assignment will not change the behavior of the procedure, and can therefore be
eliminated.
This hint message does not indicate your program is wrong - it just means the compiler has determined there is an assignment
that is not necessary.
You can usually just delete this assignment - it will be dropped in the compiled code anyway if you compile with optimizations on.
503
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
Sometimes, however, the real problem is that you assigned to the wrong variable, for example, you meant to assign J but
instead assigned I. So it is worthwhile to check the assignment in question carefully.
var
I : Integer;
J : Integer absolute Addr(I); (*<-- Error message here*)
begin
end.
program Solve;
const
Addr = 0;
var
I : Integer;
J : Integer absolute I;
begin
end.
The only solution is to only attempt to view variables which are known to have live values.
504
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
3.1.2.1.503 E2033: Types of actual and formal var parameters must be identical
For a variable parameter, the actual argument must be of the exact type of the formal parameter.
program Produce;
var
C1, C2: 0..255; (*Similar to a byte, but NOT identical*)
begin
SwapBytes(C1,C2); (*<-- Error message here*)
end.
Arguments C1 and C2 are not acceptable to SwapBytes, although they have the exact memory representation and range that a
Byte has.
program Solve;
var
C1, C2: Byte;
begin
SwapBytes(C1,C2); (*<-- No error message here*)
end.
So you actually have to declare C1 and C2 as Bytes to make this example compile.
There are several possible solutions - recompile Unit1 (assuming you have the source code available), use an older version of
Unit2 or change Unit2, or get a new version of Unit1 from whoever has the source code. 3
This error can also occur when a unit in your project has the same name as a standard Delphi unit.
For example, this may occur is when compiling a project written in a previous version of Delphi that did not have a unit of this
name (for example, search.pas was not in Delphi 3).
505
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
2. Alter all references to <Unit2> in uses clauses to refer to the new name.
3. Delete the old <Unit2>.pas AND <Unit2>.dcu versions of this unit.
4. Rebuild the project.
{$APPTYPE CONSOLE}
type
TBar = class
property Bar: Void;
end;
var
TFoo: ^Void;
end.
initialization
Title := 'Tiny Calc';
finalization
end.
506
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
In the above example, there are two problems: Title is a global variable, and Title is initialized in the initialization section of the
unit.
There are only two alternatives: either remove the $weakpackageunit directive from the unit, or remove all global data,
initialization and finalization code.
The only solutions to this problem are to remove the $WEAKPACKAGEUNIT mark, or remove the global data from the unit
before it is put into the package.
To accomodate existing code that uses this "Set of Char" syntax, the compiler will treat the expression as "set of AnsiChar". The
warning message reminds you that the set can only store the boolean state of 256 distinct elements, not the full range of the
Char type.
507
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
3.1.2.1.513 W1206: XML comment on '%s' has cref attribute '%s' that could not
be resolved
This warning message occurs when the XML has a cref attribute that cannot be resolved.
This is a warning in XML documentation processing. The XML is well formed, but the comment's meaning is questionable. XML
cref references follow the .NET style. See http://msdn2.microsoft.com/en-us/library/acd0tfbe.aspx for more details. A
documentation warning does not prevent building.
This is an error in XML documentation processing. The XML is not well formed. This is a warning because a documentation error
does not prevent building.
3.1.2.1.515 W1204: XML comment on '%s' has badly formed XML--'A name
contained an invalid character.'
This warning message occurs when a name in XML contains an invalid character.
This is an error in XML documentation processing. The XML is not well formed. This is a warning because a documentation error
does not prevent building.
3.1.2.1.516 W1203: XML comment on '%s' has badly formed XML--'A name was
started with an invalid character.'
This warning message occurs when an XML name was started with an invalid character.
This is an error in XML documentation processing. The XML is not well formed. This is a warning because a documentation error
does not prevent building.
3.1.2.1.517 W1208: Parameter '%s' has no matching param tag in the XML
comment for '%s' (but other parameters do)
This warning message occurs when an XML Parameter has no matching param tag in the XML comment but other parameters
do.
This is a warning in XML documentation processing. There is at least one tag, but some parameters in the method don't have a
tag. A documentation warning does not prevent building.
3
3.1.2.1.518 W1207: XML comment on '%s' has a param tag for '%s', but there is
no parameter by that name
This warning message occurs when the XML contains a parameter tag for a nonexistent parameter.
This is a warning in XML documentation processing. The XML is well formed, however, a tag was created for a parameter that
doesn't exist in a method. A documentation warning does not prevent building.
508
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
This is an error in XML documentation processing. The XML is not well formed. This is a warning because a documentation error
does not prevent building.
This is an error in XML documentation processing. The XML is not well formed. This is a warning because a documentation error
does not prevent building.
begin
p0(0);
end.
In this example, the procedure p0 is declared to take a Pointer parameter yet the constant 0 is passed. The compiler will perform
the necessary conversions internally, changing 0 into NIL, so that the code will function properly.
program Solve;
begin
p0(NIL);
end.
There are two approaches to solving this problem. In the case above the constant 0 has been replaced with NIL. Alternatively the
procedure definition could be changed so that the parameter type is of Integer type.
3
3.1.2.2 Delphi Runtime Errors
Certain errors at runtime cause Delphi programs to display an error message and terminate.
509
Delphi Compiler Errors RAD Studio (Common) 3.1 Delphi Reference
where nnn is the runtime error number, and xxxxxxxx is the runtime error address.
Applications that use the SysUtils class map most runtime errors to Exceptions, which allow your application to resolve the error
without terminating.
See Also
Exception handling ( see page 541)
510
3.1 Delphi Reference RAD Studio (Common) Delphi Compiler Errors
Exception mapping
In applications that use the SysUtils class (as most GUI applications do), these errors are mapped to exceptions. For a
description of the conditions that produce each error, see the documentation for the exception.
511
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
See Also
Exception handling ( see page 541)
OS error codes
OS error codes are the return value of operating system function calls. You can obtain the error code for the last error that
occurred by calling the global GetLastError function. If you want to raise an exception rather than fetch the error code for the last
API call that failed, call the RaiseLastOSError procedure instead.
The error code values returned by GetLastError are dependent on the operating system. You can obtain an error string
associated with one of these error codes by calling the global SysErrorMessage function.
See Also
Exception handling ( see page 541)
Topics
Name Description
Classes and Objects ( see page 513) This section describes the object-oriented features of the Delphi language, such
as the declaration and usage of class types.
Data Types, Variables, and Constants ( see page 552) This section describes the fundamental data types of the Delphi language.
.NET Topics ( see page 593) This section contains information specific to programming in Delphi on the .NET
platform.
512
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Generics (Parameterized Types) ( see page 595) Presents an overview of generics, a terminology list, a summary of grammar
changes for generics, and details about declaring and using parameterized
types, specifying constraints on generics, and using overloads.
Inline Assembly Code (Win32 Only) ( see page 609) This section describes the use of the inline assembler on the Win32 platform.
Object Interfaces ( see page 624) This section describes the use of interfaces in Delphi.
Libraries and Packages ( see page 634) This section describes how to create static and dynamically loadable libraries in
Delphi.
Memory Management ( see page 644) This section describes memory management issues related to programming in
Delphi on Win32, and on .NET.
Delphi Overview ( see page 656) This chapter provides a brief introduction to Delphi programs, and program
organization.
Procedures and Functions ( see page 662) This section describes the syntax of function and procedure declarations.
Program Control ( see page 678) This section describes how parameters are passed to procedures and functions.
Programs and Units ( see page 682) This chapter provides a more detailed look at Delphi program organization.
Standard Routines and I/O ( see page 692) This section describes the standard routines included in the Delphi runtime library.
Fundamental Syntactic Elements ( see page 700) This section describes the fundamental syntactic elements, or the building blocks
of the Delphi language.
Topics
Name Description
Classes and Objects ( see page 514) This topic covers the following material:
• Property access
• Array properties 3
• Index specifiers
• Storage specifiers
• Property overrides and redeclarations
• Class properties
513
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Events ( see page 536) This topic describes the following material:
• A field is essentially a variable that is part of an object. Like the fields of a record, a class' fields represent data items that exist
in each instance of the class.
• A method is a procedure or function associated with a class. Most methods operate on objects, that is, instances of a class.
Some methods (called class methods) operate on class types themselves.
• A property is an interface to data associated with an object (often stored in a field). Properties have access specifiers, which
3 determine how their data is read and modified. From other parts of a program outside of the object itself a property appears in
most respects like a field.
Objects are dynamically allocated blocks of memory whose structure is determined by their class type. Each object has a unique
copy of every field defined in the class, but all instances of a class share the same methods. Objects are created and
destroyed by special methods called constructors and destructors.
A variable of a class type is actually a pointer that references an object. Hence more than one variable can refer to the same
object. Like other pointers, class-type variables can hold the value nil. But you don't have to explicitly dereference a
class-type variable to access the object it points to. For example, SomeObject.Size := 100 assigns the value 100 to the
514
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Size property of the object referenced by SomeObject; you would not write this as SomeObject^.Size := 100.
A class type must be declared and given a name before it can be instantiated. (You cannot define a class type within a variable
declaration.) Declare classes only in the outermost scope of a program or unit, not in a procedure or function declaration.
A class type declaration has the form
type
className = class [abstract | sealed] (ancestorClass)
memberList
end;
where className is any valid identifier, the sealed or abstract keyword is optional, (ancestorClass) is optional, and memberList
declares members - that is, fields, methods, and properties - of the class. If you omit (ancestorClass), then the new class inherits
directly from the predefined TObject class. If you include (ancestorClass) and memberList is empty, you can omit end. A class
type declaration can also include a list of interfaces implemented by the class; see Implementing Interfaces ( see page 627).
If a class is marked sealed, then it cannot be extended through inheritance. If a class is marked abstract, then it cannot be
instantiated directly using the Create constructor. An entire class can be declared abstract even if it does not contain any
abstract virtual methods ( see page 521). A class cannot be both abstract and sealed.
Methods appear in a class declaration as function or procedure headings, with no body. Defining declarations for each method
occur elsewhere in the program.
For example, here is the declaration of the TMemoryStream class from the Classes unit.
type TMemoryStream = class(TCustomMemoryStream)
private
FCapacity: Longint;
procedure SetCapacity(NewCapacity: Longint);
protected
function Realloc(var NewCapacity: Longint): Pointer; virtual;
property Capacity: Longint read FCapacity write SetCapacity;
public
destructor Destroy; override;
procedure Clear;
procedure LoadFromStream(Stream: TStream);
procedure LoadFromFile(const FileName: string);
procedure SetSize(NewSize: Longint); override;
function Write(const Buffer; Count: Longint): Longint; override;
end;
TMemoryStream descends from TCustomMemoryStream (in the Classes unit), inheriting most of its members. But it defines -
or redefines - several methods and properties, including its destructor method, Destroy. Its constructor, Create, is inherited
without change from TObject, and so is not redeclared. Each member is declared as private, protected, or public (this class
has no published members). These terms are explained below.
The scope of a member's identifier starts at the point where the member is declared, continues to the end of the class
declaration, and extends over all descendants of the class and the blocks of all methods defined in the class and its descendants.
515
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Object Types
The Win32 Delphi compiler allows an alternative syntax to class types, which you can declare object types using the syntax
type objectTypeName = object (ancestorObjectType)
memberList
end;
where objectTypeName is any valid identifier, (ancestorObjectType) is optional, and memberList declares fields, methods, and
properties. If (ancestorObjectType) is omitted, then the new type has no ancestor. Object types cannot have published members.
Since object types do not descend from TObject, they provide no built-in constructors, destructors, or other methods. You can
create instances of an object type using the New procedure and destroy them with the Dispose procedure, or you can simply
declare variables of an object type, just as you would with records.
Object types are supported for backward compatibility only. Their use is not recommended on Win32, and they have been
completely deprecated in the Delphi for .NET compiler.
516
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
If a member's declaration appears without its own visibility specifier, the member has the same visibility as the one that precedes
it. Members at the beginning of a class declaration that don't have a specified visibility are by default published, provided the
class is compiled in the {$M+} state or is derived from a class compiled in the {$M+} state; otherwise, such members are
public.
For readability, it is best to organize a class declaration by visibility, placing all the private members together, followed by all the
protected members, and so forth. This way each visibility reserved word appears at most once and marks the beginning of a
new 'section' of the declaration. So a typical class declaration should like this:
type
TMyClass = class(TControl)
private
... { private declarations here }
protected
... { protected declarations here }
public
... { public declarations here }
published
... { published declarations here }
end;
You can increase the visibility of a member in a descendant class by redeclaring it, but you cannot decrease its visibility. For
example, a protected property can be made public in a descendant, but not private. Moreover, published members cannot
become public in a descendant class. For more information, see Property overrides and redeclarations ( see page 530).
A protected member is visible anywhere in the module where its class is declared and from any descendant class, regardless of
the module where the descendant class appears. A protected method can be called, and a protected field or property read or
written to, from the definition of any method belonging to a class that descends from the one where the protected member is
declared. Members that are intended for use only in the implementation of derived classes are usually protected.
Class members with strict private visibility are accessible only within the class in which they are declared. They are not visible
to procedures or functions declared within the same unit. Class members with strict protected visibility are visible within the
class in which they are declared, and within any descendant class, regardless of where it is declared. Furthermore, when
instance members (those declared without the class or class var keywords) are declared strict private or strict protected,
they are inaccessible outside of the instance of a class in which they appear. An instance of a class cannot access strict 3
protected or strict protected instance members in other instances of the same class.
Delphi's traditional private visibility specifier maps to the CLR's assembly visibility. Delphi's protected visibility specifier maps
to the CLR's assembly or family visibility.
Note: The word strict is treated as a directive within the context of a class declaration. Within a class declaration you cannot
declare a member named 'strict', but it is acceptable for use outside of a class declaration.
517
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Published Members
Published members have the same visibility as public members. The difference is that runtime type information (RTTI) is
generated for published members. RTTI allows an application to query the fields and properties of an object dynamically and to
locate its methods. RTTI is used to access the values of properties when saving and loading form files, to display properties in
the Object Inspector, and to associate specific methods (called event handlers) with specific properties (called events).
Published properties are restricted to certain data types. Ordinal, string, class, interface, variant, and method-pointer types can
be published. So can set types, provided the upper and lower bounds of the base type have ordinal values between 0 and 31. (In
other words, the set must fit in a byte, word, or double word.) Any real type except Real48 can be published. Properties of an
array type (as distinct from array properties, discussed below) cannot be published.
Some properties, although publishable, are not fully supported by the streaming system. These include properties of record
types, array properties ( see page 530) of all publishable types, and properties of enumerated types ( see page 554) that
include anonymous values. If you publish a property of this kind, the Object Inspector won't display it correctly, nor will the
property's value be preserved when objects are streamed to disk.
All methods are publishable, but a class cannot publish two or more overloaded methods with the same name. Fields can be
published only if they are of a class or interface type.
A class cannot have published members unless it is compiled in the {$M+} state or descends from a class compiled in the
{$M+} state. Most classes with published members derive from TPersistent, which is compiled in the {$M+} state, so it is
seldom necessary to use the $M directive.
Note: Identifiers that contain Unicode characters are not allowed in published sections of classes, or in types used by published
members.
• The types of all properties, array property parameters, method parameters, and function results must be automatable. The
automatable types are Byte, Currency, Real, Double, Longint, Integer, Single, Smallint, AnsiString, WideString,
TDateTime, Variant, OleVariant, WordBool, and all interface types.
• Method declarations must use the default register calling convention. They can be virtual, but not dynamic.
• Property declarations can include access specifiers (read and write) but other specifiers (index, stored, default, and
nodefault) are not allowed. Access specifiers must list a method identifier that uses the default register calling convention;
field identifiers are not allowed.
• Property declarations must specify a type. Property overrides are not allowed.
The declaration of an automated method or property can include a dispid directive. Specifying an already used ID in a dispid
directive causes an error.
3 On the Win32 platform, this directive must be followed by an integer constant that specifies an Automation dispatch ID for the
member. Otherwise, the compiler automatically assigns the member a dispatch ID that is one larger than the largest dispatch
ID used by any method or property in the class and its ancestors. For more information about Automation (on Win32 only),
see Automation objects ( see page 633).
Forward Declarations and Mutually Dependent Classes
If the declaration of a class type ends with the word class and a semicolon - that is, if it has the form
518
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
with no ancestor or class members listed after the word class, then it is a forward declaration. A forward declaration must be
resolved by a defining declaration of the same class within the same type declaration section. In other words, between a forward
declaration and its defining declaration, nothing can occur except other type declarations.
3.1.3.1.2 Fields
This topic describes the syntax of class data fields declarations.
About Fields
A field is like a variable that belongs to an object. Fields can be of any type, including class types. (That is, fields can hold object
references.) Fields are usually private.
3
To define a field member of a class, simply declare the field as you would a variable. For example, the following declaration
creates a class called TNumber whose only member, other than the methods is inherits from TObject, is an integer field called
Int.
type
TNumber = class
var
Int: Integer;
end;
519
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
The var keyword is optional. However, if it is not used, then all field declarations must occur before any property or method
declarations. After any property or method declarations, the var may be used to introduce any additional field declarations.
Fields are statically bound; that is, references to them are fixed at compile time. To see what this means, consider the following
code.
type
TAncestor = class
Value: Integer;
end;
TDescendant = class(TAncestor)
Value: string; // hides the inherited Value field
end;
var
MyObject: TAncestor;
begin
MyObject := TDescendant.Create;
MyObject.Value := 'Hello!' // error
Constants ( see page 589), and typed constant ( see page 589) declarations can appear in classes and non-anonymous
records at global scope. Both constants and typed constants can also appear within nested type ( see page 546) definitions.
Constants and typed constants can appear only within class definitions when the class is defined locally to a procedure (i.e. they
cannot appear within records defined within a procedure).
Class Fields
Class fields are data fields in a class that can be accessed without an object reference (unlike the normal “instance fields” which
are discussed above). The data stored in a class field are shared by all instances of the class and may be accessed by referring
to the class or to a variable that represents an instance of the class.
You can introduce a block of class fields within a class declaration by using the class var block declaration. All fields declared
after class var have static storage attributes. A class var block is terminated by the following:
3 type
TMyClass = class
public
class var // Introduce a block of class static fields.
Red: Integer;
Green: Integer;
Blue: Integer;
var // Ends the class var block.
InstanceField: Integer;
end;
520
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
The class fields Red, Green, and Blue can be accessed with the code:
TMyClass.Red := 1;
TMyClass.Green := 2;
TMyClass.Blue := 3;
Class fields may also be accessed through an instance of the class. With the following declaration:
var
myObject: TMyClass;
This code has the same effect as the assignments to Red, Green, and Blue above:
myObject.Red := 1;
myObject.Green := 2;
myObject.Blue := 3;
See Also
Classes and Objects ( see page 514)
3.1.3.1.3 Methods
A method is a procedure or function associated with a class. A call to a method specifies the object (or, if it is a class method, the
class) that the method should operate on. For example, SomeObject.Free calls the Free method in SomeObject.
521
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
begin
...
end;
While a class can be declared in either the interface or the implementation section of a unit, defining declarations for a class'
methods must be in the implementation section.
In the heading of a defining declaration, the method name is always qualified with the name of the class to which it belongs. The
heading can repeat the parameter list from the class declaration; if it does, the order, type and names of the parameters must
match exactly, and if the method is a function, the return value must match as well.
Method declarations can include special directives that are not used with other functions or procedures. Directives should appear
in the class declaration only, not in the defining declaration, and should always be listed in the following order:
where binding is virtual, dynamic, or override; calling convention is register, pascal, cdecl, stdcall, or safecall; and warning
is platform, deprecated, or library.
Inherited
The reserved word inherited plays a special role in implementing polymorphic behavior. It can occur in method definitions, with
or without an identifier after it.
If inherited is followed by the name of a member, it represents a normal method call or reference to a property or field - except
that the search for the referenced member begins with the immediate ancestor of the enclosing method's class. For example,
when
inherited Create(...);
occurs in the definition of a method, it calls the inherited Create.
When inherited has no identifier after it, it refers to the inherited method with the same name as the enclosing method or, if the
enclosing method is a message handler, to the inherited message handler for the same message. In this case, inherited takes
no explicit parameters, but passes to the inherited method the same parameters with which the enclosing method was called.
For example,
inherited;
occurs frequently in the implementation of constructors. It calls the inherited constructor with the same parameters that were
passed to the descendant.
Self
Within the implementation of a method, the identifier Self references the object in which the method is called. For example, here
is the implementation of TCollection's Add method in the Classes unit.
function TCollection.Add: TCollectionItem;
begin
Result := FItemClass.Create(Self);
end;
The Add method calls the Create method in the class referenced by the FItemClass field, which is always a TCollectionItem
3 descendant. TCollectionItem.Create takes a single parameter of type TCollection, so Add passes it the TCollection
instance object where Add is called. This is illustrated in the following code.
var MyCollection: TCollection;
...
MyCollection.Add // MyCollection is passed to the TCollectionItem.Create method
Self is useful for a variety of reasons. For example, a member identifier declared in a class type might be redeclared in the block
of one of the class' methods. In this case, you can access the original member identifier as Self.Identifier.
522
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
For information about Self in class methods, see Class methods ( see page 539).
Method Binding
Method bindings can be static (the default), virtual, or dynamic. Virtual and dynamic methods can be overridden, and they can
be abstract. These designations come into play when a variable of one class type holds a value of a descendant class type.
They determine which implementation is activated when a method is called.
Static Methods
Methods are by default static. When a static method is called, the declared (compile-time) type of the class or object variable
used in the method call determines which implementation to activate. In the following example, the Draw methods are static.
type
TFigure = class
procedure Draw;
end;
TRectangle = class(TFigure)
procedure Draw;
end;
Given these declarations, the following code illustrates the effect of calling a static method. In the second call to Figure.Draw,
the Figure variable references an object of class TRectangle, but the call invokes the implementation of Draw in TFigure,
because the declared type of the Figure variable is TFigure.
var
Figure: TFigure;
Rectangle: TRectangle;
begin
Figure := TFigure.Create;
Figure.Draw; // calls TFigure.Draw
Figure.Destroy;
Figure := TRectangle.Create;
Figure.Draw; // calls TFigure.Draw
Figure.Destroy;
Rectangle := TRectangle.Create;
Rectangle.Draw; // calls TRectangle.Draw
Rectangle.Destroy;
end;
To override a method, redeclare it with the override directive. An override declaration must match the ancestor declaration in 3
the order and type of its parameters and in its result type (if any).
In the following example, the Draw method declared in TFigure is overridden in two descendant classes.
type
TFigure = class
procedure Draw; virtual;
end;
523
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
TRectangle = class(TFigure)
procedure Draw; override;
end;
TEllipse = class(TFigure)
procedure Draw; override;
end;
Given these declarations, the following code illustrates the effect of calling a virtual method through a variable whose actual type
varies at runtime.
var
Figure: TFigure;
begin
Figure := TRectangle.Create;
Figure.Draw; // calls TRectangle.Draw
Figure.Destroy;
Figure := TEllipse.Create;
Figure.Draw; // calls TEllipse.Draw
Figure.Destroy;
end;
Only virtual and dynamic methods can be overridden. All methods, however, can be overloaded; see Overloading methods.
The Delphi compiler also supports the concept of a final virtual method. When the keyword final is applied to a virtual method,
no descendent class can override that method. Use of the final keyword is an important design decision that can help document
how the class is intended to be used. It can also give the compiler hints that allow it to optimize the code it produces.
In general, virtual methods are the most efficient way to implement polymorphic behavior. Dynamic methods are useful when a
base class declares many overridable methods which are inherited by many descendant classes in an application, but only
occasionally overridden.
Note: Only use dynamic methods if there is a clear, observable benefit. Generally, use virtual methods.
T2 = class(T1)
3 procedure Act; // Act is redeclared, but not overridden
end;
var
SomeObject: T1;
begin
SomeObject := T2.Create;
SomeObject.Act; // calls T1.Act
end;
524
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Reintroduce
The reintroduce directive suppresses compiler warnings about hiding previously declared virtual methods. For example,
procedure DoSomething; reintroduce; // the ancestor class also has a DoSomething method
Use reintroduce when you want to hide an inherited virtual method with a new one.
Abstract Methods
An abstract method is a virtual or dynamic method that has no implementation in the class where it is declared. Its
implementation is deferred to a descendant class. Abstract methods must be declared with the directive abstract after virtual or
dynamic. For example,
procedure DoSomething; virtual; abstract;
You can call an abstract method only in a class or instance of a class in which the method has been overridden.
Note: The Delphi for .NET compiler allows an entire class to be declared abstract, even though it does not contain any virtual
abstract methods. See Class Types ( see page 514) for more information.
Class Methods
Most methods are called instance methods, because they operate on an individual instance of an object. A class method is a
method (other than a constructor) that operates on classes instead of objects. There are two types of class methods: ordinary
class methods and class static methods.
A class method can be called through a class reference or an object reference. When it is called through an object reference, the
class of the object becomes the value of Self. 3
Class Static Methods
Like class methods, class static methods can be accessed without an object reference. Unlike ordinary class methods, class
static methods have no Self parameter at all. They also cannot access any instance members. (They still have access to class
fields, class properties, and class methods.) Also unlike class methods, class static methods cannot be declared virtual.
Methods are made class static by appending the word static to their declaration, for example
525
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
type
TMyClass = class
strict private
class var
FX: Integer;
strict protected
public
class property X: Integer read GetX write SetX;
class procedure StatProc(s: String); static;
end;
Like a class method, you can call a class static method through the class type (i.e. without having an object reference), for
example
TMyClass.X := 17;
TMyClass.StatProc('Hello');
Overloading Methods
A method can be redeclared using the overload directive. In this case, if the redeclared method has a different parameter
signature from its ancestor, it overloads the inherited method without hiding it. Calling the method in a descendant class
activates whichever implementation matches the parameters in the call.
If you overload a virtual method, use the reintroduce directive when you redeclare it in descendant classes. For example,
type
T1 = class(TObject)
procedure Test(I: Integer); overload; virtual;
end;
T2 = class(T1)
procedure Test(S: string); reintroduce; overload;
end;
...
SomeObject := T2.Create;
SomeObject.Test('Hello!'); // calls T2.Test
SomeObject.Test(7); // calls T1.Test
Within a class, you cannot publish multiple overloaded methods with the same name. Maintenance of runtime type information
requires a unique name for each published member.
type
TSomeClass = class
published
function Func(P: Integer): Integer;
function Func(P: Boolean): Integer; // error
...
Methods that serve as property read or write specifiers cannot be overloaded.
3 The implementation of an overloaded method must repeat the parameter list from the class declaration. For more information
about overloading, see Overloading procedures and functions ( see page 662).
Constructors
A constructor is a special method that creates and initializes instance objects. The declaration of a constructor looks like a
procedure declaration, but it begins with the word constructor. Examples:
constructor Create;
constructor Create(AOwner: TComponent);
526
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Constructors must use the default register calling convention. Although the declaration specifies no return value, a constructor
returns a reference to the object it creates or is called in.
A class can have more than one constructor, but most have only one. It is conventional to call the constructor Create.
To create an object, call the constructor method on a class type. For example,
MyObject := TMyClass.Create;
This allocates storage for the new object, sets the values of all ordinal fields to zero, assigns nil to all pointer and class-type
fields, and makes all string fields empty. Other actions specified in the constructor implementation are performed next; typically,
objects are initialized based on values passed as parameters to the constructor. Finally, the constructor returns a reference to
the newly allocated and initialized object. The type of the returned value is the same as the class type specified in the constructor
call.
If an exception is raised during execution of a constructor that was invoked on a class reference, the Destroy destructor is
automatically called to destroy the unfinished object.
When a constructor is called using an object reference (rather than a class reference), it does not create an object. Instead, the
constructor operates on the specified object, executing only the statements in the constructor's implementation, and then returns
a reference to the object. A constructor is typically invoked on an object reference in conjunction with the reserved word
inherited to execute an inherited constructor.
Note: For more information on constructors, destructors, and memory management issues on the .NET platform, please see the
topic Memory Management Issues on the .NET Platform ( see page 653).
527
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
There can be no guarantees on when a class constructor will execute, except to say that it will execute at some time before the
class is used. On the .NET platform in order for a class to be "used", it must reside in code that is actually executed. For
example, if a class is first referenced in an if statement, and the test of the if statement is never true during the course of
execution, then the class will never be loaded and JIT compiled. Hence, in this case the class constructor would not be called.
The following class declaration demonstrates the syntax of class properties and fields, as well as class static methods and class
constructors:
type
TMyClass = class
strict protected
When an exception is raised during creation of an object, Destroy is automatically called to dispose of the unfinished object. This
means that Destroy must be prepared to dispose of partially constructed objects. Because a constructor sets the fields of a
new object to zero or empty values before performing other actions, class-type and pointer-type fields in a partially constructed
528
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
object are always nil. A destructor should therefore check for nil values before operating on class-type or pointer-type fields.
Calling the Free method (defined in TObject), rather than Destroy, offers a convenient way of checking for nil values before
destroying an object.
Note: For more information on constructors, destructors, and memory management issues on the .NET platform, please see the
topic Memory Management Issues on the .NET Platform ( see page 653).
Message Methods
Message methods implement responses to dynamically dispatched messages. The message method syntax is supported on all
platforms. VCL uses message methods to respond to Windows messages.
A message method is created by including the message directive in a method declaration, followed by an integer constant
between 1 and 49151 which specifies the message ID. For message methods in VCL controls, the integer constant can be one
of the Win32 message IDs defined, along with corresponding record types, in the Messages unit. A message method must be a
procedure that takes a single var parameter.
For example:
type
TTextBox = class(TCustomControl)
private
procedure WMChar(var Message: TWMChar); message WM_CHAR;
...
end;
A message method does not have to include the override directive to override an inherited message method. In fact, it doesn't
have to specify the same method name or parameter type as the method it overrides. The message ID alone determines which
message the method responds to and whether it is an override.
The implementation of DefaultHandler in TObject simply returns without performing any actions. By overriding
DefaultHandler, a class can implement its own default handling of messages. On Win32, the DefaultHandler method for
controls calls the Win32 API DefWindowProc.
Message Dispatching
Message handlers are seldom called directly. Instead, messages are dispatched to an object using the Dispatch method 3
inherited from TObject:
procedure Dispatch(var Message);
The Message parameter passed to Dispatch must be a record whose first entry is a field of type Word containing a message
ID.
Dispatch searches backward through the class hierarchy (starting from the class of the object where it is called) and invokes
the first message method for the ID passed to it. If no message method is found for the given ID, Dispatch calls
529
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
DefaultHandler.
See Also
Classes and Objects ( see page 514)
3.1.3.1.4 Properties
This topic describes the following material:
• Property access
• Array properties
• Index specifiers
• Storage specifiers
• Property overrides and redeclarations
• Class properties
About Properties
A property, like a field, defines an attribute of an object. But while a field is merely a storage location whose contents can be
examined and changed, a property associates specific actions with reading or modifying its data. Properties provide control over
access to an object's attributes, and they allow attributes to be computed.
The declaration of a property specifies a name and a type, and includes at least one access specifier. The syntax of a property
declaration is
where
530
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Property Access
Every property has a read specifier, a write specifier, or both. These are called access specifiers and they have the form
read fieldOrMethod
write fieldOrMethod
where fieldOrMethod is the name of a field or method declared in the same class as the property or in an ancestor class.
• If fieldOrMethod is declared in the same class, it must occur before the property declaration. If it is declared in an ancestor
class, it must be visible from the descendant; that is, it cannot be a private field or method of an ancestor class declared in a
different unit.
• If fieldOrMethod is a field, it must be of the same type as the property.
• If fieldOrMethod is a method, it cannot be dynamic and, if virtual, cannot be overloaded. Moreover, access methods for a
published property must use the default register calling convention.
• In a read specifier, if fieldOrMethod is a method, it must be a parameterless function whose result type is the same as the
property's type. (An exception is the access method for an indexed property or an array property.)
• In a write specifier, if fieldOrMethod is a method, it must be a procedure that takes a single value or const parameter of the
same type as the property (or more, if it is an array property or indexed property).
For example, given the declaration
property Color: TColor read GetColor write SetColor;
the GetColor method must be declared as
function GetColor: TColor;
and the SetColor method must be declared as one of these:
procedure SetColor(Value: TColor);
procedure SetColor(const Value: TColor);
(The name of SetColor's parameter, of course, doesn't have to be Value.)
When a property is referenced in an expression, its value is read using the field or method listed in the read specifier. When a
property is referenced in an assignment statement, its value is written using the field or method listed in the write specifier.
The example below declares a class called TCompass with a published property called Heading. The value of Heading is read
through the FHeading field and written through the SetHeading procedure.
type
THeading = 0..359;
TCompass = class(TControl)
private
FHeading: THeading;
procedure SetHeading(Value: THeading);
published
property Heading: THeading read FHeading write SetHeading;
...
end;
Given this declaration, the statements
3
if Compass.Heading = 180 then GoingSouth;
Compass.Heading := 135;
correspond to
if Compass.FHeading = 180 then GoingSouth;
Compass.SetHeading(135);
In the TCompass class, no action is associated with reading the Heading property; the read operation consists of retrieving the
value stored in the FHeading field. On the other hand, assigning a value to the Heading property translates into a call to the
531
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
SetHeading method, which, presumably, stores the new value in the FHeading field as well as performing other actions. For
example, SetHeading might be implemented like this:
procedure TCompass.SetHeading(Value: THeading);
begin
if FHeading <> Value then
begin
FHeading := Value;
Repaint; // update user interface to reflect new value
end;
end;
A property whose declaration includes only a read specifier is a read-only property, and one whose declaration includes only a
write specifier is a write-only property. It is an error to assign a value to a read-only property or use a write-only property in an
expression.
Array Properties
Array properties are indexed properties. They can represent things like items in a list, child controls of a control, and pixels of a
bitmap.
The declaration of an array property includes a parameter list that specifies the names and types of the indexes. For example,
property Objects[Index: Integer]: TObject read GetObject write SetObject;
property Pixels[X, Y: Integer]: TColor read GetPixel write SetPixel;
property Values[const Name: string]: string read GetValue write SetValue;
The format of an index parameter list is the same as that of a procedure's or function's parameter list, except that the parameter
declarations are enclosed in brackets instead of parentheses. Unlike arrays, which can use only ordinal-type indexes, array
properties allow indexes of any type.
For array properties, access specifiers must list methods rather than fields. The method in a read specifier must be a function
that takes the number and type of parameters listed in the property's index parameter list, in the same order, and whose result
type is identical to the property's type. The method in a write specifier must be a procedure that takes the number and type of
parameters listed in the property's index parameter list, in the same order, plus an additional value or const parameter of the
same type as the property.
For example, the access methods for the array properties above might be declared as
function GetObject(Index: Integer): TObject;
function GetPixel(X, Y: Integer): TColor;
function GetValue(const Name: string): string;
procedure SetObject(Index: Integer; Value: TObject);
procedure SetPixel(X, Y: Integer; Value: TColor);
procedure SetValue(const Name, Value: string);
An array property is accessed by indexing the property identifier. For example, the statements
if Collection.Objects[0] = nil then Exit;
Canvas.Pixels[10, 20] := clRed;
Params.Values['PATH'] := 'C:\BIN';
correspond to
if Collection.GetObject(0) = nil then Exit;
3 Canvas.SetPixel(10, 20, clRed);
Params.SetValue('PATH', 'C:\BIN');
The definition of an array property can be followed by the default directive, in which case the array property becomes the default
property of the class. For example,
type
TStringArray = class
public
property Strings[Index: Integer]: string ...; default;
...
532
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
end;
If a class has a default property, you can access that property with the abbreviation object[index], which is equivalent to
object.property[index]. For example, given the declaration above, StringArray.Strings[7] can be abbreviated to
StringArray[7]. A class can have only one default property with a given signature (array parameter list), but it is possible to
overload the default property. Changing or hiding the default property in descendant classes may lead to unexpected behavior,
since the compiler always binds to properties statically.
Index Specifiers
Index specifiers allow several properties to share the same access method while representing different values. An index specifier
consists of the directive index followed by an integer constant between -2147483647 and 2147483647. If a property has an
index specifier, its read and write specifiers must list methods rather than fields. For example,
type
TRectangle = class
private
FCoordinates: array[0..3] of Longint;
function GetCoordinate(Index: Integer): Longint;
procedure SetCoordinate(Index: Integer; Value: Longint);
public
property Left: Longint index 0 read GetCoordinate write SetCoordinate;
property Top: Longint index 1 read GetCoordinate write SetCoordinate;
property Right: Longint index 2 read GetCoordinate write SetCoordinate;
property Bottom: Longint index 3 read GetCoordinate write SetCoordinate;
property Coordinates[Index: Integer]: Longint read GetCoordinate write SetCoordinate;
...
end;
An access method for a property with an index specifier must take an extra value parameter of type Integer. For a read function,
it must be the last parameter; for a write procedure, it must be the second-to-last parameter (preceding the parameter that
specifies the property value). When a program accesses the property, the property's integer constant is automatically passed to
the access method.
The stored directive must be followed by True, False, the name of a Boolean field, or the name of a parameterless method that
returns a Boolean value. For example,
property Name: TComponentName read FName write SetName stored False;
If a property has no stored directive, it is treated as if stored True were specified.
The default directive must be followed by a constant of the same type as the property. For example,
3
property Tag: Longint read FTag write FTag default 0;
To override an inherited default value without specifying a new one, use the nodefault directive. The default and nodefault
directives are supported only for ordinal types and for set types, provided the upper and lower bounds of the set's base type
have ordinal values between 0 and 31; if such a property is declared without default or nodefault, it is treated as if nodefault
were specified. For reals, pointers, and strings, there is an implicit default value of 0, nil, and '' (the empty string), respectively.
Note: You can't use the ordinal value 2147483648 has a default value. This value is used internally to represent nodefault
533
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
. When saving a component's state, the storage specifiers of the component's published properties are checked. If a property's
current value is different from its default value (or if there is no default value) and the stored specifier is True, then the
property's value is saved. Otherwise, the property's value is not saved.
Note: Property values are not automatically initialized to the default value. That is, the default directive controls only when
property values are saved to the form file, but not the initial value of the property on a newly created instance.
Storage specifiers are not supported for array properties. The default directive has a different meaning when used in an array
property declaration. See Array Properties, above.
type
TDerived = class(TAncestor)
...
protected
property Size write SetSize;
published
property Text;
property Color stored True default clBlue;
...
end;
The override of Size adds a write specifier to allow the property to be modified. The overrides of Text and Color change the
visibility of the properties from protected to published. The property override of Color also specifies that the property should be
filed if its value isn't clBlue.
A redeclaration of a property that includes a type identifier hides the inherited property rather than overriding it. This means that
a new property is created with the same name as the inherited one. Any property declaration that specifies a type must be a
complete declaration, and must therefore include at least one access specifier.
3
Whether a property is hidden or overridden in a derived class, property look-up is always static. That is, the declared
(compile-time) type of the variable used to identify an object determines the interpretation of its property identifiers. Hence, after
the following code executes, reading or assigning a value to MyObject.Value invokes Method1 or Method2, even though
MyObject holds an instance of TDescendant. But you can cast MyObject to TDescendant to access the descendant class's
properties and their access specifiers.
type
TAncestor = class
534
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
...
property Value: Integer read Method1 write Method2;
end;
TDescendant = class(TAncestor)
...
property Value: Integer read Method3 write Method4;
end;
You can introduce a block of class static fields within a class declaration by using the class var block declaration. All fields
declared after class var have static storage attributes. A class var block is terminated by the following:
535
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
3.1.3.1.5 Events
This topic describes the following material:
In the following example, the TObservedObject class includes an OnPing event, of type TPingEvent. The FOnPing field is
used to store the event handler. The event handler in this example, TListener.Ping, prints 'TListener has been pinged!'.
Program EventDemo;
{$APPTYPE CONSOLE}
type
TPingEvent = procedure of object;
TObservedObject = class
private
FPing: TPingEvent;
public
property OnPing: TPingEvent read FPing write FPing;
end;
TListener = class
procedure Ping;
end;
procedure TListener.Ping;
begin
writeln('TListener has been pinged.');
end;
var
observedObject: TObservedObject;
listener: TListener;
begin
3 observedObject := TObservedObject.Create;
listener := TListener.Create;
observedObject.OnPing := listener.Ping;
536
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
type
TPingEvent = procedure of object;
TObservedObject = class
private
FPing: TPingEvent;
public
property OnPing: TPingEvent read FPing write FPing;
end;
TListener = class
procedure Ping;
end;
procedure TListener.Ping;
begin
writeln('TListener has been pinged.');
end;
procedure TListenerSubclass.Ping2;
begin
self.Ping;
writeln('TListenerSubclass has been pinged.');
end;
var
observedObject: TObservedObject;
listener: TListenerSubclass;
begin
observedObject := TObservedObject.Create;
listener := TListenerSubclass.Create;
observedObject.OnPing := listener.Ping2;
Multicast events are declared using the add and remove keywords to indicate the field or methods that are used to add or
remove event handlers for an event. The Include() and Exclude() standard procedures are used to include and exclude
event handlers at runtime. The following code demonstrates the declaration of an event property that uses multicast events.
Program NETEvents;
537
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
{$APPTYPE CONSOLE}
type
TPingEvent = procedure of object;
TObservedObject = class
private
FPing: TPingEvent;
public
property OnPing: TPingEvent add FPing remove FPing;
end;
TListener = class
procedure Ping;
end;
procedure TListener.Ping;
begin
writeln('TListener has been pinged.');
end;
procedure TListenerSubclass.Ping2;
begin
writeln('TListenerSubclass has been pinged.');
end;
var
observedObject: TObservedObject;
listener: TListener;
listenerSubclass: TListenerSubclass;
testEvent: TPingEvent;
begin
observedObject := TObservedObject.Create;
listener := TListener.Create;
listenerSubclass := TListenerSubclass.Create;
Include(observedObject.OnPing, listener.Ping);
Include(observedObject.OnPing, listenerSubclass.Ping2);
A property which represents a multicast event can not be read or written directly; it can only be accessed through the
Include() and Exclude() standard procedures. To attempt to read, write or execute a property that has been declared with
3 add and remove is an error at compile time. To execute this event directly, the sample code uses the FPing field rather than the
OnPing property.
See Also
Classes and Objects ( see page 514)
538
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Creating events
where type is any class type. The identifier type itself denotes a value whose type is class of type. If type1 is an ancestor of
type2, then class of type2 is assignment-compatible with class of type1. Thus
type TClass = class of TObject;
var AnyObj: TClass;
declares a variable called AnyObj that can hold a reference to any class. (The definition of a class-reference type cannot occur
directly in a variable declaration or parameter list.) You can assign the value nil to a variable of any class-reference type.
To see how class-reference types are used, look at the declaration of the constructor for TCollection (in the Classes unit):
type TCollectionItemClass = class of TCollectionItem;
...
constructor Create(ItemClass: TCollectionItemClass);
This declaration says that to create a TCollection instance object, you must pass to the constructor the name of a class
descending from TCollectionItem.
Class-reference types are useful when you want to invoke a class method or virtual constructor on a class or object whose actual
type is unknown at compile time.
539
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
to call the class's constructor. Because class-type identifiers denote class-reference values, a call to CreateControl can
specify the identifier of the class to create an instance of. For example,
CreateControl(TEdit, 'Edit1', 10, 10, 100, 20);
Constructors called using class references are usually virtual. The constructor implementation activated by the call depends on
the runtime type of the class reference.
Class Operators
Class methods ( see page 521) operate on class references. Every class inherits two class methods from TObject, called
ClassType and ClassParent. These methods return, respectively, a reference to the class of an object and to an object's
immediate ancestor class. Both methods return a value of type TClass (where TClass = class of TObject), which can be
cast to a more specific type. Every class also inherits a method called InheritsFrom that tests whether the object where it is
called descends from a specified class. These methods are used by the is and as operators, and it is seldom necessary to call
them directly.
The is Operator
The is operator, which performs dynamic type checking, is used to verify the actual runtime class of an object. The expression
objectisclass
returns True if object is an instance of the class denoted by class or one of its descendants, and False otherwise. (If object is nil,
the result is False.) If the declared type of object is unrelated to class - that is, if the types are distinct and one is not an ancestor
of the othera compilation error results. For example,
if ActiveControl is TEdit then TEdit(ActiveControl).SelectAll;
This statement casts a variable to TEdit after first verifying that the object it references is an instance of TEdit or one of its
descendants.
The as Operator
The as operator performs checked typecasts. The expression
objectasclass
returns a reference to the same object as object, but with the type given by class. At runtime, object must be an instance of the
class denoted by class or one of its descendants, or be nil; otherwise an exception is raised. If the declared type of object is
unrelated to class - that is, if the types are distinct and one is not an ancestor of the other - a compilation error results. For
example,
with Sender as TButton do
begin
Caption := '&Ok';
OnClick := OkClick;
end;
The rules of operator precedence often require as typecasts to be enclosed in parentheses. For example,
(Sender as TButton).Caption := '&Ok';
3 See Also
Classes and Objects ( see page 514)
540
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
3.1.3.1.7 Exceptions
This topic covers the following material:
When an application uses the SysUtils unit, most runtime errors are automatically converted into exceptions. Many errors that
would otherwise terminate an application - such as insufficient memory, division by zero, and general protection faults - can be
caught and handled.
Exception handling is appropriate for errors whose chances of occurring are low or difficult to assess, but whose consequences
are likely to be catastrophic (such as crashing the application); for error conditions that are complicated or difficult to test for in
if...then statements; and when you need to respond to exceptions raised by the operating system or by routines whose
source code you don't control. Exceptions are commonly used for hardware, memory, I/O, and operating-system errors.
Conditional statements are often the best way to test for errors. For example, suppose you want to make sure that a file exists
before trying to open it. You could do it this way:
try
AssignFile(F, FileName);
Reset(F); // raises an EInOutError exception if file is not found
except
on Exception do ...
end;
But you could also avoid the overhead of exception handling by using
if FileExists(FileName) then // returns False if file is not found; raises no exception
begin
AssignFile(F, FileName); 3
Reset(F);
end;
Assertions provide another way of testing a Boolean condition anywhere in your source code. When an Assert statement fails,
the program either halts with a runtime error or (if it uses the SysUtils unit) raises an EAssertionFailed exception. Assertions
should be used only to test for conditions that you do not expect to occur.
541
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
You can group exceptions into families using inheritance. For example, the following declarations in SysUtils define a family of
exception types for math errors.
type
EMathError = class(Exception);
EInvalidOp = class(EMathError);
EZeroDivide = class(EMathError);
EOverflow = class(EMathError);
EUnderflow = class(EMathError);
Given these declarations, you can define a single EMathError exception handler that also handles EInvalidOp, EZeroDivide,
EOverflow, and EUnderflow.
Exception classes sometimes define fields, methods, or properties that convey additional information about the error. For
example,
type EInOutError = class(Exception)
ErrorCode: Integer;
end;
Raising and Handling Exceptions
To raise an exception object, use an instance of the exception class with a raise statement. For example,
raise EMathError.Create;
In general, the form of a raise statement is
raiseobjectataddress
where object and at address are both optional. When an address is specified, it can be any expression that evaluates to a
pointer type, but is usually a pointer to a procedure or function. For example:
raise Exception.Create('Missing parameter') at @MyFunction;
Use this option to raise the exception from an earlier point in the stack than the one where the error actually occurred.
When an exception is raised - that is, referenced in a raise statement - it is governed by special exception-handling logic. A
raise statement never returns control in the normal way. Instead, it transfers control to the innermost exception handler that can
handle exceptions of the given class. (The innermost handler is the one whose try...except block was most recently entered
but has not yet exited.)
For example, the function below converts a string to an integer, raising an ERangeError exception if the resulting value is outside
a specified range.
function StrToIntRange(const S: string; Min, Max: Longint): Longint;
begin
Result := StrToInt(S); // StrToInt is declared in SysUtils
if (Result < Min) or (Result > Max) then
raise ERangeError.CreateFmt('%d is not within the valid range of %d..%d', [Result, Min,
3 Max]);
end;
Notice the CreateFmt method called in the raise statement. Exception and its descendants have special constructors that
provide alternative ways to create exception messages and context IDs.
A raised exception is destroyed automatically after it is handled. Never attempt to destroy a raised exception manually.
Note: Raising an exception in the initialization section of a unit may not produce the intended result. Normal exception support
comes from the SysUtils unit, which must be initialized before such support is available. If an exception occurs during
542
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
initialization, all initialized units - including SysUtils - are finalized and the exception is re-raised. Then the exception is caught
and handled, usually by interrupting the program. Similarly, raising an exception in the finalization section of a unit may not lead
to the intended result if SysUtils has already been finalized when the exception has been raised.
Try...except Statements
Exceptions are handled within try...except statements. For example,
try
X := Y/Z;
except
on EZeroDivide do HandleZeroDivide;
end;
This statement attempts to divide Y by Z, but calls a routine named HandleZeroDivide if an EZeroDivide exception is raised.
try statementsexceptexceptionBlockend
543
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
on EOverflow do HandleOverflow;
on EMathError do HandleMathError;
end;
An exception handler can specify an identifier before the name of the exception class. This declares the identifier to represent
the exception object during execution of the statement that follows on...do. The scope of the identifier is limited to that
statement. For example,
try
...
except
on E: Exception do ErrorDialog(E.Message, E.HelpContext);
end;
If the exception block specifies an else clause, the else clause handles any exceptions that aren't handled by the block's
exception handlers. For example,
try
...
except
on EZeroDivide do HandleZeroDivide;
on EOverflow do HandleOverflow;
on EMathError do HandleMathError;
else
HandleAllOthers;
end;
Here, the else clause handles any exception that isn't an EMathError.
An exception block that contains no exception handlers, but instead consists only of a list of statements, handles all exceptions.
For example,
try
...
except
HandleException;
end;
Here, the HandleException routine handles any exception that occurs as a result of executing the statements between try
and except.
Re-raising Exceptions
When the reserved word raise occurs in an exception block without an object reference following it, it raises whatever exception
is handled by the block. This allows an exception handler to respond to an error in a limited way and then re-raise the exception.
Re-raising is useful when a procedure or function has to clean up after an exception occurs but cannot fully handle the exception.
For example, the GetFileList function allocates a TStringList object and fills it with file names matching a specified
search path:
function GetFileList(const Path: string): TStringList;
var
I: Integer;
SearchRec: TSearchRec;
begin
3 Result := TStringList.Create;
try
I := FindFirst(Path, 0, SearchRec);
while I = 0 do
begin
Result.Add(SearchRec.Name);
I := FindNext(SearchRec);
end;
except
Result.Free;
544
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
raise;
end;
end;
GetFileList creates a TStringList object, then uses the FindFirst and FindNext functions (defined in SysUtils) to
initialize it. If the initialization fails - for example because the search path is invalid, or because there is not enough memory to fill
in the string list - GetFileList needs to dispose of the new string list, since the caller does not yet know of its existence. For
this reason, initialization of the string list is performed in a try...except statement. If an exception occurs, the statement's
exception block disposes of the string list, then re-raises the exception.
Nested Exceptions
Code executed in an exception handler can itself raise and handle exceptions. As long as these exceptions are also handled
within the exception handler, they do not affect the original exception. However, once an exception raised in an exception
handler propagates beyond that handler, the original exception is lost. This is illustrated by the Tan function below.
type
ETrigError = class(EMathError);
function Tan(X: Extended): Extended;
begin
try
Result := Sin(X) / Cos(X);
except
on EMathError do
raise ETrigError.Create('Invalid argument to Tan');
end;
end;
If an EMathError exception occurs during execution of Tan, the exception handler raises an ETrigError. Since Tan does not
provide a handler for ETrigError, the exception propagates beyond the original exception handler, causing the EMathError
exception to be destroyed. To the caller, it appears as if the Tan function has raised an ETrigError exception.
Try...finally Statements
Sometimes you want to ensure that specific parts of an operation are completed, whether or not the operation is interrupted by
an exception. For example, when a routine acquires control of a resource, it is often important that the resource be released,
regardless of whether the routine terminates normally. In these situations, you can use a try...finally statement.
The following example shows how code that opens and processes a file can ensure that the file is ultimately closed, even if an
error occurs during execution.
Reset(F);
try
... // process file F
finally
CloseFile(F);
end;
The syntax of a try...finally statement is
trystatementList1finallystatementList2end
where each statementList is a sequence of statements delimited by semicolons. The try...finally statement executes the
statements in statementList1 (the try clause). If statementList1 finishes without raising exceptions, statementList2 (the finally 3
clause) is executed. If an exception is raised during execution of statementList1, control is transferred to statementList2; once
statementList2 finishes executing, the exception is re-raised. If a call to the Exit, Break, or Continue procedure causes
control to leave statementList1, statementList2 is automatically executed. Thus the finally clause is always executed, regardless
of how the try clause terminates.
If an exception is raised but not handled in the finally clause, that exception is propagated out of the try...finally
statement, and any exception already raised in the try clause is lost. The finally clause should therefore handle all locally raised
exceptions, so as not to disturb propagation of other exceptions.
545
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
The Exception class has properties called Message and HelpContext that can be used to pass an error description and a
context ID for context-sensitive online documentation. It also defines various constructor methods that allow you to specify the
description and context ID in different ways.
See Also
Classes and Objects ( see page 514)
type
nestedTypeDeclaration
memberList
end;
Nested type declarations are terminated by the first occurance of a non-identifier token, for example, procedure, class, type,
and all visibility scope specifiers.
The normal accessibility rules apply to nested types and their containing types. A nested type can access an instance variable
(field, property, or method) of its container class, but it must have an object reference to do so. A nested type can access class
3 fields, class properties, and class static methods without an object reference, but the normal Delphi visibility rules apply.
Nested types do not increase the size of the containing class. Creating an instance of the containing class does not also create
an instance of a nested type. Nested types are associated with their containing classes only by the context of their declaration.
546
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
strict private
myField: Integer;
public
type
TInnerClass = class
public
myInnerField: Integer;
procedure innerProc;
end;
procedure outerProc;
end;
To implement the innerProc method of the inner class, you must qualify its name with the name of the outer class. For
example
procedure TOuterClass.TInnerClass.innerProc;
begin
...
end;
To access the members of the nested type, use dotted notation as with regular class member access. For example
var
x: TOuterClass;
y: TOuterClass.TInnerClass;
begin
x := TOuterClass.Create;
x.outerProc;
...
y := TOuterClass.TInnerClass.Create;
y.innerProc;
Nested Constants
Constants can be declared in class types in the same manner as nested type sections. Constant sections are terminated by the
same tokens as nested type sections, specifically, reserved words or visibility specifiers. Typed constants are not supported, so
you cannot declare nested constants of value types, such as Currency, or TDateTime.
Nested constants can be of any simple type: ordinal, ordinal subranges, enums, strings, and real types.
begin
writeln(TMyClass.y); // Writes the value of y, 35. 3
end.
See Also
Classes and Objects ( see page 514)
547
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
548
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
No operators other than those listed in the table may be defined on a class or record.
Overloaded operator methods cannot be referred to by name in source code. To access a specific operator method of a specific
class or record, you must use explicit typecasts on all of the operands. Operator identifiers are not included in the class or
record's list of members.
No assumptions are made regarding the distributive or commutative properties of the operation. For binary operators, the first
parameter is always the left operand, and the second parameter is always the right operand. Associativity is assumed to be
left-to-right in the absence of explicit parentheses.
Resolution of operator methods is done over the union of accessible operators of the types used in the operation (note this
includes inherited operators). For an operation involving two different types A and B, if type A has an implicit conversion to B,
and B has an implicit conversion to A, an ambiguity will occur. Implicit conversions should be provided only where absolutely
necessary, and reflexivity should be avoided. It is best to let type B implicitly convert itself to type A, and let type A have no
knowledge of type B (or vice versa).
As a general rule, operators should not modify their operands. Instead, return a new value, constructed by performing the
operation on the parameters.
Overloaded operators are used most often in records (i.e. value types). Very few classes in the .NET framework have
overloaded operators, but most value types do.
549
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
to type TMyClass
class operator Implicit(a: TMyClass): Integer; // Implicit conversion of TMyClass to
Integer
class operator Explicit(a: Double): TMyClass; // Explicit conversion of a Double to
TMyClass
end;
var
x, y: TMyClass;
begin
x := 12; // Implicit conversion from an Integer
y := x + x; // Calls TMyClass.Add(a, b: TMyClass): TMyClass
b := b + 100; // Calls TMyClass.Add(b, TMyClass.Implicit(100))
end;
See Also
Classes and Objects ( see page 514)
Class helpers provide a way to extend a class, but they should not be viewed as a design tool to be used when developing new
code. They should be used solely for their intended purpose, which is language and platform RTL binding.
3
Class Helper Syntax
The syntax for declaring a class helper is:
type
identifierName = class helper [(ancestor list)] for classTypeIdentifierName
memberList
end;
The ancestor list is optional.
550
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
A class helper type may not declare instance data, but class fields ( see page 519) are allowed.
The visibility scope rules and memberList syntax are identical to that of ordinary class types.
You can define and associate multiple class helpers with a single class type. However, only zero or one class helper applies in
any specific location in source code. The class helper defined in the nearest scope will apply. Class helper scope is determined
in the normal Delphi fashion (i.e. right to left in the unit's uses clause).
...
procedure TMyClass.MyProc;
var X: Integer;
begin
X := MyFunc;
end;
...
type
TMyClassHelper = class helper for TMyClass
procedure HelloWorld;
function MyFunc: Integer;
end;
...
procedure TMyClassHelper.HelloWorld;
begin
writeln(Self.ClassName); // Self refers to TMyClass type, not TMyClassHelper
end;
...
var
X: TMyClass;
begin
X := TMyClass.Create; 3
X.MyProc; // Calls TMyClass.MyProc
X.HelloWorld; // Calls TMyClassHelper.HelloWorld
X.MyFunc; // Calls TMyClassHelper.MyFunc
Note that the class helper function MyFunc is called, since the class helper takes precedence over the actual class type.
See Also
Classes and Objects ( see page 514)
551
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Topics
Name Description
Data Types, Variables, and Constants ( see page 553) This topic presents a high-level overview of Delphi data types.
Simple Types ( see page 554) Simple types - which include ordinal types and real types - define ordered sets of
values.
The ordinal types covered in this topic are:
• Integer types
• Character types
• Boolean types
• Enumerated types
• Real (floating point) types
String Types ( see page 561) This topic describes the string data types available in the Delphi language. The
following types are covered:
• Short strings.
• Long strings.
• Wide (Unicode) strings.
Structured Types ( see page 566) Instances of a structured type hold more than one value. Structured types include
sets, arrays, records, and files as well as class, class-reference, and interface
types. Except for sets, which hold ordinal values only, structured types can
contain other structured types; a type can have unlimited levels of structuring.
Note: Typed and untyped file types are not supported with the .NET framework.
By default, the values in a structured type are aligned on word or double-word
boundaries for faster access. When you declare a structured type, you can
include the reserved word packed to implement compressed data storage. For
example,... more ( see page 566)
Pointers and Pointer Types ( see page 575) A pointer is a variable that denotes a memory address. When a pointer holds the
address of another variable, we say that it points to the location of that variable in
memory or to the data stored there. In the case of an array or other structured
type, a pointer holds the address of the first element in the structure. If that
3 address is already taken, then the pointer holds the address to the first element.
Pointers are typed to indicate the kind of data stored at the addresses they hold.
The general-purpose Pointer type can represent a pointer to... more ( see
page 575)
Procedural Types ( see page 578) Procedural types allow you to treat procedures and functions as values that can
be assigned to variables or passed to other procedures and functions.
Variant Types ( see page 580) This topic discusses the use of variant data types.
552
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Type Compatibility and Identity ( see page 583) To understand which operations can be performed on which expressions, we
need to distinguish several kinds of compatibility among types and values. These
include:
• Type identity
• Type compatibility
• Assignment compatibility
Declaring Types ( see page 586) This topic describes the syntax of Delphi type declarations.
Variables ( see page 587) A variable is an identifier whose value can change at runtime. Put differently, a
variable is a name for a location in memory; you can use the name to read or
write to the memory location. Variables are like containers for data, and, because
they are typed, they tell the compiler how to interpret the data they hold.
Declared Constants ( see page 589) Several different language constructions are referred to as 'constants'. There are
numeric constants (also called numerals) like 17, and string constants (also
called character strings or string literals) like 'Hello world!'. Every enumerated
type defines constants that represent the values of that type. There are
predefined constants like True, False, and nil. Finally, there are constants that,
like variables, are created individually by declaration.
Declared constants are either true constants or typed constants. These two kinds
of constant are superficially similar, but they are governed by different rules and
used for different purposes.
About Types
A type is essentially a name for a kind of data. When you declare a variable you must specify its type, which determines the set
of values the variable can hold and the operations that can be performed on it. Every expression returns data of a particular type,
as does every function. Most functions and procedures require parameters of specific types.
The Delphi language is a 'strongly typed' language, which means that it distinguishes a variety of data types and does not always
allow you to substitute one type for another. This is usually beneficial because it lets the compiler treat data intelligently and
validate your code more thoroughly, preventing hard-to-diagnose runtime errors. When you need greater flexibility, however,
there are mechanisms to circumvent strong typing. These include typecasting, pointers, Variants, Variant parts in records, and
absolute addressing of variables.
• Some types are predefined (or built-in); the compiler recognizes these automatically, without the need for a declaration.
Almost all of the types documented in this language reference are predefined. Other types are created by declaration; these
include user-defined types and the types defined in the product libraries.
• Types can be classified as either fundamental or generic. The range and format of a fundamental type is the same in all
implementations of the Delphi language, regardless of the underlying CPU and operating system. The range and format of a
generic type is platform-specific and could vary across different implementations. Most predefined types are fundamental, but
a handful of integer, character, string, and pointer types are generic. It's a good idea to use generic types when possible,
since they provide optimal performance and portability. However, changes in storage format from one implementation of a
generic type to the next could cause compatibility problems - for example, if you are streaming content to a file as raw, binary
data, without type and versioning information.
• Types can be classified as simple, string, structured, pointer, procedural, or variant. In addition, type identifiers themselves 3
can be regarded as belonging to a special 'type' because they can be passed as parameters to certain functions (such as
High, Low, and SizeOf).
• Types can be parameterized , or
The outline below shows the taxonomy of Delphi data types.
simple
ordinal
integer
553
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
character
Boolean
enumerated
subrange
real
string
structured
set
array
record
file
class
class reference
interface
pointer
procedural
Variant
type identifier
The standard function SizeOf operates on all variables and type identifiers. It returns an integer representing the amount of
memory (in bytes) required to store data of the specified type. For example, SizeOf(Longint) returns 4, since a Longint
variable uses four bytes of memory.
Type declarations are illustrated in the topics that follow. For general information about type declarations, see Declaring types (
see page 586).
See Also
Simple Types ( see page 554)
• Integer types
3
• Character types
• Boolean types
• Enumerated types
• Real (floating point) types
Ordinal Types
Ordinal types include integer, character, Boolean, enumerated, and subrange types. An ordinal type defines an ordered set of
554
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
values in which each value except the first has a unique predecessor and each value except the last has a unique successor.
Further, each value has an ordinality which determines the ordering of the type. In most cases, if a value has ordinality n, its
predecessor has ordinality n-1 and its successor has ordinality n+1.
For example, High(Byte) returns 255 because the highest value of type Byte is 255, and Succ(2) returns 3 because 3 is the
successor of 2.
The standard procedures Inc and Dec increment and decrement the value of an ordinal variable. For example, Inc(I) is
equivalent to I := Succ(I) and, if I is an integer variable, to I := I + 1.
Integer Types
An integer type represents a subset of the whole numbers. The generic integer types are Integer and Cardinal; use these
whenever possible, since they result in the best performance for the underlying CPU and operating system. The table below
gives their ranges and storage formats for the Delphi compiler.
Fundamental integer types include Shortint, Smallint, Longint, Int64, Byte, Word, Longword, and UInt64.
555
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
In general, arithmetic operations on integers return a value of type Integer, which is equivalent to the 32-bit Longint. Operations
return a value of type Int64 only when performed on one or more Int64 operand. Hence the following code produces incorrect
results.
var
I: Integer;
J: Int64;
...
I := High(Integer);
J := I + 1;
To get an Int64 return value in this situation, cast I as Int64:
...
J := Int64(I) + 1;
For more information, see Arithmetic operators ( see page 720).
Note: Some standard routines that take integer arguments truncate Int64
values to 32 bits. However, the High, Low, Succ, Pred, Inc, Dec, IntToStr, and IntToHex routines fully support Int64
arguments. Also, the Round, Trunc, StrToInt64, and StrToInt64Def functions return Int64 values. A few routines cannot
take Int64 values at all. When you increment the last value or decrement the first value of an integer type, the result wraps
around the beginning or end of the range. For example, the Shortint type has the range 128..127; hence, after execution of the
code
var I: Shortint;
...
I := High(Shortint);
I := I + 1;
the value of I is 128. If compiler range-checking is enabled, however, this code generates a runtime error.
Character Types
The fundamental character types are AnsiChar and WideChar. AnsiChar values are byte-sized (8-bit) characters ordered
according to the locale character set which is possibly multibyte. AnsiChar was originally modeled after the ANSI character set
(thus its name) but has now been broadened to refer to the current locale character set.
WideChar characters use more than one byte to represent every character. In the current implementations, WideChar is
word-sized (16-bit) characters ordered according to the Unicode character set (note that it could be longer in future
implementations). The first 256 Unicode characters correspond to the ANSI characters.
The generic character type is Char, which is equivalent to AnsiChar on Win32, and to Char on the .NET platform. Because the
implementation of Char is subject to change, it's a good idea to use the standard function SizeOf rather than a hard-coded
constant when writing programs that may need to handle characters of different sizes.
3 Note: The WideChar
type also maps to Char on the .NET platform. A string constant of length 1, such as 'A', can denote a character value. The
predefined function Chr returns the character value for any integer in the range of AnsiChar or WideChar; for example,
Chr(65) returns the letter A.
Character values, like integers, wrap around when decremented or incremented past the beginning or end of their range (unless
range-checking is enabled). For example, after execution of the code
var
556
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Letter: Char;
I: Integer;
begin
Letter := High(Letter);
for I := 1 to 66 do
Inc(Letter);
end;
Letter has the value A (ASCII 65).
Boolean Types
The four predefined Boolean types are Boolean, ByteBool, WordBool, and LongBool. Boolean is the preferred type. The
others exist to provide compatibility with other languages and operating system libraries.
A Boolean variable occupies one byte of memory, a ByteBool variable also occupies one byte, a WordBool variable occupies
two bytes (one word), and a LongBool variable occupies four bytes (two words).
Boolean values are denoted by the predefined constants True and False. The following relationships hold.
A value of type ByteBool, LongBool, or WordBool is considered True when its ordinality is nonzero. If such a value appears in
a context where a Boolean is expected, the compiler automatically converts any value of nonzero ordinality to True.
The previous remarks refer to the ordinality of Boolean values, not to the values themselves. In Delphi, Boolean expressions
cannot be equated with integers or reals. Hence, if X is an integer variable, the statement
if X then ...;
generates a compilation error. Casting the variable to a Boolean type is unreliable, but each of the following alternatives will
work.
if X <> 0 then ...; { use longer expression that returns Boolean value }
Enumerated Types
An enumerated type defines an ordered set of values by simply listing identifiers that denote these values. The values have no
inherent meaning. To declare an enumerated type, use the syntax 3
typetypeName= (val1, ...,valn)
where typeName and each val are valid identifiers. For example, the declaration
type Suit = (Club, Diamond, Heart, Spade);
defines an enumerated type called Suit whose possible values are Club, Diamond, Heart, and Spade, where Ord(Club)
returns 0, Ord(Diamond) returns 1, and so forth.
557
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
When you declare an enumerated type, you are declaring each val to be a constant of type typeName. If the val identifiers are
used for another purpose within the same scope, naming conflicts occur. For example, suppose you declare the type
type TSound = (Click, Clack, Clock)
Unfortunately, Click is also the name of a method defined for TControl and all of the objects in VCL that descend from it. So if
you're writing an application and you create an event handler like
procedure TForm1.DBGridEnter(Sender: TObject);
var Thing: TSound;
begin
...
Thing := Click;
end;
you'll get a compilation error; the compiler interprets Click within the scope of the procedure as a reference to TForm's Click
method. You can work around this by qualifying the identifier; thus, if TSound is declared in MyUnit, you would use
Thing := MyUnit.Click;
A better solution, however, is to choose constant names that are not likely to conflict with other identifiers. Examples:
type
TSound = (tsClick, tsClack, tsClock);
TMyColor = (mcRed, mcBlue, mcGreen, mcYellow, mcOrange);
Answer = (ansYes, ansNo, ansMaybe)
You can use the (val1, ..., valn) construction directly in variable declarations, as if it were a type name:
var MyCard: (Club, Diamond, Heart, Spade);
But if you declare MyCard this way, you can't declare another variable within the same scope using these constant identifiers.
Thus
var Card1: (Club, Diamond, Heart, Spade);
var Card2: (Club, Diamond, Heart, Spade);
generates a compilation error. But
var Card1, Card2: (Club, Diamond, Heart, Spade);
compiles cleanly, as does
type Suit = (Club, Diamond, Heart, Spade);
var
Card1: Suit;
Card2: Suit;
An enumerated type is, in effect, a subrange whose lowest and highest values correspond to the lowest and highest ordinalities
of the constants in the declaration. In the previous example, the Size type has 11 possible values whose ordinalities range from
5 to 15. (Hence the type array[Size] of Char represents an array of 11 characters.) Only three of these values have
names, but the others are accessible through typecasts and through routines such as Pred, Succ, Inc, and Dec. In the
following example, "anonymous" values in the range of Size are assigned to the variable X.
558
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
var X: Size;
X := Small; // Ord(X) = 5
Y := Size(6); // Ord(X) = 6
Inc(X); // Ord(X) = 7
Any value that isn't explicitly assigned an ordinality has ordinality one greater than that of the previous value in the list. If the first
value isn't assigned an ordinality, its ordinality is 0. Hence, given the declaration
type SomeEnum = (e1, e2, e3 = 1);
SomeEnum has only two possible values: Ord(e1) returns 0, Ord(e2) returns 1, and Ord(e3) also returns 1; because e2 and
e3 have the same ordinality, they represent the same value.
Subrange Types
A subrange type represents a subset of the values in another ordinal type (called the base type). Any construction of the form
Low..High, where Low and High are constant expressions of the same ordinal type and Low is less than High, identifies a
subrange type that includes all values between Low and High. For example, if you declare the enumerated type
type TColors = (Red, Blue, Green, Yellow, Orange, Purple, White, Black);
you can then define a subrange type like
type TMyColors = Green..White;
Here TMyColors includes the values Green,Yellow, Orange, Purple, and White.
You can use numeric constants and characters (string constants of length 1) to define subrange types:
type
SomeNumbers = -128..127;
Caps = 'A'..'Z';
When you use numeric or character constants to define a subrange, the base type is the smallest integer or character type that
contains the specified range.
The LowerBound..UpperBound construction itself functions as a type name, so you can use it directly in variable declarations.
For example,
var SomeNum: 1..500;
declares an integer variable whose value can be anywhere in the range from 1 to 500.
The ordinality of each value in a subrange is preserved from the base type. (In the first example, if Color is a variable that holds
the value Green, Ord(Color) returns 2 regardless of whether Color is of type TColors or TMyColors.) Values do not wrap 3
around the beginning or end of a subrange, even if the base is an integer or character type; incrementing or decrementing past
the boundary of a subrange simply converts the value to the base type. Hence, while
type Percentile = 0..99;
var I: Percentile;
...
I := 100;
produces an error,
559
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
...
I := 99;
Inc(I);
assigns the value 100 to I (unless compiler range-checking is enabled).
The use of constant expressions in subrange definitions introduces a syntactic difficulty. In any type declaration, when the first
meaningful character after = is a left parenthesis, the compiler assumes that an enumerated type is being defined. Hence the
code
const
X = 50;
Y = 10;
type
Scale = (X - Y) * 2..(X + Y) * 2;
produces an error. Work around this problem by rewriting the type declaration to avoid the leading parenthesis:
type
Scale = 2 * (X - Y)..(X + Y) * 2;
Real Types
A real type defines a set of numbers that can be represented with floating-point notation. The table below gives the ranges and
storage formats for the fundamental real types on the Win32 platform.
The following table shows how the fundamental real types map to .NET framework types.
The generic type Real, in its current implementation, is equivalent to Double (which maps to Double on .NET).
560
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
type was called Real in earlier versions of Object Pascal. If you are recompiling code that uses the older, six-byte Real type in
Delphi, you may want to change it to Real48. You can also use the {$REALCOMPATIBILITY ON} compiler directive to turn
Real back into the six-byte type. The following remarks apply to fundamental real types.
• Real48 is maintained for backward compatibility. Since its storage format is not native to the Intel processor architecture, it
results in slower performance than other floating-point types. The Real48 type has been deprecated on the .NET platform.
• Extended offers greater precision than other real types but is less portable. Be careful using Extended if you are creating
data files to share across platforms.
• The Comp (computational) type is native to the Intel processor architecture and represents a 64-bit integer. It is classified as
a real, however, because it does not behave like an ordinal type. (For example, you cannot increment or decrement a Comp
value.) Comp is maintained for backward compatibility only. Use the Int64 type for better performance.
• Currency is a fixed-point data type that minimizes rounding errors in monetary calculations. On the Win32 platform, it is
stored as a scaled 64-bit integer with the four least significant digits implicitly representing decimal places. When mixed with
other real types in assignments and expressions, Currency values are automatically divided or multiplied by 10000.
See Also
Data Types ( see page 553)
• Short strings.
• Long strings.
• Wide (Unicode) strings. 3
About String Types
A string represents a sequence of characters. Delphi supports the following predefined string types.
String types
561
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
On the Win32 platform, AnsiString, sometimes called the long string, is the preferred type for most purposes. WideString is the
preferred string type on the .NET platform.
String types can be mixed in assignments and expressions; the compiler automatically performs required conversions. But
strings passed by reference to a function or procedure (as var and out parameters) must be of the appropriate type. Strings can
be explicitly cast to a different string type.
The reserved word string functions like a generic type identifier. For example,
var S: string;
creates a variable S that holds a string. On the Win32 platform, the compiler interprets string (when it appears without a
bracketed number after it) as AnsiString. On the .NET platform, the string type maps to the String class. You can use single
byte character strings on the .NET platform, but you must explicitly declare them to be of type AnsiString.
On the Win32 platform, you can use the {$H-} directive to turn string into ShortString. The {$H-} directive is deprecated on
the .NET platform.
The standard function Length returns the number of characters in a string. The SetLength procedure adjusts the length of a
string.
Comparison of strings is defined by the ordering of the characters in corresponding positions. Between strings of unequal length,
each character in the longer string without a corresponding character in the shorter string takes on a greater-than value. For
example, 'AB' is greater than 'A'; that is, 'AB' > 'A' returns True. Zero-length strings hold the lowest values.
You can index a string variable just as you would an array. If S is a string variable and i an integer expression, S[i] represents
the ith character - or, strictly speaking, the ith byte in S. For a ShortString or AnsiString, S[i] is of type AnsiChar; for a
WideString, S[i] is of type WideChar. For single-byte (Western) locales, MyString[2] := 'A'; assigns the value A to the
second character of MyString. The following code uses the standard AnsiUpperCase function to convert MyString to
uppercase.
var I: Integer;
begin
I := Length(MyString);
while I > 0 do
begin
MyString[I] := AnsiUpperCase(MyString[I]);
I := I - 1;
end;
end;
3 Be careful indexing strings in this way, since overwriting the end of a string can cause access violations. Also, avoid passing
long-string indexes as var parameters, because this results in inefficient code.
You can assign the value of a string constant - or any other expression that returns a string - to a variable. The length of the
string changes dynamically when the assignment is made. Examples:
MyString := 'Hello world!';
MyString := 'Hello' + 'world';
MyString := MyString + '!';
MyString := ' '; { space }
562
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
The Delphi language supports short-string types - in effect, subtypes of ShortString - whose maximum length is anywhere from
0 to 255 characters. These are denoted by a bracketed numeral appended to the reserved word string. For example,
var MyString: string[100];
creates a variable called MyString whose maximum length is 100 characters. This is equivalent to the declarations
type CString = string[100];
var MyString: CString;
Variables declared in this way allocate only as much memory as the type requires - that is, the specified maximum length plus
one byte. In our example, MyString uses 101 bytes, as compared to 256 bytes for a variable of the predefined ShortString
type.
When you assign a value to a short-string variable, the string is truncated if it exceeds the maximum length for the type.
The standard functions High and Low operate on short-string type identifiers and variables. High returns the maximum length of
the short-string type, while Low returns zero.
Long Strings
AnsiString, also called a long string, represents a dynamically allocated string whose maximum length is limited only by
available memory.
A long-string variable is a pointer occupying four bytes of memory. When the variable is empty - that is, when it contains a
zero-length stringthe pointer is nil and the string uses no additional storage. When the variable is nonempty, it points a
dynamically allocated block of memory that contains the string value. The eight bytes before the location contain a 32-bit length
indicator and a 32-bit reference count. This memory is allocated on the heap, but its management is entirely automatic and
requires no user code.
Because long-string variables are pointers, two or more of them can reference the same value without consuming additional
memory. The compiler exploits this to conserve resources and execute assignments faster. Whenever a long-string variable is
destroyed or assigned a new value, the reference count of the old string (the variable's previous value) is decremented and the
reference count of the new value (if there is one) is incremented; if the reference count of a string reaches zero, its memory is
deallocated. This process is called reference-counting. When indexing is used to change the value of a single character in a
string, a copy of the string is made if - but only if - its reference count is greater than one. This is called copy-on-write semantics.
WideString
The WideString type represents a dynamically allocated string of 16-bit Unicode characters. In most respects it is similar to
AnsiString. On Win32, WideString is compatible with the COM BSTR type.
In a multibyte character set (MBCS), some characters are represented by one byte and others by more than one byte. The first
byte of a multibyte character is called the lead byte. In general, the lower 128 characters of a multibyte character set map to the
7-bit ASCII characters, and any byte whose ordinal value is greater than 127 is the lead byte of a multibyte character. The null
value (#0) is always a single-byte character. Multibyte character sets - especially double-byte character sets (DBCS) - are widely
used for Asian languages.
563
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
In the Unicode character set, each character is represented by two bytes. Thus a Unicode string is a sequence not of individual
bytes but of two-byte words. Unicode characters and strings are also called wide characters and wide character strings. The first
256 Unicode characters map to the ANSI character set. The Windows operating system supports Unicode (UCS-2).
The Delphi language supports single-byte and multibyte characters and strings through the Char, PChar, AnsiChar,
PAnsiChar, and AnsiString types. Indexing of multibyte strings is not reliable, since S[i] represents the ith byte (not
necessarily the ith character) in S. However, the standard string-handling functions have multibyte-enabled counterparts that also
implement locale-specific ordering for characters. (Names of multibyte functions usually start with Ansi-. For example, the
multibyte version of StrPos is AnsiStrPos.) Multibyte character support is operating-system dependent and based on the
current locale.
Delphi supports Unicode characters and strings through the WideChar, PWideChar, and WideString types.
For example, the following type declarations could be used to store null-terminated strings.
type
TIdentifier = array[0..15] of Char;
TFileName = array[0..259] of Char;
TMemoText = array[0..1023] of WideChar;
With extended syntax enabled ({$X+}), you can assign a string constant to a statically allocated zero-based character array.
(Dynamic arrays won't work for this purpose.) If you initialize an array constant with a string that is shorter than the declared
length of the array, the remaining characters are set to #0.
564
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
A character pointer can be indexed as if it were an array. In the previous example, MyPointer[0] returns H. The index
specifies an offset added to the pointer before it is dereferenced. (For PWideChar variables, the index is automatically multiplied
by two.) Thus, if P is a character pointer, P[0] is equivalent to P^ and specifies the first character in the array, P[1] specifies
the second character in the array, and so forth; P[-1] specifies the 'character' immediately to the left of P[0]. The compiler
performs no range checking on these indexes.
The StrUpper function illustrates the use of pointer indexing to iterate through a null-terminated string:
function StrUpper(Dest, Source: PChar; MaxLen: Integer): PChar;
var
I: Integer;
begin
I := 0;
while (I < MaxLen) and (Source[I] <> #0) do
begin
Dest[I] := UpCase(Source[I]);
Inc(I);
end;
Dest[I] := #0;
Result := Dest;
end;
In a binary operation, if one operand is a long string and the other a PChar, the PChar operand is converted to a long string.
You can cast a PChar value as a long string. This is useful when you want to perform a string operation on two PChar values.
For example,
S := string(P1) + string(P2);
You can also cast a long string as a null-terminated string. The following rules apply.
• If S is a long-string expression, PChar(S) casts S as a null-terminated string; it returns a pointer to the first character in S. For
example, if Str1 and Str2 are long strings, you could call the Win32 API MessageBox function like this: MessageBox(0,
PChar(Str1), PChar(Str2), MB_OK); 3
• You can also use Pointer(S) to cast a long string to an untyped pointer. But if S is empty, the typecast returns nil.
• PChar(S) always returns a pointer to a memory block; if S is empty, a pointer to #0 is returned.
• When you cast a long-string variable to a pointer, the pointer remains valid until the variable is assigned a new value or goes
out of scope. If you cast any other long-string expression to a pointer, the pointer is valid only within the statement where the
typecast is performed.
• When you cast a long-string expression to a pointer, the pointer should usually be considered read-only. You can safely use
565
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
the pointer to modify the long string only when all of the following conditions are satisfied.
• The expression cast is a long-string variable.
• The string is not empty.
• The string is unique - that is, has a reference count of one. To guarantee that the string is unique, call the SetLength,
SetString, or UniqueString procedure.
• The string has not been modified since the typecast was made.
• The characters modified are all within the string. Be careful not to use an out-of-range index on the pointer.
The same rules apply when mixing WideString values with PWideChar values.
See Also
Data Types ( see page 553)
Note: Typed and untyped file types are not supported with the .NET framework.
By default, the values in a structured type are aligned on word or double-word boundaries for faster access. When you declare a
structured type, you can include the reserved word packed to implement compressed data storage. For example, type
TNumbers = packed array [1..100] of Real;
Using packed slows data access and, in the case of a character array, affects type compatibility (for more information, see
Memory management ( see page 644)).
• Sets
3 • Arrays, including static and dynamic arrays.
• Records
• File types
Sets
A set is a collection of values of the same ordinal type. The values have no inherent order, nor is it meaningful for a value to be
included twice in a set.
The range of a set type is the power set of a specific ordinal type, called the base type; that is, the possible values of the set type
566
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
are all the subsets of the base type, including the empty set. The base type can have no more than 256 possible values, and
their ordinalities must fall between 0 and 255. Any construction of the form
set ofbaseType
Because of the size limitations for base types, set types are usually defined with subranges. For example, the declarations
type
TSomeInts = 1..250;
TIntSet = set of TSomeInts;
create a set type called TIntSet whose values are collections of integers in the range from 1 to 250. You could accomplish the
same thing with
type TIntSet = set of 1..250;
Given this declaration, you can create a sets like this:
var Set1, Set2: TIntSet;
...
Set1 := [1, 3, 5, 7, 9];
Set2 := [2, 4, 6, 8, 10]
You can also use the set of ... construction directly in variable declarations:
var MySet: set of 'a'..'z';
...
MySet := ['a','b','c'];
Other examples of set types include
set of Byte
set of (Club, Diamond, Heart, Spade)
set of Char;
The in operator tests set membership:
if 'a' in MySet then ... { do something } ;
Every set type can hold the empty set, denoted by [].
Arrays
An array represents an indexed collection of elements of the same type (called the base type). Because each element has a
unique index, arrays, unlike sets, can meaningfully contain the same value more than once. Arrays can be allocated statically or
dynamically.
Static Arrays
Static array types are denoted by constructions of the form
array[indexType1, ..., indexTypen] of baseType;
where each indexType is an ordinal type whose range does not exceed 2GB. Since the indexTypes index the array, the number
of elements an array can hold is limited by the product of the sizes of the indexTypes. In practice, indexTypes are usually integer
subranges. 3
In the simplest case of a one-dimensional array, there is only a single indexType. For example,
var MyArray: array [1..100] of Char;
declares a variable called MyArray that holds an array of 100 character values. Given this declaration, MyArray[3] denotes
the third character in MyArray. If you create a static array but don't assign values to all its elements, the unused elements are
still allocated and contain random data; they are like uninitialized variables.
567
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
A one-dimensional, packed, static array of Char values is called a packed string. Packed-string types are compatible with string
types and with other packed-string types that have the same number of elements. See Type compatibility and identity ( see
page 583).
An array type of the form array[0..x] of Char is called a zero-based character array. Zero-based character arrays are
used to store null-terminated strings and are compatible with PChar values. See Working with null-terminated strings ( see
page 561).
Dynamic Arrays
Dynamic arrays do not have a fixed size or length. Instead, memory for a dynamic array is reallocated when you assign a value
to the array or pass it to the SetLength procedure. Dynamic-array types are denoted by constructions of the form
array of baseType
For example,
var MyFlexibleArray: array of Real;
declares a one-dimensional dynamic array of reals. The declaration does not allocate memory for MyFlexibleArray. To
create the array in memory, call SetLength. For example, given the previous declaration,
SetLength(MyFlexibleArray, 20);
allocates an array of 20 reals, indexed 0 to 19. Dynamic arrays are always integer-indexed, always starting from 0.
Dynamic-array variables are implicitly pointers and are managed by the same reference-counting technique used for long
strings. To deallocate a dynamic array, assign nil to a variable that references the array or pass the variable to Finalize; either
of these methods disposes of the array, provided there are no other references to it. Dynamic arrays are automatically released
when their reference-count drops to zero. Dynamic arrays of length 0 have the value nil. Do not apply the dereference operator
(^) to a dynamic-array variable or pass it to the New or Dispose procedure.
If X and Y are variables of the same dynamic-array type, X := Y points X to the same array as Y. (There is no need to allocate
memory for X before performing this operation.) Unlike strings and static arrays, copy-on-write is not employed for dynamic
arrays, so they are not automatically copied before they are written to. For example, after this code executes,
3 var
A, B: array of Integer;
begin
SetLength(A, 1);
A[0] := 1;
B := A;
B[0] := 2;
end;
the value of A[0] is 2. (If A and B were static arrays, A[0] would still be 1.)
568
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Assigning to a dynamic-array index (for example, MyFlexibleArray[2] := 7) does not reallocate the array. Out-of-range
indexes are not reported at compile time.
In contrast, to make an independent copy of a dynamic array, you must use the global Copy function:
var
A, B: array of Integer;
begin
SetLength(A, 1);
A[0] := 1;
B := Copy(A);
B[0] := 2; { B[0] <> A[0] }
end;
When dynamic-array variables are compared, their references are compared, not their array values. Thus, after execution of the
code
var
A, B: array of Integer;
begin
SetLength(A, 1);
SetLength(B, 1);
A[0] := 2;
B[0] := 2;
end;
A = B returns False but A[0] = B[0] returns True.
To truncate a dynamic array, pass it to SetLength, or pass it to Copy and assign the result back to the array variable. (The
SetLength procedure is usually faster.) For example, if A is a dynamic array, A := SetLength(A, 0, 20) truncates all but
the first 20 elements of A.
Once a dynamic array has been allocated, you can pass it to the standard functions Length, High, and Low. Length returns
the number of elements in the array, High returns the array's highest index (that is, Length - 1), and Low returns 0. In the
case of a zero-length array, High returns 1 (with the anomalous consequence that High < Low).
Note: In some function and procedure declarations, array parameters are represented as array of baseType, without any
index types specified. For example,function CheckStrings(A: array of string): Boolean;
This indicates that the function operates on all arrays of the specified base type, regardless of their size, how they are indexed,
or whether they are allocated statically or dynamically.
569
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
makes the third column of Ints five integers long. At this point (even if the other columns haven't been allocated) you can
assign values to the third column - for example, Ints[2,4] := 6.
The following example uses dynamic arrays (and the IntToStr function declared in the SysUtils unit) to create a triangular
matrix of strings.
var
A : array of array of string;
I, J : Integer;
begin
SetLength(A, 10);
for I := Low(A) to High(A) do
begin
SetLength(A[I], I);
for J := Low(A[I]) to High(A[I]) do
A[I,J] := IntToStr(I) + ',' + IntToStr(J) + ' ';
end;
end;
In the syntax, the number of dimensions are specified by using a comma as a placeholder. The actual size is not determined
3 until runtime when you call the New function. There are two forms of the New function: One takes the element type and the size
of the array, and the other takes the element type and an array initializer list. The following code demonstrates both forms:
var
a: array [,,] of integer; // 3 dimensional array
b: array [,] of integer; // 2 dimensional array
c: array [,] of TPoint; // 2 dimensional array of TPoint
begin
a := New(array[3,5,7] of integer); // New taking element type and size of
each dimension.
570
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
b := New(array[,] of integer, ((1,2,3), (4,5,6))); // New taking the element type and
initializer list.
// New taking an initializer list of
TPoint.
c := New(array[,] of TPoint, (((X:1;Y:2), (X:3;Y:4)), ((X:5;Y:6), (X:7;Y:8))));
end.
You can allocate the array by passing variable or constant expressions to the New function:
var
a: array[,] of integer;
r,c: Integer;
begin
r := 4;
c := 17;
begin
SetLength(a, 4,5);
SetLength(b, 3,5,7);
end.
The Copy function can be used to make a copy of an entire array. You cannot use Copy to duplicate a portion of an array.
You cannot pass a dynamically allocated rectangular array to the Low or High functions. This will generate a compile-time error.
Records (traditional)
A record (analogous to a structure in some languages) represents a heterogeneous set of elements. Each element is called a
field; the declaration of a record type specifies a name and type for each field. The syntax of a record type declaration is
type recordTypeName = record
fieldList1: type1;
...
fieldListn: typen;
end
where recordTypeName is a valid identifier, each type denotes a type, and each fieldList is a valid identifier or a
comma-delimited list of identifiers. The final semicolon is optional.
For example, the following declaration creates a record type called TDateRec.
type
TDateRec = record
Year: Integer;
Month: (Jan, Feb, Mar, Apr, May, Jun,
Jul, Aug, Sep, Oct, Nov, Dec);
Day: 1..31;
end;
Each TDateRec contains three fields: an integer value called Year, a value of an enumerated type called Month, and another 3
integer between 1 and 31 called Day. The identifiers Year, Month, and Day are the field designators for TDateRec, and they
behave like variables. The TDateRec type declaration, however, does not allocate any memory for the Year, Month, and Day
fields; memory is allocated when you instantiate the record, like this:
var Record1, Record2: TDateRec;
This variable declaration creates two instances of TDateRec, called Record1 and Record2.
You can access the fields of a record by qualifying the field designators with the record's name:
571
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Record1.Year := 1904;
Record1.Month := Jun;
Record1.Day := 16;
Or use a with statement:
with Record1 do
begin
Year := 1904;
Month := Jun;
Day := 16;
end;
You can now copy the values of Record1's fields to Record2:
Record2 := Record1;
Because the scope of a field designator is limited to the record in which it occurs, you don't have to worry about naming conflicts
between field designators and other variables.
Instead of defining record types, you can use the record ... construction directly in variable declarations:
var S: record
Name: string;
Age: Integer;
end;
However, a declaration like this largely defeats the purpose of records, which is to avoid repetitive coding of similar groups of
variables. Moreover, separately declared records of this kind will not be assignment-compatible, even if their structures are
identical.
To declare a record type with a variant part, use the following syntax.
type recordTypeName = record
fieldList1: type1;
...
fieldListn: typen;
case tag: ordinalType of
constantList1: (variant1);
...
constantListn: (variantn);
end;
The first part of the declaration - up to the reserved word case - is the same as that of a standard record type. The remainder of
the declaration - from case to the optional final semicolon - is called the variant part. In the variant part,
• tag is optional and can be any valid identifier. If you omit tag, omit the colon (:) after it as well.
• ordinalType denotes an ordinal type.
• Each constantList is a constant denoting a value of type ordinalType, or a comma-delimited list of such constants. No value
can be represented more than once in the combined constantLists.
3
• Each variant is a semicolon-delimited list of declarations resembling the fieldList: type constructions in the main part of the
record type. That is, a variant has the form
fieldList1: type1;
...
fieldListn: typen;
where each fieldList is a valid identifier or comma-delimited list of identifiers, each type denotes a type, and the final semicolon is
optional. The types must not be long strings, dynamic arrays, variants (that is, Variant types), or interfaces, nor can they be
structured types that contain long strings, dynamic arrays, variants, or interfaces; but they can be pointers to these types.
572
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Records with variant parts are complicated syntactically but deceptively simple semantically. The variant part of a record
contains several variants which share the same space in memory. You can read or write to any field of any variant at any time;
but if you write to a field in one variant and then to a field in another variant, you may be overwriting your own data. The tag, if
there is one, functions as an extra field (of type ordinalType) in the non-variant part of the record.
Variant parts have two purposes. First, suppose you want to create a record type that has fields for different kinds of data, but
you know that you will never need to use all of the fields in a single record instance. For example,
type
TEmployee = record
FirstName, LastName: string[40];
BirthDate: TDate;
case Salaried: Boolean of
True: (AnnualSalary: Currency);
False: (HourlyWage: Currency);
end;
The idea here is that every employee has either a salary or an hourly wage, but not both. So when you create an instance of
TEmployee, there is no reason to allocate enough memory for both fields. In this case, the only difference between the variants
is in the field names, but the fields could just as easily have been of different types. Consider some more complicated examples:
type
TPerson = record
FirstName, LastName: string[40];
BirthDate: TDate;
case Citizen: Boolean of
True: (Birthplace: string[40]);
False: (Country: string[20];
EntryPort: string[20];
EntryDate, ExitDate: TDate);
end;
type
TShapeList = (Rectangle, Triangle, Circle, Ellipse, Other);
TFigure = record
case TShapeList of
Rectangle: (Height, Width: Real);
Triangle: (Side1, Side2, Angle: Real);
Circle: (Radius: Real);
Ellipse, Other: ();
end;
For each record instance, the compiler allocates enough memory to hold all the fields in the largest variant. The optional tag and
the constantLists (like Rectangle, Triangle, and so forth in the last example) play no role in the way the compiler manages
the fields; they are there only for the convenience of the programmer.
The second reason for variant parts is that they let you treat the same data as belonging to different types, even in cases where
the compiler would not allow a typecast. For example, if you have a 64-bit Real as the first field in one variant and a 32-bit
Integer as the first field in another, you can assign a value to the Real field and then read back the first 32 bits of it as the value
of the Integer field (passing it, say, to a function that requires integer parameters).
Records (advanced)
In addition to the traditional record types, the Delphi language allows more complex and “class-like” record types. In addition to
3
fields, records may have properties and methods (including constructors), class properties, class methods, class fields, and
nested types. For more information on these subjects, see the documentation on Classes and Objects. Here is a sample record
type definition with some “class-like” functionality.
type
TMyRecord = record
type
TInnerColorType = Integer;
var
573
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Red: Integer;
class var
Blue: Integer;
procedure printRed();
constructor Create(val: Integer);
property RedProperty: TInnerColorType read Red write Red;
class property BlueProp: TInnerColorType read Blue write Blue;
end;
procedure TMyRecord.printRed;
begin
writeln('Red: ', Red);
end;
Though records can now share much of the functionality of classes, there are some important differences between classes and
records.
where fileTypeName is any valid identifier and type is a fixed-size type. Pointer types - whether implicit or explicit - are not
allowed, so a file cannot contain dynamic arrays, long strings, classes, objects, pointers, variants, other files, or structured types
that contain any of these.
3 For example,
type
PhoneEntry = record
FirstName, LastName: string[20];
PhoneNumber: string[15];
Listed: Boolean;
end;
PhoneList = file of PhoneEntry;
declares a file type for recording names and telephone numbers.
574
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
You can also use the file of ... construction directly in a variable declaration. For example,
var List1: file of PhoneEntry;
The word file by itself indicates an untyped file:
var DataFile: file;
For more information, see Untyped files ( see page 692).
See Also
Data Types ( see page 553)
Pointers are typed to indicate the kind of data stored at the addresses they hold. The general-purpose Pointer type can
represent a pointer to any data, while more specialized pointer types reference only specific types of data. Pointers occupy four
bytes of memory.
575
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
point to the location of X or Y. Line 5 assigns a value to X, and line 6 assigns the address of X (denoted by @X) to P. Finally, line 7
retrieves the value at the location pointed to by P (denoted by ^P) and assigns it to Y. After this code executes, X and Y have the
same value, namely 17.
The @ operator, which we have used here to take the address of a variable, also operates on functions and procedures. For
more information, see The @ operator ( see page 720) and Procedural types in statements and expressions ( see page 578).
The symbol ^ has two purposes, both of which are illustrated in our example. When it appears before a type identifier
^typeName
it denotes a type that represents pointers to variables of type typeName. When it appears after a pointer variable
pointer^
it dereferences the pointer; that is, it returns the value stored at the memory address held by the pointer.
Our example may seem like a roundabout way of copying the value of one variable to another - something that we could have
accomplished with a simple assignment statement. But pointers are useful for several reasons. First, understanding pointers will
help you to understand the Delphi language, since pointers often operate behind the scenes in code where they don't appear
explicitly. Any data type that requires large, dynamically allocated blocks of memory uses pointers. Long-string variables, for
instance, are implicitly pointers, as are class instance variables. Moreover, some advanced programming techniques require the
use of pointers.
Finally, pointers are sometimes the only way to circumvent Delphi's strict data typing. By referencing a variable with an
all-purpose Pointer, casting the Pointer to a more specific type, and then dereferencing it, you can treat the data stored by any
variable as if it belonged to any type. For example, the following code assigns data stored in a real variable to an integer
variable.
type
PInteger = ^Integer;
var
R: Single;
I: Integer;
P: Pointer;
PI: PInteger;
begin
...
P := @R;
PI := PInteger(P);
I := PI^;
end;
Of course, reals and integers are stored in different formats. This assignment simply copies raw binary data from R to I, without
converting it.
In addition to assigning the result of an @ operation, you can use several standard routines to give a value to a pointer. The New
and GetMem procedures assign a memory address to an existing pointer, while the Addr and Ptr functions return a pointer to a
specified address or variable.
Dereferenced pointers can be qualified and can function as qualifiers, as in the expression P1^.Data^.
3 The reserved word nil is a special constant that can be assigned to any pointer. When nil is assigned to a pointer, the pointer
doesn't reference anything.
Pointer Types
You can declare a pointer to any type, using the syntax
When you define a record or other data type, it might be useful to also to define a pointer to that type. This makes it easy to
manipulate instances of the type without copying large blocks of memory.
576
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Note: You can declare a pointer type before you declare the type it points to.
Standard pointer types exist for many purposes. The most versatile is Pointer, which can point to data of any kind. But a
Pointer variable cannot be dereferenced; placing the ^ symbol after a Pointer variable causes a compilation error. To access
the data referenced by a Pointer variable, first cast it to another pointer type and then dereference it.
Character Pointers
The fundamental types PAnsiChar and PWideChar represent pointers to AnsiChar and WideChar values, respectively. The
generic PChar represents a pointer to a Char (that is, in its current implementation, to an AnsiChar). These character pointers
are used to manipulate null-terminated strings. (See Working with null-terminated strings ( see page 561).)
Type-checked Pointers
The $T compiler directive controls the types of pointer values generated by the @ operator. This directive takes the form of:
{$T+} or {$T-}
In the {$T-} state, the result type of the @ operator is always an untyped pointer that is compatible with all other pointer types.
When @ is applied to a variable reference in the {$T+} state, the type of the result is ^T, where T is compatible only with
pointers to the type of the variable.
See Also 3
Data Types ( see page 553)
577
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
578
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
end;
var
MainForm: TMainForm;
OnClick: TNotifyEvent
we could make the following assignment.
OnClick := MainForm.ButtonClick;
Two procedural types are compatible if they have
In some situations it is less clear how a procedural variable should be interpreted. Consider the statement
if F = MyFunction then ...;
In this case, the occurrence of F results in a function call; the compiler calls the function pointed to by F, then calls the function
MyFunction, then compares the results. The rule is that whenever a procedural variable occurs within an expression, it
represents a call to the referenced procedure or function. In a case where F references a procedure (which doesn't return a
579
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
value), or where F references a function that requires parameters, the previous statement causes a compilation error. To
compare the procedural value of F with MyFunction, use
if @F = @MyFunction then ...;
@F converts F into an untyped pointer variable that contains an address, and @MyFunction returns the address of MyFunction.
To get the memory address of a procedural variable (rather than the address stored in it), use @@. For example, @@F returns
the address of F.
The @ operator can also be used to assign an untyped pointer value to a procedural variable. For example,
var StrComp: function(Str1, Str2: PChar): Integer;
...
@StrComp := GetProcAddress(KernelHandle, 'lstrcmpi');
calls the GetProcAddress function and points StrComp to the result.
Any procedural variable can hold the value nil, which means that it points to nothing. But attempting to call a nil-valued
procedural variable is an error. To test whether a procedural variable is assigned, use the standard function Assigned:
if Assigned(OnClick) then OnClick(X);
See Also
Data Types ( see page 553)
Variants Overview
Sometimes it is necessary to manipulate data whose type varies or cannot be determined at compile time. In these cases, one
option is to use variables and parameters of type Variant, which represent values that can change type at runtime. Variants offer
greater flexibility but consume more memory than regular variables, and operations on them are slower than on statically bound
types. Moreover, illicit operations on variants often result in runtime errors, where similar mistakes with regular variables would
3 have been caught at compile time. You can also create custom variant types.
By default, Variants can hold values of any type except records, sets, static arrays, files, classes, class references, and pointers.
In other words, variants can hold anything but structured types and pointers. They can hold interfaces, whose methods and
properties can be accessed through them. (See Object interfaces ( see page 625).) They can hold dynamic arrays, and they
can hold a special kind of static array called a variant array. (See Variant arrays.) Variants can mix with other variants and with
integer, real, string, and Boolean values in expressions and assignments; the compiler automatically performs type conversions.
Variants that contain strings cannot be indexed. That is, if V is a variant that holds a string value, the construction V[1] causes a
580
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
runtime error.
You can define custom Variants that extend the Variant type to hold arbitrary values. For example, you can define a Variant
string type that allows indexing or that holds a particular class reference, record type, or static array. Custom Variant types are
defined by creating descendants to the TCustomVariantType class.
Note: This, and almost all variant functionality, is implemented in the Variants unit.
A variant occupies 16 bytes of memory and consists of a type code and a value, or pointer to a value, of the type specified by
the code. All variants are initialized on creation to the special value Unassigned. The special value Null indicates unknown or
missing data.
The standard function VarType returns a variant's type code. The varTypeMask constant is a bit mask used to extract the code
from VarType's return value, so that, for example,
VarType(V) and varTypeMask = varDouble
returns True if V contains a Double or an array of Double. (The mask simply hides the first bit, which indicates whether the
variant holds an array.) The TVarData record type defined in the System unit can be used to typecast variants and gain access
to their internal representation.
581
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
string converts to integer, converts to real converts string/character returns False if string is 'false'
truncating if using regional formats (noncase-sensitive) or a numeric string
necessary; raises settings; raises that evaluates to 0, True if string is 'true'
exception if string is exception if or a nonzero numeric string; raises
not numeric string is not exception otherwise
numeric
character same as string same as string same as string (above) same as string (above)
(above) (above)
Boolean False = 0, True: all False = 0, True False = 'False', True = False = False, True = True
bits set to 1 (-1 if = 1 'True' by default; casing
Integer, 255 if Byte, depends on global
etc.) variable
BooleanToStringRule
Unassigned returns 0 returns 0 returns empty string returns False
Null depends on global depends on depends on global depends on global variable
variable global variable variables NullStrictConvert (raises an exception
NullStrictConvert NullStrictConvert NullStrictConvert and by default)
(raises an exception (raises an NullAsStringValue
by default) exception by (raises an exception by
default) default)
Out-of-range assignments often result in the target variable getting the highest value in its range. Invalid variant operations,
assignments or casts raise an EVariantError exception or an exception class decending from EVariantError.
Special conversion rules apply to the TDateTime type declared in the System unit. When a TDateTime is converted to any other
type, it treated as a normal Double. When an integer, real, or Boolean is converted to a TDateTime, it is first converted to a
Double, then read as a date-time value. When a string is converted to a TDateTime, it is interpreted as a date-time value using
the regional settings. When an Unassigned value is converted to TDateTime, it is treated like the real or integer value 0.
Converting a Null value to TDateTime raises an exception.
On the Win32 platform, if a variant references a COM interface, any attempt to convert it reads the object's default property and
converts that value to the requested type. If the object has no default property, an exception is raised.
Variants in Expressions
All operators except ^, is, and in take variant operands. Except for comparisons, which always return a Boolean result, any
operation on a variant value returns a variant result. If an expression combines variants with statically-typed values, the
statically-typed values are automatically converted to variants.
This is not true for comparisons, where any operation on a Null variant produces a Null variant. For example:
V := Null + 3;
assigns a Null variant to V. By default, comparisons treat the Null variant as a unique value that is less than any other value.
For example:
if Null > -3 then ... else ...;
3 In this example, the else part of the if statement will be executed. This behavior can be changed by setting the
NullEqualityRule and NullMagnitudeRule global variables.
Variant Arrays
You cannot assign an ordinary static array to a variant. Instead, create a variant array by calling either of the standard functions
VarArrayCreate or VarArrayOf. For example,
V: Variant;
...
V := VarArrayCreate([0,9], varInteger);
582
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
creates a variant array of integers (of length 10) and assigns it to the variant V. The array can be indexed using V[0], V[1], and
so forth, but it is not possible to pass a variant array element as a var parameter. Variant arrays are always indexed with integers.
The second parameter in the call to VarArrayCreate is the type code for the array's base type. For a list of these codes, see
VarType. Never pass the code varString to VarArrayCreate; to create a variant array of strings, use varOleStr.
Variants can hold variant arrays of different sizes, dimensions, and base types. The elements of a variant array can be of any
type allowed in variants except ShortString and AnsiString, and if the base type of the array is Variant, its elements can even
be heterogeneous. Use the VarArrayRedim function to resize a variant array. Other standard routines that operate on variant
arrays include VarArrayDimCount, VarArrayLowBound, VarArrayHighBound, VarArrayRef, VarArrayLock, and
VarArrayUnlock.
Note: Variant arrays of custom variants are not supported, as instances of custom variants can be added to a VarVariant
variant array.
When a variant containing a variant array is assigned to another variant or passed as a value parameter, the entire array is
copied. Don't perform such operations unnecessarily, since they are memory-inefficient.
OleVariant
The OleVariant type exists on both the Windows and Linux platforms. The main difference between Variant and OleVariant is
that Variant can contain data types that only the current application knows what to do with. OleVariant can only contain the data
types defined as compatible with OLE Automation which means that the data types that can be passed between programs or
across the network without worrying about whether the other end will know how to handle the data.
When you assign a Variant that contains custom data (such as a Delphi string, or a one of the new custom variant types) to an
OleVariant, the runtime library tries to convert the Variant into one of the OleVariant standard data types (such as a Delphi
string converts to an OLE BSTR string). For example, if a variant containing an AnsiString is assigned to an OleVariant, the
AnsiString becomes a WideString. The same is true when passing a Variant to an OleVariant function parameter.
See Also
Data Types ( see page 553)
3
3.1.3.2.8 Type Compatibility and Identity
To understand which operations can be performed on which expressions, we need to distinguish several kinds of compatibility
among types and values. These include:
• Type identity
• Type compatibility
• Assignment compatibility
583
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Type Identity
When one type identifier is declared using another type identifier, without qualification, they denote the same type. Thus, given
the declarations
type
T1 = Integer;
T2 = T1;
T3 = Integer;
T4 = T2;
T1, T2, T3, T4, and Integer all denote the same type. To create distinct types, repeat the word type in the declaration. For
example,
type TMyInteger = type Integer;
creates a new type called TMyInteger which is not identical to Integer.
Language constructions that function as type names denote a different type each time they occur. Thus the declarations
type
TS1 = set of Char;
TS2 = set of Char;
create two distinct types, TS1 and TS2. Similarly, the variable declarations
var
S1: string[10];
S2: string[10];
create two variables of distinct types. To create variables of the same type, use
var S1, S2: string[10];
or
type MyString = string[10];
var
S1: MyString;
S2: MyString;
Type Compatibility
Every type is compatible with itself. Two distinct types are compatible if they satisfy at least one of the following conditions.
584
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Assignment Compatibility
Assignment-compatibility is not a symmetric relation. An expression of type T2 can be assigned to a variable of type T1 if the
value of the expression falls in the range of T1 and at least one of the following conditions is satisfied.
• T1 and T2 are of the same type, and it is not a file type or structured type that contains a file type at any level.
• T1 and T2 are compatible ordinal types.
• T1 and T2 are both real types.
• T1 is a real type and T2 is an integer type.
• T1 is PChar, PWideChar or any string type and the expression is a string constant.
• T1 and T2 are both string types.
• T1 is a string type and T2 is a Char or packed-string type.
• T1 is a long string and T2 is PChar or PWideChar.
• T1 and T2 are compatible packed-string types.
• T1 and T2 are compatible set types.
• T1 and T2 are compatible pointer types.
• T1 and T2 are both class, class-reference, or interface types and T2 is a derived from T1.
• T1 is an interface type and T2 is a class type that implements T1.
• T1 is PChar or PWideChar and T2 is a zero-based character array of the form array[0..n] of Char (when T1 is PChar)
or of WideChar (when T1 is PWideChar).
• T1 and T2 are compatible procedural types. (A function or procedure identifier is treated, in certain assignment statements, as
an expression of a procedural type.)
• T1 is Variant and T2 is an integer, real, string, character, Boolean, interface type or OleVariant type.
• T1 is an OleVariant and T2 is an integer, real, string, character, Boolean, interface, or Variant type.
• T1 is an integer, real, string, character, or Boolean type and T2 is Variant or OleVariant.
• T1 is the IUnknown or IDispatch interface type and T2 is Variant or OleVariant. (The variant's type code must be
varEmpty, varUnknown, or varDispatch if T1 is IUnknown, and varEmpty or varDispatch if T1 is IDispatch.)
See Also
Data Types ( see page 553)
585
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
where newTypeName is a valid identifier. For example, given the type declaration
type TMyString = string;
you can make the variable declaration
var S: TMyString;
A type identifier's scope doesn't include the type declaration itself (except for pointer types). So you cannot, for example, define a
record type that uses itself recursively.
When you declare a type that is identical to an existing type, the compiler treats the new type identifier as an alias for the old
one. Thus, given the declarations
type TValue = Real;
var
X: Real;
Y: TValue;
X and Y are of the same type; at runtime, there is no way to distinguish TValue from Real. This is usually of little consequence,
but if your purpose in defining a new type is to utilize runtime type information, for example, to associate a property editor with
properties of a particular type - the distinction between 'different name' and 'different type' becomes important. In this case, use
the syntax
For example,
type TValue = type Real;
forces the compiler to create a new, distinct type called TValue.
For var parameters, types of formal and actual must be identical. For example,
type
TMyType = type Integer
procedure p(var t:TMyType);
begin
end;
procedure x;
var
m: TMyType;
3 i: Integer;
begin
p(m); // Works
p(i); // Error! Types of formal and actual must be identical.
end;
Note: This only applies to var parameters, not to const or by-value parameters.
See Also
Data Types ( see page 553)
586
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
3.1.3.2.10 Variables
A variable is an identifier whose value can change at runtime. Put differently, a variable is a name for a location in memory; you
can use the name to read or write to the memory location. Variables are like containers for data, and, because they are typed,
they tell the compiler how to interpret the data they hold.
Declaring Variables
The basic syntax for a variable declaration is
var identifierList:type;
where identifierList is a comma-delimited list of valid identifiers and type is any valid type. For example,
var I: Integer;
declares a variable I of type Integer, while
var X, Y: Real;
declares two variables - X and Y - of type Real.
Consecutive variable declarations do not have to repeat the reserved word var:
var
X, Y, Z: Double;
I, J, K: Integer;
Digit: 0..9;
Okay: Boolean;
Variables declared within a procedure or function are sometimes called local, while other variables are called global. Global
variables can be initialized at the same time they are declared, using the syntax
where constantExpression is any constant expression representing a value of type type. Thus the declaration
var I: Integer = 7;
3
is equivalent to the declaration and statement
var I: Integer;
...
I := 7;
Local variables cannot be initialized in their declarations. Multiple variable declarations (such as var X, Y, Z: Real;) cannot
include initializations, nor can declarations of variant and file-type variables.
If you don't explicitly initialize a global variable, the compiler initializes it to 0. Object instance data (fields) are also initialized to 0.
587
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
On the Wiin32 platform, the contents of a local variable are undefined until a value is assigned to them. On the .NET platform,
the CLR initializes all variables, including local variables, to 0.
When you declare a variable, you are allocating memory which is freed automatically when the variable is no longer used. In
particular, local variables exist only until the program exits from the function or procedure in which they are declared. For more
information about variables and memory management, see Memory management ( see page 644).
Absolute Addresses
You can create a new variable that resides at the same address as another variable. To do so, put the directive absolute after
the type name in the declaration of the new variable, followed by the name of an existing (previously declared) variable. For
example,
var
Str: string[32];
StrLen: Byte absolute Str;
specifies that the variable StrLen should start at the same address as Str. Since the first byte of a short string contains the
string's length, the value of StrLen is the length of Str.
You cannot initialize a variable in an absolute declaration or combine absolute with any other directives.
Dynamic Variables
You can create dynamic variables by calling the GetMem or New procedure. Such variables are allocated on the heap and are
not managed automatically. Once you create one, it is your responsibility ultimately to free the variable's memory; use FreeMem
to destroy variables created by GetMem and Dispose to destroy variables created by New. Other standard routines that operate
on dynamic variables include ReallocMem, AllocMem, Initialize, Finalize, StrAlloc, and StrDispose.
Long strings, wide strings, dynamic arrays, variants, and interfaces are also heap-allocated dynamic variables, but their memory
is managed automatically.
Thread-local Variables
Thread-local (or thread) variables are used in multithreaded applications. A thread-local variable is like a global variable, except
that each thread of execution gets its own private copy of the variable, which cannot be accessed from other threads.
Thread-local variables are declared with threadvar instead of var. For example,
threadvar X: Integer;
Thread-variable declarations
You can free a variant by setting it to Unassigned and an interface or dynamic array by setting it to nil.
See Also
Data Types ( see page 553)
588
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Declared constants are either true constants or typed constants. These two kinds of constant are superficially similar, but they
are governed by different rules and used for different purposes.
True Constants
A true constant is a declared identifier whose value cannot change. For example,
const MaxValue = 237;
declares a constant called MaxValue that returns the integer 237. The syntax for declaring a true constant is
where identifier is any valid identifier and constantExpression is an expression that the compiler can evaluate without executing
your program.
If constantExpression returns an ordinal value, you can specify the type of the declared constant using a value typecast. For
example
const MyNumber = Int64(17);
declares a constant called MyNumber, of type Int64, that returns the integer 17. Otherwise, the type of the declared constant is
the type of the constantExpression.
• If constantExpression is a character string, the declared constant is compatible with any string type. If the character string is of
length 1, it is also compatible with any character type.
• If constantExpression is a real, its type is Extended. If it is an integer, its type is given by the table below.
Types for integer constants 3
Range of constant(hexadecimal) Range of constant(decimal) Type
-$8000000000000000..-$80000001 -2^63..-2147483649 Int64
-$80000000..-$8001 -2147483648..-32769 Integer
-$8000..-$81 -32768..-129 Smallint
-$80..-1 -128..-1 Shortint
589
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Constant Expressions
A constant expression is an expression that the compiler can evaluate without executing the program in which it occurs.
Constant expressions include numerals; character strings; true constants; values of enumerated types; the special constants
True, False, and nil; and expressions built exclusively from these elements with operators, typecasts, and set constructors.
Constant expressions cannot include variables, pointers, or function calls, except calls to the following predefined functions:
This definition of a constant expression is used in several places in Delphi's syntax specification. Constant expressions are
required for initializing global variables, defining subrange types, assigning ordinalities to values in enumerated types, specifying
default parameter values, writing case statements, and declaring both true and typed constants.
Resource Strings
Resource strings are stored as resources and linked into the executable or library so that they can be modified without
590
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Resource strings are declared like other true constants, except that the word const is replaced by resourcestring. The
expression to the right of the = symbol must be a constant expression and must return a string value. For example,
resourcestring
CreateError = 'Cannot create file %s';
OpenError = 'Cannot open file %s';
LineTooLong = 'Line too long';
ProductName = 'CodeGear Rocks';
SomeResourceString = SomeTrueConstant;
Typed Constants
Typed constants, unlike true constants, can hold values of array, record, procedural, and pointer types. Typed constants cannot
occur in constant expressions.
where identifier is any valid identifier, type is any type except files and variants, and value is an expression of type. For example,
const Max: Integer = 100;
In most cases, value must be a constant expression; but if type is an array, record, procedural, or pointer type, special rules
apply.
Array Constants
To declare an array constant, enclose the values of the array's elements, separated by commas, in parentheses at the end of the
declaration. These values must be represented by constant expressions. For example,
const Digits: array[0..9] of Char = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
declares a typed constant called Digits that holds an array of characters.
Zero-based character arrays often represent null-terminated strings, and for this reason string constants can be used to initialize
character arrays. So the previous declaration can be more conveniently represented as
const Digits: array[0..9] of Char = '0123456789';
To define a multidimensional array constant, enclose the values of each dimension in a separate set of parentheses, separated
by commas. For example,
type TCube = array[0..1, 0..1, 0..1] of Integer;
const Maze: TCube = (((0, 1), (2, 3)), ((4, 5), (6,7)));
creates an array called Maze where
Maze[0,0,0] = 0
Maze[0,0,1] = 1
Maze[0,1,0] = 2
Maze[0,1,1] = 3
Maze[1,0,0] = 4
Maze[1,0,1] = 5
Maze[1,1,0] = 6
Maze[1,1,1] = 7 3
Array constants cannot contain file-type values at any level.
Record Constants
To declare a record constant, specify the value of each field - as fieldName: value, with the field assignments separated by
semicolons - in parentheses at the end of the declaration. The values must be represented by constant expressions. The fields
must be listed in the order in which they appear in the record type declaration, and the tag field, if there is one, must have a
591
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
value specified; if the record has a variant part, only the variant selected by the tag field can be assigned values.
Examples:
type
TPoint = record
X, Y: Single;
end;
TVector = array[0..1] of TPoint;
TMonth = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec);
TDate = record
D: 1..31;
M: TMonth;
Y: 1900..1999;
end;
const
Origin: TPoint = (X: 0.0; Y: 0.0);
Line: TVector = ((X: -3.1; Y: 1.5), (X: 5.8; Y: 3.0));
SomeDay: TDate = (D: 2; M: Dec; Y: 1960);
Record constants cannot contain file-type values at any level.
Procedural Constants
To declare a procedural constant, specify the name of a function or procedure that is compatible with the declared type of the
constant. For example,
function Calc(X, Y: Integer): Integer;
begin
...
end;
Pointer Constants
When you declare a pointer constant, you must initialize it to a value that can be resolved at least as a relative address at
compile time. There are three ways to do this: with the @ operator, with nil, and (if the constant is of type PChar or PWideChar)
with a string literal. For example, if I is a global variable of type Integer, you can declare a constant like
const PI: ^Integer = @I;
The compiler can resolve this because global variables are part of the code segment. So are functions and global constants:
const PF: Pointer = @MyFunction;
Because string literals are allocated as global constants, you can initialize a PChar constant with a string literal:
const WarningStr: PChar = 'Warning!';
3 See Also
Data Types ( see page 553)
592
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Topics
Name Description
Using .NET Custom Attributes ( see page 593) .NET framework assemblies are self-describing entities. They contain
intermediate code that is compiled to native machine instructions when the
assembly is loaded. More than that, assemblies contain a wealth of information
about that code. The compiler emits this descriptive information, or metadata,
into the assembly as it processes the source code. In other programming
environments, there is no way to access metadata once your code is compiled;
the information is lost during the compilation process. On the .NET platform,
however, you have the ability to access metadata using runtime reflection
services.
The .NET framework gives you the ability to extend... more ( see page 593)
The .NET framework gives you the ability to extend the metadata emitted by the compiler with your own descriptive attributes.
These customized attributes are somewhat analogous to language keywords, and are stored with the other metadata in the
assembly.
593
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
The first parameter, 1024, is the value required by the constructor. The second two parameters are the properties defined in the
custom attribute.
When a custom attribute is placed before a list of multiple variable declarations, the attribute applies to all variables declared in
that list. For example
var
[TCustomAttribute(1024, prop1=512, prop2=128)]
x, y, z: Integer;
would result in TCustomAttribute being applied to all three variables, X, Y, and Z.
Custom attributes applied to types can be detected at runtime with the GetCustomAttributes method of the Type class. The
following Delphi code demonstrates how to query for custom attributes at runtime.
var
F: TMyClass; // TMyClass declared above
3 T: System.Type;
A: array of TObject; // Will hold custom attributes
I: Integer;
begin
F := TMyClass.Create;
T := F.GetType;
A := T.GetCustomAttributes(True);
594
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
// Don't forget to include the InteropServices unit when using the DllImport attribute.
uses System.Runtime.InteropServices;
[DllImport('user32.dll')]
function MessageBeep(uType : LongWord) : Boolean; external;
begin
MessageBeep(LongWord(-1));
end.
Note the external keyword is still required, to replace the block in the function declaration. All other attributes, such as the calling
convention, can be passed through the DllImport custom attribute.
When the compiler sees an interface declaration, the next square bracket construct found is assumed to be that of a GUID
specifier for the interface. The GUID must be in the traditional Delphi form:
['{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}']
Alternatively, you can use the Guid custom attribute of the .NET framework ( GuidAttribute). If you choose this method, then you
should introduce the attribute before the interface, as with any other custom attribute.
The effect in either case is the same: the GUID is emitted into the metadata for the interface type. Note that GUIDs are not
required for interfaces in the .NET Framework. They are only used for COM interoperability.
Note: When importing COM interfaces with the ComImport custom attribute, you must declare the GuidAttribute instead of
using the Delphi syntax.
See Also
Using Platform Invoke with Delphi for .NET
Topics
Name Description
Overview of Generics ( see page 596) Delphi for .NET supports the use of generics, also known as parameterized types.
Terminology for Generics ( see page 597)
595
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Declaring Generics ( see page 598) The declaration of a generic is similar to the declaration of a regular class,
record, or interface type. The difference is that a list of one or more type
parameters placed between angle brackets (< and >) follows the type identifier in
the declaration of a generic.
Type parameters can be used as a typical type identifier inside the container type
declaration and method body.
For example:
Overloads and Type Compatibility in Generics ( see page 602)
Constraints in Generics ( see page 603) Constraints can be associated with a type parameter of a generic. Constraints
declare items that must be supported by any concrete type passed to that
parameter in a construction of the generic type.
Class Variable in Generics ( see page 605) The class variable defined in a generic type is instantiated in each instantiated
type identified by the type parameters.
The following code shows that TFoo<Integer>.FCount and TFoo<String>.FCount
are instantiated only once, and these are two different variables.
Changes in Standard Functions and Grammar ( see page 606) Here is a list of standard function changes to support parameterized types.
Example forms:
Generics are a set of abstraction tools that permit the decoupling of an algorithm (such as a method, procedure or function) or a
data structure (such as a class, interface or record) from one or more concrete types that the algorithm or data structure uses.
A method or data type that uses other types in its definition can be made more general by substituting one or more concrete
types with type parameters. Then you add those type parameters to a type parameter list in the method or data structure
declaration. This is similar to the way that you can make a procedure more general by substituting instances of a literal constant
in its body with a parameter name, and adding the parameter to the parameter list of the procedure.
For example, a class (TMyList) that maintains a list of objects (of type TObject) can be made more reusable and type-safe by
substituting uses of TObject with a type parameter name (such as 'T'), and adding the type parameter to the class's type
parameter list so that it becomes TMyList<T>.
Concrete uses (instantiations) of a generic type or method can be made by supplying type arguments to the generic type or
method at the point of use. The act of supplying type arguments effectively constructs a new type or method by substituting
instances of the type parameter in the generic definition with the corresponding type argument.
For example, the list might be used as TMyList<Double>. This creates a new type, TMyList<Double>, whose definition is
identical to TMyList<T> except that all instances of 'T' in the definition are replaced with 'Double'.
It should be noted that generics as an abstraction mechanism duplicates much of the functionality of polymorphism, but with
different characteristics. Since a new type or method is constructed at instantiation time, you can find type errors sooner, at
compile time rather than run time. This also increases the scope for optimization, but with a trade-off - each instantiation
increases the memory usage of the final running application, possibly resulting in lower performance.
3
Code Examples
For example, TSIPair is a class holding two data types, String and Integer:
type
TSIPair = class
private
FKey: String;
FValue: Integer;
public
596
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
private
FKey: TKey;
FValue: TValue;
public
function GetKey: TKey;
procedure SetKey(Key: TKey);
function GetValue: TValue;
procedure SetValue(Value: TValue);
property Key: TKey read GetKey write SetKey;
property Value: TValue read GetValue write SetValue;
end;
type
TSIPair = TPair<String,Integer>; // declares instantiated type
TSSPair = TPair<String,String>; // declares with other data types
TISPair = TPair<Integer,String>;
TIIPair = TPair<Integer,Integer>;
TSXPair = TPair<String,TXMLNode>;
Platform Requirements and Differences
Parameterized types are supported by .NET 2.0 or later, but are not supported by .NET 1.1 or before.
Instantiation timing:
See Also
Terminology of Generics ( see page 597)
Changes in Standard Functions and Grammar (Parameterized Types) ( see page 606)
597
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Type parameterized A type declaration which requires type parameters to be supplied in order to form an actual type.
type 'List<Item>' is a type parameterized type in the following code:
type
List<Item> = class
...
end;
Parameterized type Same as type parameterized type.
Type parameter A parameter declared in a parameterized type declaration or a method header in order to use as a
type for another declaration inside its parameterized type declaration or method body. It will be bound
to real type argument. Item is a type parameter in the following code:
type
List<Item> = class
...
end;
Type argument A type used with type identifier in order to make instantiated type. In List<Integer>, if List is a
parameterized type, Integer is a type argument.
Instantiated type The combination of a parameterized type with a set of parameters.
Constructed type Same as instantiated typed.
Closed constructed type A constructed type having all its parameters resolved to actual types. List<Integer> is closed because
integer is an actual type.
Open constructed type A constructed type having at least one parameter that is a type parameter. If T is a type parameter of
a containing class, List<T> is an open constructed type.
Instantiation Compiler generates real instruction code for methods defined in parameterized types and real virtual
method table for closed constructed type.
See Also
Overview of Generics ( see page 596)
Changes in Standard Functions and Grammar (Parameterized Types) ( see page 606)
For example:
type
TPair<Tkey,TValue> = class // TKey and TValue are type parameters
FKey: TKey;
FValue: TValue;
function GetValue: TValue;
end;
598
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
599
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
type
TFoo1<T> = class(TBar) // Actual type
end;
For example:
type
TRecord<T> = record
FData: T;
end;
type
IAncestor<T> = interface
function GetRecord: TRecrod<T>;
end;
IFoo<T> = interface(IAncestor<T>)
procedure AMethod(Param: T);
end;
type
TFoo<T> = class(TObject, IFoo<T>)
FField: TRecord<T>;
procedure AMethod(Param: T);
function GetRecord: TRecord<T>;
end;
Procedural Types
The procedure type and the method pointer can be declared with type parameters. Parameter types and result types can also
use type parameters.
For example:
type
TMyProc<T> = procedure(Param: T);
TMyProc2<Y> = procedure(Param1, Param2: Y) of object;
type
TFoo = class
procedure Test; procedure MyProc(X, Y: Integer);
end;
600
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Y := MyProc;
Y(20, 30);
end;
var
F: TFoo;
begin
F := TFoo.Create;
F.Test;
F.Free;
end.
var
F: TFoo;
begin
F := TFoo.Create;
F.Test;
F.Free;
end.
Parameterized Methods
Methods can be declared with type parameters. Parameter types and result types can use type parameters Parameterized
methods are similar to overloaded methods.
procedure TFoo.Test;
var
P: TMyProc2<Integer>;
begin
MyProc2<String>('Hello', 'World');
MyProc2('Hello', 'World');
MyProc2<Integer>(10, 20); 3
MyProc2(10, 20);
P := MyProc2<Integer>;
P(40, 50);
end;
var
F: TFoo;
begin
F := TFoo.Create;
F.Test;
601
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
F.Free;
end.
Scope of Type Parameters
The scope of a type parameter covers the type declaration and the bodies of all its members, but does not include descendent
types.
For example:
type
TFoo<T> = class
X: T;
end;
TBar<S> = class(TFoo<S>)
Y: T; // error! unknown identifier "T"
end;
var
F: TFoo<Integer>;
begin
F.T // error! unknown identifier "T"
end.
See Also
Overview of Generics (Parameterized Types) ( see page 596)
Changes in Standard Functions and Grammar (Parameterized Types) ( see page 606)
For example:
type
TFoo = class
procedure Proc<T>(A: T);
procedure Proc(A: String);
procedure Test;
end;
3
procedure TFoo.Test;
begin
Proc('Hello'); // calls Proc(A: String);
Proc<String>('Hello'); // calls Proc<T>(A: T);
end;
Type Compatibility
Two non-instantiated parameterized types are considered assignment compatible only if they are identical or are aliases to a
common type.
602
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Two instantiated parameterized types are considered assignment compatible if the base types are identical (or are aliases to a
common type) and the type arguments are identical.
See Also
Overview of Generics (Parameterized Types) ( see page 596)
Changes in Standard Functions and Grammar (Parameterized Types) ( see page 606)
Declaring Constraints
Constraints are declared in a fashion that resembles type declarations in regular parameter lists:
type
TFoo<T: ISerializable> = class
FField: T;
end;
In the example declaration given here, the 'T' type parameter indicates that it must support the ISerializable interface. In a type
construction like TFoo<TMyClass>, the compiler checks at compile time to ensure that TMyClass actually implements
ISerializable.
Multiple Constraints
Multiple constraints can be applied to a single type parameters as a comma list following the colon:
603
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
type
TFoo<T: ISerializable, ICloneable; V: IComparable> ...
Constrained type parameters can be mixed with “free” type parameters. For example, all the following are valid:
type
TFoo<T; C: IComparable> ...
TBar<T, V> ...
TTest<S: ISerializable; V> ...
// T and V are free, but C and S are constrained
Types of Constraints
A type parameter constrained by an interface type means that the compiler will verify at compile time that a concrete type passed
as an argument to a type construction implements the specified interface type(s).
For example:
type
TFoo<T: ICloneable> ...
TError = class
end;
var
X: TFoo<TTest1>; // TTest1 is checked for ICloneable support here
// at compile time
Y: TFoo<TError>; // exp: syntax error here - TError does not support
// ICloneable
Compatibility of class types follows the normal rules of OOP type compatibilty - descendent types can be passed where their
ancestor types are required.
Constructor Constraints
A type parameter may be constrained by zero or one instance of the reserved word "constructor". This means that the actual
argument type must be a class that defines a default constructor (a public parameterless constructor), so that methods within the
3 generic type may construct instances of the argument type using the argument type's default constructor, without knowing
anything about the argument type itself (no minimum base type requirements).
In a constraint declaration, you can mix “constructor” in any order with interface or class type constraints.
Class Constraint
A type parameter may be constrained by zero or one instance of the reserved word "class". This means that the actual type must
be a reference type, that is, a class or interface type.
604
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Record Constraint
A type parameter may be constrained by zero or one instance of the reserved word "record". This means that the actual type
must be a value type (not a reference type). A “record” constraint cannot be combined with a “class” or “constructor” constraint.
Type Inferencing
When using a field or variable of a constrained type parameter, it is not necessary in many cases to typecast in order to treat the
field or variable as one of the constrained types. The compiler can infer which type you're referring to by looking at the method
name and by performing a variation of overload resolution over the union of the methods sharing the same name across all the
constraints on that type.
For example:
type
TFoo<T: ISerializable, ICloneable> = class
FData: T;
procedure Test;
end;
procedure TFoo<T>.Test;
begin
FData.Clone;
end;
The compiler looks for "Clone" methods in ISerializable and ICloneable, since FData is of type T, which is guaranteed to support
both those interfaces. If both interfaces implement "Clone" with the same parameter list, the compiler issues an ambiguous
method call error and require you to typecast to one or the other interface to disambiguate the context.
See Also
Overview of Generics (Parameterized Types) ( see page 596)
Changes in Standard Functions and Grammar (Parameterized Types) ( see page 606)
The following code shows that TFoo<Integer>.FCount and TFoo<String>.FCount are instantiated only once, and these are two
different variables.
{$APPTYPE CONSOLE}
type
TFoo<T> = class
class var FCount: Integer; 3
constructor Create;
end;
constructor TFoo<T>.Create;
begin
inherited Create;
Inc(FCount);
end;
procedure Test;
605
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
FI: TFoo<Integer>;
begin
FI := TFoo<Integer>.Create;
FI.Free;
end;
var
FI: TFoo<Integer>;
FS: TFoo<String>;
begin
FI := TFoo<Integer>.Create;
FI.Free;
FS := TFoo<String>.Create;
FS.Free;
Test;
WriteLn(TFoo<Integer>.FCount); // outputs 2
WriteLn(TFoo<String>.FCount); // outputs 1
end;
See Also
Overview of Generics (Parameterized Types) ( see page 596)
Changes in Standard Functions and Grammar (Parameterized Types) ( see page 606)
function New;
// a := New(array[2,3] of Integer); [.Net]
// a := New(array[,], (const array init expr)); [.Net]
// a := New(dynArrayTypeId, dim1 [, dim2...dimN]); [.Net]
Instantiated type : allowed
Open constructed type : allowed => Not yet implemented.
Parameterized type : NOT allowed
606
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
function TypeInfo;
function TypeHandle;
function TypeId;
// function TypeHandle(Identifier): System.RuntimeTypeHandle; [.Net]
// function TypeInfo(Identifier): System.Type; [.Net]
// function TypeOf(Identifier): System.Type; [.Net]
Instantiated type : allowed
Open constructed type : allowed => Not yet implemented
Parameterized type : NOT allowed
Delphi Language Grammar Changes
These changes are in support of generics or parameterized types.
{ Type Declarations }
607
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
{ Types }
-> ClassRefType
-> TypeRefType
{NEW}-> ClassTypeId TypeArgs
{NEW}-> RecordTypeId TypeArgs
{NEW}-> InterfaceIdent TypeArgs
{ Attributes }
608
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Topics
Name Description
Using Inline Assembly Code (Win32 Only) ( see page 610) The built-in assembler allows you to write assembly code within Delphi programs.
The inline assembler is available only on the Win32 Delphi compiler. It has the
following features:
• Compiler Optimizations.
• Function Results.
The inline assembler is available only on the Win32 Delphi
compiler.
609
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Comments in an asm statement must be in Delphi style. A semicolon does not indicate that the rest of the line is a comment.
The reserved word inline and the directive assembler are maintained for backward compatibility only. They have no effect on
the compiler.
Using Registers
In general, the rules of register use in an asm statement are the same as those of an external procedure or function. An asm
statement must preserve the EDI, ESI, ESP, EBP, and EBX registers, but can freely modify the EAX, ECX, and EDX registers.
On entry to an asm statement, EBP points to the current stack frame and ESP points to the top of the stack. Except for ESP and
EBP, an asm statement can assume nothing about register contents on entry to the statement.
See Also
Understanding Assembler Syntax ( see page 610)
610
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Comments are allowed between assembly statements, but not within them. For example,
MOV AX,1 {Initial value} { OK }
MOV CX,100 {Count} { OK }
Local labels are labels that start with an at-sign (@). They consist of an at-sign followed by one or more letters, digits,
underscores, or at-signs. Use of local labels is restricted to asm statements, and the scope of a local label extends from the asm
reserved word to the end of the asm statement that contains it. A local label doesn't have to be declared.
Instruction Opcodes
The built-in assembler supports all of the Intel-documented opcodes for general application use. Note that operating system
privileged instructions may not be supported. Specifically, the following families of instructions are supported:
• Pentium family
• Pentium Pro and Pentium II
• Pentium III
• Pentium 4
In addition, the built-in assembler supports the following instruction sets
• AMD 3DNow! (from the AMD K6 onwards)
• AMD Enhanced 3DNow! (from the AMD Athlon onwards)
For a complete description of each instruction, refer to your microprocessor documentation.
For an unconditional jump instruction (JMP), the built-in assembler generates a short jump (one-byte opcode followed by a
one-byte displacement) if the distance to the target label is 128 to 127 bytes. Otherwise it generates a near jump (one-byte 3
opcode followed by a two-byte displacement).
For a conditional jump instruction, a short jump (one-byte opcode followed by a one-byte displacement) is generated if the
distance to the target label is 128 to 127 bytes. Otherwise, the built-in assembler generates a short jump with the inverse
condition, which jumps over a near jump to the target label (five bytes in total). For example, the assembly statement
JC Stop
where Stop isn't within reach of a short jump, is converted to a machine code sequence that corresponds to this:
611
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
JNC Skip
JMP Stop
Skip:
Jumps to the entry points of procedures and functions are always near.
Assembly Directives
The built-in assembler supports three assembly define directives: DB (define byte), DW (define word), and DD (define double
word). Each generates data corresponding to the comma-separated operands that follow the directive.
Directive Description
DB Define byte: generates a sequence of bytes. Each operand can be a constant expression with a value
between 128 and 255, or a character string of any length. Constant expressions generate one byte of
code, and strings generate a sequence of bytes with values corresponding to the ASCII code of each
character.
DW Define word: generates a sequence of words. Each operand can be a constant expression with a
value between 32,768 and 65,535, or an address expression. For an address expression, the built-in
assembler generates a near pointer, a word that contains the offset part of the address.
DD Define double word: generates a sequence of double words. Each operand can be a constant
expression with a value between 2,147,483,648 and 4,294,967,295, or an address expression. For
an address expression, the built-in assembler generates a far pointer, a word that contains the offset
part of the address, followed by a word that contains the segment part of the address.
DQ Define quad word: defines a quad word for Int64 values.
The data generated by the DB, DW, and DD directives is always stored in the code segment, just like the code generated by
other built-in assembly statements. To generate uninitialized or initialized data in the data segment, you should use Delphi var or
const declarations.
{ One byte }
DB
0,99 {
Two bytes }
DB
'A'
{ Ord('A') }
DB 'Hello world...',0DH,0AH { String followed by CR/LF }
DB 12,'string' {
Delphi style string }
DW
0FFFFH { One word
}
DW
0,9999 { Two
3 words }
DW
'A'
{ Same as DB 'A',0 }
DW
'BA' {
Same as DB 'A','B' }
DW
MyVar {
Offset of MyVar }
612
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
DW
MyProc { Offset
of MyProc }
DD 0FFFFFFFFH { One
double-word }
DD 0,999999999 { Two
double-words }
DD
'A'
{ Same as DB 'A',0,0,0 }
DD
'DCBA' { Same as
DB 'A','B','C','D' }
DD
MyVar {
Pointer to MyVar }
DD
MyProc { Pointer
to MyProc }
end;
When an identifier precedes a DB, DW , or DD directive, it causes the declaration of a byte-, word-, or double-word-sized
variable at the location of the directive. For example, the assembler allows the following:
ByteVar DB ?
WordVar DW ?
IntVar DD ?
.
.
.
MOV AL,ByteVar
MOV BX,WordVar
MOV ECX,IntVar
The built-in assembler doesn't support such variable declarations. The only kind of symbol that can be defined in an inline
assembly statement is a label. All variables must be declared using Delphi syntax; the preceding construction can be replaced by
var
ByteVar: Byte;
WordVar: Word;
IntVar: Integer;
.
.
.
asm
MOV AL,ByteVar
MOV BX,WordVar
MOV ECX,IntVar
end;
SMALL and LARGE can be used determine the width of a displacement:
MOV EAX, [LARGE $1234]
This instruction generates a 'normal' move with a 32-bit displacement ($00001234).
3
MOV EAX, [SMALL $1234]
The second instruction will generate a move with an address size override prefix and a 16-bit displacement ($1234).
SMALL can be used to save space. The following example generates an address size override and a 2-byte address (in total
three bytes)
MOV EAX, [SMALL 123]
as opposed to
613
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Two additional directives allow assembly code to access dynamic and virtual methods: VMTOFFSET and DMTINDEX.
VMTOFFSET retrieves the offset in bytes of the virtual method pointer table entry of the virtual method argument from the
beginning of the virtual method table (VMT). This directive needs a fully specified class name with a method name as a
parameter (for example, TExample.VirtualMethod), or an interface name and an interface method name.
DMTINDEX retrieves the dynamic method table index of the passed dynamic method. This directive also needs a fully specified
class name with a method name as a parameter, for example, TExample.DynamicMethod. To invoke the dynamic method, call
System.@CallDynaInst with the (E)SI register containing the value obtained from DMTINDEX.
Note: Methods with the message directive are implemented as dynamic methods and can also be called using the DMTINDEX
technique. For example:
TMyClass = class
procedure x; message MYMESSAGE;
end;
The following example uses both DMTINDEX and VMTOFFSET to access dynamic and virtual methods:
program Project2;
type
TExample = class
procedure DynamicMethod; dynamic;
procedure VirtualMethod; virtual;
end;
procedure TExample.DynamicMethod;
begin
end;
procedure TExample.VirtualMethod;
begin
end;
end;
614
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
end;
var
e: TExample;
begin
e := TExample.Create;
try
CallDynamicMethod(e);
CallVirtualMethod(e);
finally
e.Free;
end;
end.
Operands
Inline assembler operands are expressions that consist of constants, registers, symbols, and operators.
Reserved words always take precedence over user-defined identifiers. For example,
var
Ch: Char;
.
.
.
asm
MOV CH, 1
end;
loads 1 into the CH register, not into the Ch variable. To access a user-defined symbol with the same name as a reserved word, 3
you must use the ampersand (&) override operator:
MOV&Ch, 1
It is best to avoid user-defined identifiers with the same names as built-in assembler reserved words.
See Also
Using Inline Assembly Code ( see page 610)
615
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Expressions are built from expression elements and operators, and each expression has an associated expression class and
expression type. This topic covers the following material:
616
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
asm
MOV EAX,X
ADD EAX,4
end;
Expression Elements
The elements of an expression are constants, registers, and symbols.
Numeric Constants
Numeric constants must be integers, and their values must be between 2,147,483,648 and 4,294,967,295.
By default, numeric constants use decimal notation, but the built-in assembler also supports binary, octal, and hexadecimal.
Binary notation is selected by writing a B after the number, octal notation by writing an O after the number, and hexadecimal
notation by writing an H after the number or a $ before the number.
Numeric constants must start with one of the digits 0 through 9 or the $ character. When you write a hexadecimal constant using
the H suffix, an extra zero is required in front of the number if the first significant digit is one of the digits A through F. For
example, 0BAD4H and $BAD4 are hexadecimal constants, but BAD4H is an identifier because it starts with a letter.
String Constants
String constants must be enclosed in single or double quotation marks. Two consecutive quotation marks of the same type as
the enclosing quotation marks count as only one character. Here are some examples of string constants:
'Z'
'Delphi'
'Linux'
"That's all folks"
'"That''s all folks," he said.'
'100'
'"'
"'"
String constants of any length are allowed in DB directives, and cause allocation of a sequence of bytes containing the ASCII
values of the characters in the string. In all other cases, a string constant can be no longer than four characters and denotes a
numeric value which can participate in an expression. The numeric value of a string constant is calculated as
Ord(Ch1) + Ord(Ch2) shl 8 + Ord(Ch3) shl 16 + Ord(Ch4) shl 24
where Ch1 is the rightmost (last) character and Ch4 is the leftmost (first) character. If the string is shorter than four characters,
the leftmost characters are assumed to be zero. The following table shows string constants and their numeric values.
String Value
'a' 00000061H
'ba' 00006261H
'cba' 00636261H
'dcba' 64636261H
'a ' 00006120H 3
' a' 20202061H
'a' * 2 000000E2H
'a'-'A' 00000020H
not 'a' FFFFFF9EH
617
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Registers
The following reserved symbols denote CPU registers in the inline assembler:
CPU registers
32-bit general purpose EAX EBX ECX 32-bit pointer or index ESP EBP ESI EDI
EDX
16-bit general purpose AX BX CX DX 16-bit pointer or index SP BP SI DI
8-bit low registers AL BL CL DL 16-bit segment registers CS DS SS ES
32-bit segment registers FS GS
8-bit high registers AH BH CH DH Coprocessor register stack ST
When an operand consists solely of a register name, it is called a register operand. All registers can be used as register
operands, and some registers can be used in other contexts.
The base registers (BX and BP) and the index registers (SI and DI) can be written within square brackets to indicate indexing.
Valid base/index register combinations are [BX], [BP], [SI], [DI], [BX+SI], [BX+DI], [BP+SI], and [BP+DI]. You can also index with
all the 32-bit registersfor example, [EAX+ECX], [ESP], and [ESP+EAX+5].
The segment registers (ES, CS, SS, DS, FS, and GS) are supported, but segments are normally not useful in 32-bit applications.
The symbol ST denotes the topmost register on the 8087 floating-point register stack. Each of the eight floating-point registers
can be referred to using ST(X), where X is a constant between 0 and 7 indicating the distance from the top of the register stack.
Symbols
The built-in assembler allows you to access almost all Delphi identifiers in assembly language expressions, including constants,
types, variables, procedures, and functions. In addition, the built-in assembler implements the special symbol @Result, which
corresponds to the Result variable within the body of a function. For example, the function
function Sum(X, Y: Integer): Integer;
begin
Result := X + Y;
end;
could be written in assembly language as
function Sum(X, Y: Integer): Integer; stdcall;
begin
asm
MOV EAX,X
ADD EAX,Y
MOV @Result,EAX
end;
end;
The following symbols cannot be used in asm statements:
618
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
With optimizations disabled, local variables (variables declared in procedures and functions) are always allocated on the stack
and accessed relative to EBP, and the value of a local variable symbol is its signed offset from EBP. The assembler
automatically adds [EBP] in references to local variables. For example, given the declaration
var Count: Integer;
within a function or procedure, the instruction
MOV EAX,Count
assembles into MOV EAX,[EBP4].
The built-in assembler treats var parameters as a 32-bit pointers, and the size of a var parameter is always 4. The syntax for
accessing a var parameter is different from that for accessing a value parameter. To access the contents of a var parameter,
you must first load the 32-bit pointer and then access the location it points to. For example,
function Sum(var X, Y: Integer): Integer; stdcall;
begin
asm
MOV EAX,X
MOV EAX,[EAX]
MOV EDX,Y
ADD EAX,[EDX]
MOV @Result,EAX
end;
end;
Identifiers can be qualified within asm statements. For example, given the declarations
type
TPoint = record
X, Y: Integer;
end;
TRect = record
A, B: TPoint;
end;
var 3
P: TPoint;
R: TRect;
the following constructions can be used in an asm statement to access fields.
MOV EAX,P.X
MOV EDX,P.Y
MOV ECX,R.A.X
MOV EBX,R.B.Y
619
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
A type identifier can be used to construct variables on the fly. Each of the following instructions generates the same machine
code, which loads the contents of [EDX] into EAX.
MOV EAX,(TRect PTR [EDX]).B.X
MOV EAX,TRect([EDX]).B.X
MOV EAX,TRect[EDX].B.X
MOV EAX,[EDX].TRect.B.X
Expression Classes
The built-in assembler divides expressions into three classes: registers, memory references, and immediate values.
An expression that consists solely of a register name is a register expression. Examples of register expressions are AX, CL, DI,
and ES. Used as operands, register expressions direct the assembler to generate instructions that operate on the CPU registers.
Expressions that denote memory locations are memory references. Delphi's labels, variables, typed constants, procedures, and
functions belong to this category.
Expressions that aren't registers and aren't associated with memory locations are immediate values. This group includes Delphi's
untyped constants and type identifiers.
Immediate values and memory references cause different code to be generated when used as operands. For example,
const
Start = 10;
var
Count: Integer;
.
.
.
asm
MOV EAX,Start { MOV EAX,xxxx }
MOV EBX,Count { MOV EBX,[xxxx] }
MOV ECX,[Start] { MOV ECX,[xxxx] }
MOV EDX,OFFSET Count { MOV EDX,xxxx }
end;
Because Start is an immediate value, the first MOV is assembled into a move immediate instruction. The second MOV, however,
is translated into a move memory instruction, as Count is a memory reference. In the third MOV, the brackets convert Start into a
memory reference (in this case, the word at offset 10 in the data segment). In the fourth MOV, the OFFSET operator converts
Count into an immediate value (the offset of Count in the data segment).
The brackets and OFFSET operator complement each other. The following asm statement produces identical machine code to
the first two lines of the previous asm statement.
asm
MOV EAX,OFFSET [Start]
MOV EBX,[OFFSET Count]
end;
Memory references and immediate values are further classified as either relocatable or absolute. Relocation is the process by
which the linker assigns absolute addresses to symbols. A relocatable expression denotes a value that requires relocation at link
time, while an absolute expression denotes a value that requires no such relocation. Typically, expressions that refer to labels,
variables, procedures, or functions are relocatable, since the final address of these symbols is unknown at compile time.
3 Expressions that operate solely on constants are absolute.
The built-in assembler allows you to carry out any operation on an absolute value, but it restricts operations on relocatable
values to addition and subtraction of constants.
Expression Types
Every built-in assembler expression has a type, or more correctly a size, because the assembler regards the type of an
expression simply as the size of its memory location. For example, the type of an Integer variable is four, because it occupies 4
bytes. The built-in assembler performs type checking whenever possible, so in the instructions
620
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
var
QuitFlag: Boolean;
OutBufPtr: Word;
.
.
.
asm
MOV AL,QuitFlag
MOV BX,OutBufPtr
end;
the assembler checks that the size of QuitFlag is one (a byte), and that the size of OutBufPtr is two (a word). The instruction
MOV DL,OutBufPtr
produces an error because DL is a byte-sized register and OutBufPtr is a word. The type of a memory reference can be
changed through a typecast; these are correct ways of writing the previous instruction:
MOV DL,BYTE PTR OutBufPtr
MOV DL,Byte(OutBufPtr)
MOV DL,OutBufPtr.Byte
These MOV instructions all refer to the first (least significant) byte of the OutBufPtr variable.
In some cases, a memory reference is untyped. One example is an immediate value (Buffer) enclosed in square brackets:
procedure Example(var Buffer);
asm
MOV AL, [Buffer]
MOV CX, [Buffer]
MOV EDX, [Buffer]
end;
The built-in assembler permits these instructions, because the expression [Buffer] has no type. [Buffer] means "the contents of
the location indicated by Buffer," and the type can be determined from the first operand (byte for AL, word for CX, and
double-word for EDX).
In cases where the type can't be determined from another operand, the built-in assembler requires an explicit typecast. For
example,
INC BYTE PTR [ECX]
IMUL WORD PTR [EDX]
The following table summarizes the predefined type symbols that the built-in assembler provides in addition to any currently
declared Delphi types.
Symbol Type
BYTE 1
WORD 2
DWORD 4
QWORD 8
TBYTE 10 3
Expression Operators
The built-in assembler provides a variety of operators. Precedence rules are different from that of the Delphi language; for
example, in an asm statement, AND has lower precedence than the addition and subtraction operators. The following table lists
the built-in assembler's expression operators in decreasing order of precedence.
621
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Operator Description
& Identifier override. The identifier immediately following the ampersand is treated as a user-defined symbol,
even if the spelling is the same as a built-in assembler reserved symbol.
(... ) Subexpression. Expressions within parentheses are evaluated completely prior to being treated as a single
expression element. Another expression can precede the expression within the parentheses; the result in this
case is the sum of the values of the two expressions, with the type of the first expression.
[... ] Memory reference. The expression within brackets is evaluated completely prior to being treated as a single
expression element. Another expression can precede the expression within the brackets; the result in this case
is the sum of the values of the two expressions, with the type of the first expression. The result is always a
memory reference.
. Structure member selector. The result is the sum of the expression before the period and the expression after
the period, with the type of the expression after the period. Symbols belonging to the scope identified by the
expression before the period can be accessed in the expression after the period.
HIGH Returns the high-order 8 bits of the word-sized expression following the operator. The expression must be an
absolute immediate value.
LOW Returns the low-order 8 bits of the word-sized expression following the operator. The expression must be an
absolute immediate value.
+ Unary plus. Returns the expression following the plus with no changes. The expression must be an absolute
immediate value.
- Unary minus. Returns the negated value of the expression following the minus. The expression must be an
absolute immediate value.
+ Addition. The expressions can be immediate values or memory references, but only one of the expressions
can be a relocatable value. If one of the expressions is a relocatable value, the result is also a relocatable
value. If either of the expressions is a memory reference, the result is also a memory reference.
- Subtraction. The first expression can have any class, but the second expression must be an absolute
immediate value. The result has the same class as the first expression.
3 : Segment override. Instructs the assembler that the expression after the colon belongs to the segment given by
the segment register name (CS, DS, SS, FS, GS, or ES) before the colon. The result is a memory reference
with the value of the expression after the colon. When a segment override is used in an instruction operand, the
instruction is prefixed with an appropriate segment-override prefix instruction to ensure that the indicated
segment is selected.
OFFSET Returns the offset part (double word) of the expression following the operator. The result is an immediate value.
TYPE Returns the type (size in bytes) of the expression following the operator. The type of an immediate value is 0.
622
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
PTR Typecast operator. The result is a memory reference with the value of the expression following the operator
and the type of the expression in front of the operator.
* Multiplication. Both expressions must be absolute immediate values, and the result is an absolute immediate
value.
/ Integer division. Both expressions must be absolute immediate values, and the result is an absolute
immediate value.
MOD Remainder after integer division. Both expressions must be absolute immediate values, and the result is an
absolute immediate value.
SHL Logical shift left. Both expressions must be absolute immediate values, and the result is an absolute
immediate value.
SHR Logical shift right. Both expressions must be absolute immediate values, and the result is an absolute
immediate value.
NOT Bitwise negation. The expression must be an absolute immediate value, and the result is an absolute
immediate value.
AND Bitwise AND. Both expressions must be absolute immediate values, and the result is an absolute immediate
value.
OR Bitwise OR. Both expressions must be absolute immediate values, and the result is an absolute immediate
value.
XOR Bitwise exclusive OR. Both expressions must be absolute immediate values, and the result is an absolute
immediate value.
See Also
Using Inline Assembly Code ( see page 610)
• Compiler Optimizations.
• Function Results.
The inline assembler is available only on the Win32 Delphi compiler.
Compiler Optimizations
An example of the type of function you can write is as follows:
function LongMul(X, Y: Integer): Longint;
asm
MOV EAX,X 3
IMUL Y
end;
The compiler performs several optimizations on these routines:
• No code is generated to copy value parameters into local variables. This affects all string-type value parameters and other
value parameters whose size isn't 1, 2, or 4 bytes. Within the routine, such parameters must be treated as if they were var
parameters.
• Unless a function returns a string, variant, or interface reference, the compiler doesn't allocate a function result variable; a
623
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
reference to the @Result symbol is an error. For strings, variants, and interfaces, the caller always allocates an @Result
pointer.
• The compiler only generates stack frames for nested routines, for routines that have local parameters, or for routines that
have parameters on the stack.
• Locals is the size of the local variables and Params is the size of the parameters. If both Locals and Params are zero, there
is no entry code, and the exit code consists simply of a RET instruction.
The automatically generated entry and exit code for the routine looks like this:
PUSH EBP ;Present if Locals <> 0 or Params <> 0
MOV EBP,ESP ;Present if Locals <> 0 or Params <> 0
SUB ESP,Locals ;Present if Locals <> 0
.
.
.
MOV ESP,EBP ;Present if Locals <> 0
POP EBP ;Present if Locals <> 0 or Params <> 0
RET Params ;Always present
If locals include variants, long strings, or interfaces, they are initialized to zero but not finalized.
Function Results
Assembly language functions return their results as follows.
• Ordinal values are returned in AL (8-bit values), AX (16-bit values), or EAX (32-bit values).
• Real values are returned in ST(0) on the coprocessor's register stack. (Currency values are scaled by 10000.)
• Pointers, including long strings, are returned in EAX.
• Short strings and variants are returned in the temporary location pointed to by @Result.
See Also
Using Inline Assembly Code ( see page 610)
Topics
Name Description
Object Interfaces ( see page 625) An object interface, or simply interface, defines methods that can be
implemented by a class. Interfaces are declared like classes, but cannot be
directly instantiated and do not have their own method definitions. Rather, it is
the responsibility of any class that supports an interface to provide
implementations for the interface's methods. A variable of an interface type can
reference an object whose class implements that interface; however, only
methods declared in the interface can be called using such a variable.
3 Interfaces offer some of the advantages of multiple inheritance without the
semantic difficulties. They are also essential for using... more ( see page 625)
Implementing Interfaces ( see page 627) Once an interface has been declared, it must be implemented in a class before it
can be used. The interfaces implemented by a class are specified in the class's
declaration, after the name of the class's ancestor.
Interface References ( see page 631) If you declare a variable of an interface type, the variable can reference
instances of any class that implements the interface. These topics describe
Interface references and related topics.
624
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Automation Objects (Win32 Only) ( see page 633) An object whose class implements the IDispatch interface (declared in the
System unit) is an Automation object.
Use variants to access Automation objects. When a variant references an
Automation object, you can call the object's methods and read or write to its
properties through the variant. To do this, you must include ComObj in the uses
clause of one of your units or your program or library.
Interfaces offer some of the advantages of multiple inheritance without the semantic difficulties. They are also essential for using
distributed object models (such as SOAP). Using a distributed object model, custom objects that support interfaces can interact
with objects written in C++, Java, and other languages.
Interface Types
Interfaces, like classes, can be declared only in the outermost scope of a program or unit, not in a procedure or function
declaration. An interface type declaration has the form
type interfaceName = interface (ancestorInterface)
['{GUID}']
memberList
end;
where (ancestorInterface) and ['{GUID}'] are optional for .NET interfaces.
Warning: Though the ancestor interface and GUID specification are optional for .NET interfaces, they are required to support
Win32 COM interoperability. If your interface is to be accessed through COM, be sure to specify the ancestor interface and
GUID.
In most respects, interface declarations resemble class declarations, but the following restrictions apply.
• The memberList can include only methods and properties. Fields are not allowed in interfaces.
• Since an interface has no fields, property read and write specifiers must be methods.
• All members of an interface are public. Visibility specifiers and storage specifiers are not allowed. (But an array property can
be declared as default.)
• Interfaces have no constructors or destructors. They cannot be instantiated, except through classes that implement their
methods.
• Methods cannot be declared as virtual, dynamic, abstract, or override. Since interfaces do not implement their own
methods, these designations have no meaning.
Here is an example of an interface declaration:
type
IMalloc = interface(IInterface)
['{00000002-0000-0000-C000-000000000046}'] 3
function Alloc(Size: Integer): Pointer; stdcall;
function Realloc(P: Pointer; Size: Integer): Pointer; stdcall;
procedure Free(P: Pointer); stdcall;
function GetSize(P: Pointer): Integer; stdcall;
function DidAlloc(P: Pointer): Integer; stdcall;
procedure HeapMinimize; stdcall;
end;
In some interface declarations, the interface reserved word is replaced by dispinterface. This construction (along with the
dispid, readonly, and writeonly directives) is platform-specific and is not used in Linux programming.
625
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
The declaration of an interface can specify an ancestor interface. If no ancestor is specified, the interface is a direct descendant
of IInterface, which is defined in the System unit and is the ultimate ancestor of all other interfaces. On Win32, IInterface
declares three methods: QueryInterface, _AddRef, and _Release. These methods are not present on the .NET platform,
and you do not need to implement them.
Note: IInterface is equivalent to IUnknown. You should generally use IInterface for platform independent applications
and reserve the use of IUnknown for specific programs that include Win32 dependencies.
QueryInterface provides the means to obtain a reference to the different interfaces that an object supports. _AddRef and
_Release provide lifetime memory management for interface references. The easiest way to implement these methods is to
derive the implementing class from the System unit's TInterfacedObject. It is also possible to dispense with any of these
methods by implementing it as an empty function; COM objects, however, must be managed through _AddRef and _Release.
Warning: Though QueryInterface, _AddRef, and _Release are optional for .NET interfaces, they are required to support
Win32 COM interoperability. If your interface is to be accessed through COM, be sure to implement these methods.
Interface Identification
An interface declaration can specify a globally unique identifier (GUID), represented by a string literal enclosed in brackets
immediately preceding the member list. The GUID part of the declaration must have the form
['{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}']
where each x is a hexadecimal digit (0 through 9 or A through F). The Type Library editor automatically generates GUIDs for
new interfaces. You can also generate GUIDs by pressing Ctrl+Shift+G in the code editor.
A GUID is a 16-byte binary value that uniquely identifies an interface. If an interface has a GUID, you can use interface querying
to get references to its implementations.
Note: GUIDs are not required for interfaces in the .NET framework. They are only used for COM interoperability.
The TGUID and PGUID types, declared in the System unit, are used to manipulate GUIDs.
type
PGUID = ^TGUID;
TGUID = packed record
D1: Longword;
D2: Word;
D3: Word;
D4: array[0..7] of Byte;
end;
On the .NET platform, you can tag an interface as described above (i.e. following the interface declaration). However, if you use
the traditional Delphi syntax, the first square bracket construct following the interface declaration is taken as a GUID specifier -
not as a .NET attribute. (Note that .NET attributes always apply to the next symbol, not the previous one.) You can also
associate a GUID with an interface using the .NET Guid custom attribute. In this case you would use the .NET style syntax,
placing the attribute immediately before the interface declaration.
3
When you declare a typed constant of type TGUID, you can use a string literal to specify its value. For example,
const IID_IMalloc: TGUID = '{00000002-0000-0000-C000-000000000046}';
In procedure and function calls, either a GUID or an interface identifier can serve as a value or constant parameter of type
TGUID. For example, given the declaration
function Supports(Unknown: IInterface; const IID: TGUID): Boolean;
Supports can be called in either of two ways
626
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Interface Properties
Properties declared in an interface are accessible only through expressions of the interface type; they cannot be accessed
through class-type variables. Moreover, interface properties are visible only within programs where the interface is compiled.
In an interface, property read and write specifiers must be methods, since fields are not available.
Forward Declarations
An interface declaration that ends with the reserved word interface and a semicolon, without specifying an ancestor, GUID, or
member list, is a forward declaration. A forward declaration must be resolved by a defining declaration of the same interface
within the same type declaration section. In other words, between a forward declaration and its defining declaration, nothing can
occur except other type declarations.
See Also
Implementing Interfaces ( see page 627)
3
3.1.3.6.2 Implementing Interfaces
Once an interface has been declared, it must be implemented in a class before it can be used. The interfaces implemented by a
class are specified in the class's declaration, after the name of the class's ancestor.
627
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Class Declarations
Such declarations have the form
type className = class (ancestorClass, interface1, ..., interfacen)
memberList
end;
For example,
type
TMemoryManager = class(TInterfacedObject, IMalloc, IErrorInfo)
.
.
.
end;
declares a class called TMemoryManager that implements the IMalloc and IErrorInfo interfaces. When a class implements
an interface, it must implement (or inherit an implementation of) each method declared in the interface.
Here is the (Win32) declaration of TInterfacedObject in the System unit. On the .NET platform, TInterfacedObject is an alias for
TObject.
type
TInterfacedObject = class(TObject, IInterface)
protected
FRefCount: Integer;
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function _AddRef: Integer; stdcall;
function _Release: Integer; stdcall;
public
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
class function NewInstance: TObject; override;
property RefCount: Integer read FRefCount;
end;
TInterfacedObject implements the IInterface interface. Hence TInterfacedObject declares and implements each of the three
IInterface methods.
Classes that implement interfaces can also be used as base classes. (The first example above declares TMemoryManager as a
direct descendent of TInterfacedObject.) On the Win32 platform, every interface inherits from IInterface, and a class that
implements interfaces must implement the QueryInterface, _AddRef, and _Release methods. The System unit's
TInterfacedObject implements these methods and is thus a convenient base from which to derive other classes that implement
interfaces. On the .NET platform, IInterface does not declare these methods, and you do not need to implement them.
When an interface is implemented, each of its methods is mapped onto a method in the implementing class that has the same
result type, the same calling convention, the same number of parameters, and identically typed parameters in each position. By
default, each interface method is mapped to a method of the same name in the implementing class.
628
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
declared later in the class declaration, but cannot be a private method of an ancestor class declared in another module.
A class can also reimplement an entire interface that it inherits from an ancestor class. This involves relisting the interface in the
descendant class' declaration. For example,
type
IWindow = interface
['{00000115-0000-0000-C000-000000000146}']
procedure Draw;
.
.
.
end;
TWindow = class(TInterfacedObject, IWindow)// TWindow implements IWindow
procedure Draw;
.
.
.
end;
TFrameWindow = class(TWindow, IWindow)// TFrameWindow reimplements IWindow
procedure Draw;
.
.
.
end;
Reimplementing an interface hides the inherited implementation of the same interface. Hence method resolution clauses in an
ancestor class have no effect on the reimplemented interface.
629
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
The class you use to implement the delegated interface should derive from TAggregationObject.
Note: Due to restrictions imposed by the CLR, the implements directive is not supported on the .NET platform.
630
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
.
var
MyClass: TMyClass;
MyInterface: IMyInterface;
begin
MyClass := TMyClass.Create;
MyClass.FMyImplClass := TMyImplClass.Create;
MyInterface := MyClass;
MyInterface.P1; // calls TMyClass.MyP1;
MyInterface.P2; // calls TImplClass.P2;
end;
See Also
Object Interfaces ( see page 625)
• An interface-type expression gives you access only to methods and properties declared in the interface, not to other members
of the implementing class.
• An interface-type expression cannot reference an object whose class implements a descendant interface, unless the class (or
one that it inherits from) explicitly implements the ancestor interface as well.
For example,
type
IAncestor = interface
end;
IDescendant = interface(IAncestor)
procedure P1;
end;
TSomething = class(TInterfacedObject, IDescendant)
procedure P1;
procedure P2;
end;
.
.
.
var
D: IDescendant;
A: IAncestor;
begin
D := TSomething.Create; // works! 3
A := TSomething.Create; // error
D.P1; // works!
D.P2; // error
end;
In this example, A is declared as a variable of type IAncestor. Because TSomething does not list IAncestor among the
interfaces it implements, a TSomething instance cannot be assigned to A. But if we changed TSomething's declaration to
TSomething = class(TInterfacedObject, IAncestor, IDescendant)
.
631
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
.
.
the first error would become a valid assignment. D is declared as a variable of type IDescendant. While D references an
instance of TSomething, we cannot use it to access TSomething's P2 method, since P2 is not a method of IDescendant.
But if we changed D's declaration to
D: TSomething;
the second error would become a valid method call.
On the Win32 platform, interface references are typically managed through reference-counting, which depends on the _AddRef
and _Release methods inherited from IInterface. These methods, and reference counting in general, are not applicable on the
.NET platform, which is a garbage collected environment. Using the default implementation of reference counting, when an
object is referenced only through interfaces, there is no need to destroy it manually; the object is automatically destroyed when
the last reference to it goes out of scope. Some classes implement interfaces to bypass this default lifetime management, and
some hybrid objects use reference counting only when the object does not have an owner.
To determine whether an interface-type expression references an object, pass it to the standard function Assigned.
An interface-type expression can be assigned to a variant. If the interface is of type IDispatch or a descendant, the variant
receives the type code varDispatch. Otherwise, the variant receives the type code varUnknown.
A variant whose type code is varEmpty, varUnknown, or varDispatch can be assigned to an IInterface variable. A
variant whose type code is varEmpty or varDispatch can be assigned to an IDispatch variable.
Interface Typecasts
An interface-type expression can be cast to Variant. If the interface is of type IDispatch or a descendant, the resulting variant
has the type code varDispatch. Otherwise, the resulting variant has the type code varUnknown.
A variant whose type code is varEmpty, varUnknown, or varDispatch can be cast to IInterface. A variant whose type
code is varEmpty or varDispatch can be cast to IDispatch.
Interface Querying
You can use the as operator to perform checked interface typecasts. This is known as interface querying, and it yields an
interface-type expression from an object reference or from another interface reference, based on the actual (runtime) type of the
object. An interface query has the form
object as interface
where object is an expression of an interface or variant type or denotes an instance of a class that implements an interface, and
interface is any interface declared with a GUID.
3 An interface query returns nil if object is nil. Otherwise, it passes the GUID of interface to the QueryInterface method in
object, raising an exception unless QueryInterface returns zero. If QueryInterface returns zero (indicating that object's
class implements interface), the interface query returns an interface reference to object.
See Also
Object Interfaces ( see page 625)
632
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Use variants to access Automation objects. When a variant references an Automation object, you can call the object's methods
and read or write to its properties through the variant. To do this, you must include ComObj in the uses clause of one of your
units or your program or library.
A method declared in a dispatch interface cannot contain directives other than dispid. Parameter and result types must be
automatable. In other words, they must be Byte, Currency, Real, Double, Longint, Integer, Single, Smallint, AnsiString,
WideString, TDateTime, Variant, OleVariant, WordBool, or any interface type.
The following example illustrates Automation method calls. The CreateOleObject function (defined in ComObj) returns an
IDispatch reference to an Automation object and is assignment-compatible with the variant Word.
var
633
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Word: Variant;
begin
Word := CreateOleObject('Word.Basic');
Word.FileNew('Normal');
Word.Insert('This is the first line'#13);
Word.Insert('This is the second line'#13);
Word.FileSaveAs('c:\temp\test.txt', 3);
end;
You can pass interface-type parameters to Automation methods.
Variant arrays with an element type of varByte are the preferred method of passing binary data between Automation controllers
and servers. Such arrays are subject to no translation of their data, and can be efficiently accessed using the VarArrayLock
and VarArrayUnlock routines.
A positional parameter is simply an expression. A named parameter consists of a parameter identifier, followed by the := symbol,
followed by an expression. Positional parameters must precede any named parameters in a method call. Named parameters can
be specified in any order.
Some Automation servers allow you to omit parameters from a method call, accepting their default values. For example,
Word.FileSaveAs('test.doc');
Word.FileSaveAs('test.doc', 6);
Word.FileSaveAs('test.doc',,,'secret');
Word.FileSaveAs('test.doc', Password := 'secret');
Word.FileSaveAs(Password := 'secret', Name := 'test.doc');
Automation method call parameters can be of integer, real, string, Boolean, and variant types. A parameter is passed by
reference if the parameter expression consists only of a variable reference, and if the variable reference is of type Byte,
Smallint, Integer, Single, Double, Currency, TDateTime, AnsiString, WordBool, or Variant. If the expression is not of one of
these types, or if it is not just a variable, the parameter is passed by value. Passing a parameter by reference to a method that
expects a value parameter causes COM to fetch the value from the reference parameter. Passing a parameter by value to a
method that expects a reference parameter causes an error.
Dual Interfaces
A dual interface is an interface that supports both compile-time binding and runtime binding through Automation. Dual interfaces
must descend from IDispatch.
All methods of a dual interface (except from those inherited from IInterface and IDispatch) must use the safecall
convention, and all method parameter and result types must be automatable. (The automatable types are Byte, Currency, Real,
Double, Real48, Integer, Single, Smallint, AnsiString, ShortString, TDateTime, Variant, OleVariant, and WordBool.)
See Also
Object Interfaces ( see page 625)
634
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Topics
Name Description
Libraries and Packages ( see page 635) A dynamically loadable library is a dynamic-link library (DLL) on Win32, and an
assembly (also a DLL) on the .NET platform. It is a collection of routines that can
be called by applications and by other DLLs or shared objects. Like units,
dynamically loadable libraries contain sharable code or resources. But this type
of library is a separately compiled executable that is linked at runtime to the
programs that use it.
Delphi programs can call DLLs and assemblies written in other languages, and
applications written in other languages can call DLLs or assemblies written in
Delphi.
Writing Dynamically Loaded Libraries ( see page 637) The following topics describe elements of writing dynamically loadable libraries,
including
Delphi programs can call DLLs and assemblies written in other languages, and applications written in other languages can call
DLLs or assemblies written in Delphi.
Before you can call routines defined in DLL or assembly, you must import them. This can be done in two ways: by declaring an
external procedure or function, or by direct calls to the operating system. Whichever method you use, the routines are not linked
to your application until runtime.
635
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
The Delphi language does not support importing of variables from DLLs or assemblies.
Static Loading
The simplest way to import a procedure or function is to declare it using the external directive. For example,
procedure DoSomething; external 'MYLIB.DLL';
If you include this declaration in a program, MYLIB.DLL is loaded once, when the program starts. Throughout execution of the
program, the identifier DoSomething always refers to the same entry point in the same shared library.
Declarations of imported routines can be placed directly in the program or unit where they are called. To simplify maintenance,
however, you can collect external declarations into a separate "import unit" that also contains any constants and types required
for interfacing with the library. Other modules that use the import unit can call any routines declared in it.
Dynamic Loading
You can access routines in a library through direct calls to Win32 APIs, including LoadLibrary, FreeLibrary, and
GetProcAddress. These functions are declared in Windows.pas. on Linux, they are implemented for compatibility in
SysUtils.pas; the actual Linux OS routines are dlopen, dlclose, and dlsym (all declared in libc; see the man pages for more
information). In this case, use procedural-type variables to reference the imported routines.
For example,
uses Windows, ...;
type
TTimeRec = record
Second: Integer;
Minute: Integer;
Hour: Integer;
end;
var
Time: TTimeRec;
Handle: THandle;
GetTime: TGetTime;
.
.
.
begin
Handle := LoadLibrary('libraryname');
if Handle <> 0 then
begin
@GetTime := GetProcAddress(Handle, 'GetTime');
if @GetTime <> nil then
begin
GetTime(Time);
with Time do
WriteLn('The time is ', Hour, ':', Minute, ':', Second);
end;
FreeLibrary(Handle);
3 end;
end;
When you import routines this way, the library is not loaded until the code containing the call to LoadLibrary executes. The
library is later unloaded by the call to FreeLibrary. This allows you to conserve memory and to run your program even when
some of the libraries it uses are not present.
See Also
Writing Dynamically Loaded Libraries ( see page 637)
636
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Only routines that a library explicitly exports are available for importing by other libraries or programs. The following example
shows a library with two exported functions, Min and Max.
library MinMax;
function Min(X, Y: Integer): Integer; stdcall;
begin
if X < Y then Min := X else Min := Y;
end;
function Max(X, Y: Integer): Integer; stdcall;
begin
if X > Y then Max := X else Max := Y;
end;
exports
Min,
Max;
begin
end.
If you want your library to be available to applications written in other languages, it's safest to specify stdcall in the declarations
of exported functions. Other languages may not support Delphi's default register calling convention.
Libraries can be built from multiple units. In this case, the library source file is frequently reduced to a uses clause, an exports
clause, and the initialization code. For example,
library Editors;
uses EdInit, EdInOut, EdFormat, EdPrint;
exports
InitEditors,
DoneEditors name Done,
InsertText name Insert,
DeleteSelection name Delete,
FormatSelection,
PrintSelection name Print,
.
.
.
SetErrorHandler; 3
begin
InitLibrary;
end.
You can put exports clauses in the interface or implementation section of a unit. Any library that includes such a unit in its
uses clause automatically exports the routines listed the unit's exports clauses without the need for an exports clause of its
own.
The directive local, which marks routines as unavailable for export, is platform-specific and has no effect in Windows
637
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
programming.
On Linux, the local directive provides a slight performance optimization for routines that are compiled into a library but are not
exported. This directive can be specified for stand-alone procedures and functions, but not for methods. A routine declared with
localfor example,
function Contraband(I: Integer): Integer; local;
does not refresh the EBX register and hence
(Entries can also include the directive resident, which is maintained for backward compatibility and is ignored by the compiler.)
On the Win32 platform, an index specifier consists of the directive index followed by a numeric constant between 1 and
2,147,483,647. (For more efficient programs, use low index values.) If an entry has no index specifier, the routine is
automatically assigned a number in the export table.
specifiers, which are supported for backward compatibility only, is discouraged and may cause problems for other development
tools. A name specifier consists of the directive name followed by a string constant. If an entry has no name specifier, the
routine is exported under its original declared name, with the same spelling and case. Use a name clause when you want to
export a routine under a different name. For example,
exports
DoSomethingABC name 'DoSomething';
When you export an overloaded function or procedure from a dynamically loadable library, you must specify its parameter list in
the exports clause. For example,
exports
Divide(X, Y: Integer) name 'Divide_Ints',
Divide(X, Y: Real) name 'Divide_Reals';
On Win32, do not include index specifiers in entries for overloaded routines.
An exports clause can appear anywhere and any number of times in the declaration part of a program or library, or in the
interface or implementation section of a unit. Programs seldom contain an exports clause.
Library initialization code can signal an error by setting the ExitCode variable to a nonzero value. ExitCode is declared in the
System unit and defaults to zero, indicating successful initialization. If a library's initialization code sets ExitCode to another
value, the library is unloaded and the calling application is notified of the failure. Similarly, if an unhandled exception occurs
during execution of the initialization code, the calling application is notified of a failure to load the library.
638
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Here is an example of a library with initialization code and an entry point procedure.
library Test;
var
SaveDllProc: Pointer;
procedure LibExit(Reason: Integer);
begin
if Reason = DLL_PROCESS_DETACH then
begin
.
. // library exit code
.
end;
SaveDllProc(Reason); // call saved entry point procedure
end;
begin
.
. // library initialization code
.
SaveDllProc := DllProc; // save exit procedure chain
DllProc := @LibExit; // install LibExit exit procedure
end.
DllProc is called when the library is first loaded into memory, when a thread starts or stops, or when the library is unloaded.
The initialization parts of all units used by a library are executed before the library's initialization code, and the finalization parts of
those units are executed after the library's entry point procedure.
A library can be used by several applications at once, but each application has a copy of the library in its own process space with
its own set of global variables. For multiple libraries - or multiple instances of a library - to share memory, they must use
memory-mapped files. Refer to the your system documentation for further information.
The DLLProc variable allows a library to monitor calls that the operating system makes to the library entry point. This feature is
normally used only by libraries that support multithreading. DLLProc is available on both Windows and Linux but its use differs
on each. On Win32, DLLProc is used in multithreading applications.; on Linux, it is used to determine when your library is being
unloaded. You should use finalization sections, rather than exit procedures, for all exit behavior.
To monitor operating-system calls, create a callback procedure that takes a single integer parameter, for example,
procedure DLLHandler(Reason: Integer);
and assign the address of the procedure to the DLLProc variable. When the procedure is called, it passes to it one of the
following values.
DLL_PROCESS_DETACH Indicates that the library is detaching from the address space of the calling process as a result of a
clean exit or a call to FreeLibrary. 3
DLL_PROCESS_ATTACH Indicates that the library is attaching to the address space of the calling process as the result of a
call to LoadLibrary.
DLL_THREAD_ATTACH Indicates that the current process is creating a new thread.
DLL_THREAD_DETACH Indicates that a thread is exiting cleanly.
In the body of the procedure, you can specify actions to take depending on which parameter is passed to the procedure.
639
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
On Win32, if the calling application or library is written in another language, the exception can be handled as an
operating-system exception with the exception code $0EEDFADE. The first entry in the ExceptionInformation array of the
operating-system exception record contains the exception address, and the second entry contains a reference to the Delphi
exception object.
Generally, you should not let exceptions escape from your library. Delphi exceptions map to the OS exception model (including
the .NET exception model)..
If a library does not use the SysUtils unit, exception support is disabled. In this case, when a runtime error occurs in the
library, the calling application terminates. Because the library has no way of knowing whether it was called from a Delphi
program, it cannot invoke the application's exit procedures; the application is simply aborted and removed from memory.
ShareMem is the interface unit for the BORLANDMM.DLL memory manager, which allows modules to share dynamically allocated
memory. BORLANDMM.DLL must be deployed with applications and DLLs that use ShareMem. When an application or DLL uses
ShareMem, its memory manager is replaced by the memory manager in BORLANDMM.DLL.
See Also
Libraries and Packages ( see page 635)
3.1.3.7.3 Packages
The following topics describe packages and various issues involved in creating and compiling them.
640
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Runtime packages provide functionality when a user runs an application. Design-time packages are used to install components
in the IDE and to create special property editors for custom components. A single package can function at both design time and
runtime, and design-time packages frequently work by referencing runtime packages in their requires clauses.
On Win32, package files end with the .bpl (Borland package library) extension. On the .NET platform, packages are .NET
assemblies, and end with an extension of .dll
Ordinarily, packages are loaded statically when an applications starts. But you can use the LoadPackage and UnloadPackage
routines (in the SysUtils unit) to load packages dynamically.
Note: When an application utilizes packages, the name of each packaged unit still must appear in the uses
The contains clause identifies the unit files to be compiled and bound into the package. It consists of the directive contains,
followed by a comma-delimited list of unit names, followed by a semicolon. Any unit name may be followed by the reserved word
in and the name of a source file, with or without a directory path, in single quotation marks; directory paths can be absolute or
relative. For example,
contains MyUnit in 'C:\MyProject\MyUnit.pas';
3
Note: Thread-local variables (declared with threadvar
) in a packaged unit cannot be accessed from clients that use the package.
Naming packages
A compiled package involves several generated files. For example, the source file for the package called DATAX is DATAX.DPK,
from which the compiler generates an executable and a binary image called
641
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
DATAX is used to refer to the package in the requires clauses of other packages, or when using the package in an application.
Package names must be unique within a project.
If the unit files contained in a package make references to other packaged units, the other packages should be included in the
first package's requires clause. If the other packages are omitted from the requires clause, the compiler loads the referenced
units from their .dcu or .dcuil files.
All units included directly in a package's contains clause, or indirectly in the uses clauses of those units, are bound into the
package at compile time. The units contained (directly or indirectly) in a package cannot be contained in any other packages
referenced in requires clause of that package.
A unit cannot be contained (directly or indirectly) in more than one package used by the same application.
Compiling Packages
Packages are ordinarily compiled from the IDE using .dpk files generated by the Project Manager. You can also compile .dpk
files directly from the command line. When you build a project that contains a package, the package is implicitly recompiled, if
necessary.
3
Generated Files
The following table lists the files produced by the successful compilation of a package.
642
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Directive Purpose
{$IMPLICITBUILD Prevents a package from being implicitly recompiled later. Use in .dpk files when compiling
OFF} packages that provide low-level functionality, that change infrequently between builds, or whose
source code will not be distributed.
{$G-} or Disables creation of imported data references. This directive increases memory-access efficiency,
{$IMPORTEDDATA but prevents the unit where it occurs from referencing variables in other packages.
OFF}
{$WEAKPACKAGEUNIT Packages unit weakly.
ON}
{$DENYPACKAGEUNIT Prevents unit from being placed in a package.
ON}
{$DESIGNONLY ON} Compiles the package for installation in the IDE. (Put in .dpk file.)
{$RUNONLY ON} Compiles the package as runtime only. (Put in .dpk file.)
Including {$DENYPACKAGEUNIT ON} in source code prevents the unit file from being packaged. Including {$G-} or
{$IMPORTEDDATA OFF} may prevent a package from being used in the same application with other packages.
Switch Purpose
-$G- Disables creation of imported data references. Using this switch increases memory-access efficiency, but
prevents packages compiled with it from referencing variables in other packages.
LE path Specifies the directory where the compiled package file will be placed.
LN path Specifies the directory where the package dcp or dcpil file will be placed. 3
LUpackageName Specifies additional runtime packages to use in an application. Used when compiling a project.
[;packageName2;...]
Z Prevents a package from being implicitly recompiled later. Use when compiling packages that provide
low-level functionality, that change infrequently between builds, or whose source code will not be
distributed.
Using the -$G- switch may prevent a package from being used in the same application with other packages.
643
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
switch on the .NET platform, you can refer to the package with or without the .dll extension. If you omit the .dll extension,
the compiler will look for the package on the unit search path, and on the package search path. However, if the package
specification contains a drive letter or the path separator character, then the compiler will assume the package name is the full
file name (including the .dll extension). In the latter case, if you specify a full or relative path, but omit the .dll extension, the
compiler will not be able to locate the package.
See Also
Libraries and Packages ( see page 635)
Topics
Name Description
Memory Management on the Win32 Platform ( see page 644) The following material describes how memory management on Win32 is handled,
and briefly describes memory issues of variables.
Internal Data Formats ( see page 645) The following topics describe the internal formats of Delphi data types.
Memory Management Issues on the .NET Platform ( see page 653) The .NET Common Language Runtime is a garbage-collected environment. This
means the programmer is freed (for the most part) from worrying about memory
allocation and deallocation. Broadly speaking, after you allocate memory, the
CLR determines when it is safe to free that memory. "Safe to free" means that no
more references to that memory exist.
This topic covers the following memory management issues:
3 The Memory Manager is optimized for applications that allocate large numbers of small- to medium-sized blocks, as is typical for
object-oriented applications and applications that process string data. The Memory Manager is optimized for efficient operation
(high speed and low memory overhead) in single and multi-threaded applications. Other memory managers, such as the
implementations of GlobalAlloc, LocalAlloc, and private heap support in Windows, typically do not perform well in such situations,
and would slow down an application if they were used directly.
To ensure the best performance, the Memory Manager interfaces directly with the Win32 virtual memory API (the >VirtualAlloc
and VirtualFree functions). The Memory Manager supports a user mode address space up to 4GB.
644
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Memory Manager blocks are always rounded upward to a size that is a multiple of 4 bytes, and always include a 4-byte header in
which the size of the block and other status bits are stored. The start address of memory blocks are always aligned on at least
8-byte boundaries, or optionally on 16-byte boundaries, which improves performance when addressing them.
The Memory Manager employs an algorithm that anticipates future block reallocations, reducing the performance impact usually
associated with such operations. The reallocation algorithm also helps reduce address space fragmentation.
The memory manager provides a sharing mechanism that does not require the use of an external DLL.
The Memory Manager includes reporting functions to help applications monitor their own memory usage and potential memory
leaks.
The Memory Manager provides two procedures, GetMemoryManagerState and GetMemoryMap, that allow applications to
retrieve memory-manager status information and a detailed map of memory usage.
Variables
Global variables are allocated on the application data segment and persist for the duration of the program. Local variables
(declared within procedures and functions) reside in an application's stack. Each time a procedure or function is called, it
allocates a set of local variables; on exit, the local variables are disposed of. Compiler optimization may eliminate variables
earlier.
On Win32, an application's stack is defined by two values: the minimum stack size and the maximum stack size. The values are
controlled through the $MINSTACKSIZE and $MAXSTACKSIZE compiler directives, and default to 16,384 (16K) and 1,048,576
(1Mb) respectively. An application is guaranteed to have the minimum stack size available, and an application's stack is never
allowed to grow larger than the maximum stack size. If there is not enough memory available to satisfy an application's minimum
stack requirement, Windows will report an error upon attempting to start the application.
If a Win32 application requires more stack space than specified by the minimum stack size, additional memory is automatically
allocated in 4K increments. If allocation of additional stack space fails, either because more memory is not available or because
the total size of the stack would exceed the maximum stack size, an EStackOverflow exception is raised. (Stack overflow
checking is completely automatic. The $S compiler directive, which originally controlled overflow checking, is maintained for
backward compatibility.)
Dynamic variables created with the GetMem or New procedure are heap-allocated and persist until they are deallocated with
FreeMem or Dispose.
Long strings, wide strings, dynamic arrays, variants, and interfaces are heap-allocated, but their memory is managed
automatically.
See Also
Internal Data Formats ( see page 645)
Increasing the Memory Manager Address Space Beyond 2GB ( see page 176)
645
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Integer Types
The format of an integer-type variable depends on its minimum and maximum bounds.
• If both bounds are within the range 128..127 (Shortint), the variable is stored as a signed byte.
• If both bounds are within the range 0..255 (Byte), the variable is stored as an unsigned byte.
• If both bounds are within the range 32768..32767 (Smallint), the variable is stored as a signed word.
• If both bounds are within the range 0..65535 (Word), the variable is stored as an unsigned word.
• If both bounds are within the range 2147483648..2147483647 (Longint), the variable is stored as a signed double word.
• If both bounds are within the range 0..4294967295 (Longword), the variable is stored as an unsigned double word.
• Otherwise, the variable is stored as a signed quadruple word (Int64).
Note: a "word" occupies two bytes.
Character Types
On the Win32 platform, Char, an AnsiChar, or a subrange of a Char type is stored as an unsigned byte. A WideChar is stored
as an unsigned word.
Boolean Types
A Boolean type is stored as a Byte, a ByteBool is stored as a Byte, a WordBool type is stored as a Word, and a LongBool is
stored as a Longint.
A Boolean can assume the values 0 (False) and 1 (True). ByteBool, WordBool, and LongBool types can assume the values
0 (False) or nonzero (True).
Enumerated Types
An enumerated type is stored as an unsigned byte if the enumeration has no more than 256 values and the type was declared in
the {$Z1} state (the default). If an enumerated type has more than 256 values, or if the type was declared in the {$Z2} state, it
is stored as an unsigned word. If an enumerated type is declared in the {$Z4} state, it is stored as an unsigned double-word.
Real Types
The real types store the binary representation of a sign (+ or -), an exponent, and a significand. A real value has the form
where the significand has a single bit to the left of the binary decimal point. (That is, 0 <= significand < 2.)
In the figures that follow, the most significant bit is always on the left and the least significant bit on the right. The numbers at the
top indicate the width (in bits) of each field, with the left-most items stored at the highest addresses. For example, for a Real48
value, e is stored in the first byte, f in the following five bytes, and s in the most significant bit of the last byte.
On the Win32 platform, a 6-byte (48-bit) Real48 number is divided into three fields:
1 39 8
s f e
646
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
If e = 0, then v = 0.
The Real48 type can't store denormals, NaNs, and infinities. Denormals become zero when stored in a Real48, while NaNs and
infinities produce an overflow error if an attempt is made to store them in a Real48.
1 8 23
s e f
1 11 52
s e f
1 15 1 63
s e i f
Note: On the .NET platform, the Extended type is aliased to Double, and has been deprecated.
647
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Note: On the .NET platform, the Comp type is aliased to Int64, and has been deprecated.
Pointer Types
A Pointer type is stored in 4 bytes as a 32-bit address. The pointer value nil is stored as zero.
Note: On the .NET platform, the size of a pointer will vary at runtime. Therefore, SizeOf(pointer) is not a compile-time
constant, as it is on the Win32 platform.
The length byte and the characters are considered unsigned values. Maximum string length is 255 characters plus a length byte
(string[255]).
Note: On the .NET platform, the short string type is implemented as an array of unsigned bytes.
Offset Contents
-8 32-bit reference-count
-4 length in bytes
0..Length - 1 character string
Length NULL character
The NULL character at the end of a long string memory block is automatically maintained by the compiler and the built-in string
handling routines. This makes it possible to typecast a long string directly to a null-terminated string.
For string constants and literals, the compiler generates a memory block with the same layout as a dynamically allocated string,
but with a reference count of -1. When a long string variable is assigned a string constant, the string pointer is assigned the
3 address of the memory block generated for the string constant. The built-in string handling routines know not to attempt to modify
blocks that have a reference count of -1.
Note: On the .NET platform, an AnsiString is implemented as an array of unsigned bytes. The information above on string
constants and literals does not apply to the .NET platform.
648
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
the string variable. For a nonempty string value, the string pointer points to a dynamically allocated block of memory that
contains the string value in addition to a 32-bit length indicator. The table below shows the layout of a wide string memory block
on Windows.
Offset Contents
-4 32-bit length indicator (in bytes)
0..Length -1 character string
Length NULL character
The string length is the number of bytes, so it is twice the number of wide characters contained in the string.
The NULL character at the end of a wide string memory block is automatically maintained by the compiler and the built-in string
handling routines. This makes it possible to typecast a wide string directly to a null-terminated string.
On the .NET platform, String and WideString types are implemented using the System.String type. An empty string is not a nil
pointer, and the string data is not terminated with a null character.
Set Types
A set is a bit array where each bit indicates whether an element is in the set or not. The maximum number of elements in a set is
256, so a set never occupies more than 32 bytes. The number of bytes occupied by a particular set is equal to (Max div 8) (Min
div 8) + 1, where Max and Min are the upper and lower bounds of the base type of the set. The byte number of a specific
element E is (E div 8) (Min div 8) and the bit number within that byte is E mod 8, where E denotes the ordinal value of the
element. When possible, the compiler stores sets in CPU registers, but a set always resides in memory if it is larger than the
generic Integer type or if the program contains code that takes the address of the set.
Note: On the .NET platform, sets containing more than 32 elements are implemented as an array of bytes. The set type in
Delphi for .NET is not CLS compliant, therefore other .NET languages cannot use them.
On the .NET platform, static are implemented using the System.Array type. Memory layout is therefore determined by the
System.Array type.
On the .NET platform, dynamic arrays and open array parameters are implemented using the System.Array type. As with static
649
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Record Types
On the .NET platform, field layout in record types is determined at runtime, and can vary depending on the architecture of the
target hardware. The following discussion of record alignment applies to the Win32 platform only (packed records are supported
on the .NET platform, however).
When a record type is declared in the {$A+} state (the default), and when the declaration does not include a packed modifier,
the type is an unpacked record type, and the fields of the record are aligned for efficient access by the CPU. The alignment is
controlled by the type of each field and by whether fields are declared together. Every data type has an inherent alignment,
which is automatically computed by the compiler. The alignment can be 1, 2, 4, or 8, and represents the byte boundary that a
value of the type must be stored on to provide the most efficient access. The table below lists the alignments for all data types.
Type Alignment
Ordinal types size of the type (1, 2, 4, or 8)
Real types 2 for Real48, 4 for Single, 8 for Double and Extended
Short string types 1
Array types same as the element type of the array.
Record types the largest alignment of the fields in the record
Set types size of the type if 1, 2, or 4, otherwise 1
All other types determined by the $A directive.
To ensure proper alignment of the fields in an unpacked record type, the compiler inserts an unused byte before fields with an
alignment of 2, and up to three unused bytes before fields with an alignment of 4, if required. Finally, the compiler rounds the
total size of the record upward to the byte boundary specified by the largest alignment of any of the fields.
If two fields share a common type specification, they are packed even if the declaration does not include the packed modifier
and the record type is not declared in the {$A-} state. Thus, for example, given the following declaration
type
TMyRecord = record
A, B: Extended;
C: Extended;
end;
A and B are packed (aligned on byte boundaries) because they share the same type specification. The compiler pads the
structure with unused bytes to ensure that C appears on a quadword boundary.
When a record type is declared in the {$A-} state, or when the declaration includes the packed modifier, the fields of the record
are not aligned, but are instead assigned consecutive offsets. The total size of such a packed record is simply the size of all the
fields. Because data alignment can change, it's a good idea to pack any record structure that you intend to write to disk or pass
in memory to another module compiled using a different version of the compiler.
File Types
3
The following discussion of file types applies to the Win32 platform only. On the .NET platform, text files are implemented with a
class (as opposed to a record). Binary file types (e.g. File of MyType) are not supported on the .NET platform.
On the Win32 platform, file types are represented as records. Typed files and untyped files occupy 332 bytes, which are laid out
as follows:
type
TFileRec = packed record
Handle: Integer;
650
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Mode: word;
Flags: word;
case Byte of
0: (RecSize: Cardinal);
1: (BufSize: Cardinal;
BufPos: Cardinal;
BufEnd: Cardinal;
BufPtr: PChar;
OpenFunc: Pointer;
InOutFunc: Pointer;
FlushFunc: Pointer;
CloseFunc: Pointer;
UserData: array[1..32] of Byte;
Name: array[0..259] of Char; );
end;
Text files occupy 460 bytes, which are laid out as follows:
type
TTextBuf = array[0..127] of Char;
TTextRec = packed record
Handle: Integer;
Mode: word;
Flags: word;
BufSize: Cardinal;
BufPos: Cardinal;
BufEnd: Cardinal;
BufPtr: PChar;
OpenFunc: Pointer;
InOutFunc: Pointer;
FlushFunc: Pointer;
CloseFunc: Pointer;
UserData: array[1..32] of Byte;
Name: array[0..259] of Char;
Buffer: TTextBuf;
end;
Handle contains the file's handle (when the file is open).
The UserData field is available for user-written routines to store data in.
Name contains the file name, which is a sequence of characters terminated by a null character (#0).
For typed files and untyped files, RecSize contains the record length in bytes, and the Private field is unused but reserved.
For text files, BufPtr is a pointer to a buffer of BufSize bytes, BufPos is the index of the next character in the buffer to read or 3
write, and BufEnd is a count of valid characters in the buffer. OpenFunc, InOutFunc, FlushFunc, and CloseFunc are pointers to
the I/O routines that control the file; see Device functions. Flags determines the line break style as follows:
651
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Procedural Types
On the Win32 platform, a procedure pointer is stored as a 32-bit pointer to the entry point of a procedure or function. A method
pointer is stored as a 32-bit pointer to the entry point of a method, followed by a 32-bit pointer to an object.
On the .NET platform, procedural types are implemented using the System.MulticastDelegate class types.
Class Types
The following discussion of the internal layout of class types applies to the Win32 platform only. On the .NET platform, class
layout is determined at runtime. Runtime type information is obtained using the System.Reflection APIs in the .NET framework.
On the Win32 platform, a class-type value is stored as a 32-bit pointer to an instance of the class, which is called an object. The
internal data format of an object resembles that of a record. The object's fields are stored in order of declaration as a sequence
of contiguous variables. Fields are always aligned, corresponding to an unpacked record type. Any fields inherited from an
ancestor class are stored before the new fields defined in the descendant class.
The first 4-byte field of every object is a pointer to the virtual method table (VMT) of the class. There is exactly one VMT per
class (not one per object); distinct class types, no matter how similar, never share a VMT. VMT's are built automatically by the
compiler, and are never directly manipulated by a program. Pointers to VMT's, which are automatically stored by constructor
methods in the objects they create, are also never directly manipulated by a program.
The layout of a VMT is shown in the following table. At positive offsets, a VMT consists of a list of 32-bit method pointersone per
user-defined virtual method in the class typein order of declaration. Each slot contains the address of the corresponding virtual
method's entry point. This layout is compatible with a C++ v-table and with COM. At negative offsets, a VMT contains a number
of fields that are internal to Delphi's implementation. Applications should use the methods defined in TObject to query this
information, since the layout is likely to change in future implementations of the Delphi language.
652
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
On the .NET platform, class reference types are implemented using compiler-constructed nested classes inside the class type
they support. These implementation details are subject to change in future compiler releases.
Variant Types
The following discussion of the internal layout of variant types applies to the Win32 platform only. On the .NET platform, variants
are an alias of System.Object. Variants rely on boxing and unboxing of data into an object wrapper, as well as Delphi helper
classes to implement the variant-related RTL functions.
On the Win32 platform, a variant is stored as a 16-byte record that contains a type code and a value (or a reference to a value)
of the type given by the code. The System and Variants units define constants and types for variants.
The TVarData type represents the internal structure of a Variant variable (on Windows, this is identical to the Variant type used
by COM and the Win32 API). The TVarData type can be used in typecasts of Variant variables to access the internal structure of
a variable. The TVarData record contains the following fields:
• VType contains the type code of the variant in the lower twelve bits (the bits defined by the varTypeMask constant). In
addition, the varArray bit may be set to indicate that the variant is an array, and the varByRef bit may be set to indicate that
the variant contains a reference as opposed to a value.
• The Reserved1, Reserved2, and Reserved3 fields are unused.
The contents of the remaining eight bytes of a TVarData record depend on the VType field as follows:
• If neither the varArray nor the varByRef bits are set, the variant contains a value of the given type.
• If the varArray bit is set, the variant contains a pointer to a TVarArray structure that defines an array. The type of each array
element is given by the varTypeMask bits in the VType field.
• If the varByRef bit is set, the variant contains a reference to a value of the type given by the varTypeMask and varArray bits in
the VType field.
The varString type code is private. Variants containing a varString value should never be passed to a non-Delphi function. On
Win32, Delphi's Automation support automatically converts varString variants to varOleStr variants before passing them as
parameters to external functions.
See Also
Memory Management on the Win32 Platform ( see page 644)
653
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Note: A constructor can initialize fields from its own class, prior to calling the inherited constructor.
Finalization
Every class in the .NET Framework (including VCL.NET classes) inherits a method called Finalize. The garbage collector calls
the Finalize method when the memory for the object is about to be freed. Since the method is called by the garbage collector,
you have no control over when it is called. The asynchronous nature of finalization is a problem for objects that open resources
such as file handles and database connections, because the Finalize method might not be called for some time, leaving these
connections open.
To add a finalizer to a class, override the strict protected Finalize procedure that is inherited from TObject. The .NET
platform places limits on what you can do in a finalizer, because it is called when the garbage collector is cleaning up objects.
The finalizer may execute in a different thread than the thread the object was was created in. A finalizer cannot allocate new
memory, and cannot make calls outside of itself. If your class has references to other objects, a finalizer can refer to them (that
is, their memory is guaranteed not to have been freed yet), but be aware that their state is undefined, as you do not know
whether they have been finalized yet.
When a class has a finalizer, the CLR must add newly instantiated objects of the class to the finalization list. Further, objects with
finalizers tend to persist in memory longer, as they are not freed when the garbage collector first determines that they are no
longer actively referenced. If the object has references to other objects, those objects are also not freed right away (even if they
don’t have finalizers themselves), but must also persist in memory until the original object is finalized. Therefore, finalizers do
impart a fair amount of overhead in terms of memory consumption and execution performance, so they should be used
judiciously.
It is a good practice to restrict finalizers to small objects that represent unmanaged resources. Classes that use these resources
can then hold a reference to the small object with the finalizer. In this way, big classes, and classes that reference many other
classes, do not hoard memory because of a finalizer.
Another good practice is to suppress finalizers when a particular resource has already been released in a destructor. After
freeing the resources, you can call SuppressFinalize, which causes the CLR to remove the object from the finalization list. Be
careful not to call SuppressFinalize with a nil reference, as that causes a runtime exception.
Delphi for .NET classes are free to use the Finalize method for freeing system resources, however the recommended method is
to implement the dispose pattern. The Delphi for .NET compiler recognizes a very specific destructor pattern in your class, and
implements the IDisposable interface for you. This enables you to continue writing new code for the .NET platform the same way
you always have, while allowing much of your existing Win32 Delphi code to run in the garbage collected environment of the
CLR.
654
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Unit finalization is subject to the same constraints and difficulties as the Finalize method of objects. Specifically, unit finalization
is asynchronous, and, there no way to determine when it will happen (or if it will happen, though under most circumstances, it
will).
Typical tasks performed in a unit finalization include freeing global objects, unregistering objects that are used by other units, and
freeing resources. Because .NET is a memory managed environment, the garbage collector will free global objects even if the
unit finalization section is not called. The units in an application domain are loaded and unloaded together, so you do not need to
worry about unregistering objects. All units that can possibly refer to each other (even in different assemblies) are released at the
same time. Since object references do not cross application domains, there is no danger of something keeping a dangling 3
reference to an object type or code that has been unloaded from memory.
Freeing resources (such as file handles or window handles) is the most important consideration in unit finalization. Because unit
finalization sections are not guaranteed to be called, you may want to rewrite your code to handle this issue using finalizers
rather than relying on the unit finalization.
The main points to keep in mind for unit initialization and finalization on the .NET platform are:
1. The Finalize method is called asynchronously (both for objects, and for units).
655
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
2. Finalization and destructors are used to free unmanaged resources such as file handles. You do not need to destroy object
member variables; the garbage collector takes care of this for you.
3. Classes should rely on the compiler's implementation of IDisposable, and provide a destructor called Destroy.
4. If a class implements IDisposable itself, it cannot have a destructor called Destroy.
5. Reference counting is deprecated. Try to use the destructor Destroy; override; pattern wherever possible.
6. Unit initialization should not depend on side effects produced by initialization of dependent units.
Unit Initialization Considerations for Assemblies and Dynamically Linked Packages
Under Win32, the Delphi compiler uses the DllMain function as a hook from which to execute unit initialization code. No such
execution path exists in the .NET environment. Fortunately, other means of implementing unit initialization exist in the .NET
Framework. However, the differences in the implementation between Win32 and .NET could impact the order of unit initialization
in your application.
The Delphi for .NET compiler uses CLS-compliant class constructors to implement unit initialization hooks. The CLR requires
that every object type have a class constructor. These constructors, or type initializers, are guaranteed to be executed at most
one time. Class constructors are executed at most one time, because in order for the type to be loaded, it must be used. That is,
the assembly containing a type will not be loaded until the type is actually used at runtime. If the assembly is never loaded, its
unit initialization section will never run.
Circular unit references also impact the unit initialization process. If unit A uses unit B, and unit B then uses unit A in its
implementation section, the order of unit initialization is undefined. To fully understand the possibilities, it is helpful to look at the
process one step at a time.
1. Unit A's initialization section uses a type from unit B. If this is the first reference to the type, the CLR will load its assembly,
triggering the unit initialization of unit B.
2. As a consequence, loading and initializing unit B occurs before unit A's initialization section has completed execution. Note
this is a change from how unit initialization works under Win32.
3. Suppose that unit B's initialization is in progress, and that a type from unit A is used. Unit A has not completed initialization,
and such a reference could cause an access violation.
The unit initialization should only use types defined within that unit. Using types from outside the unit will impact unit initialization,
and could cause an access violation, as noted above.
Unit initialization for DLLs happens automatically; it is triggered when a type within the DLL is referenced. Applications created
with other .NET languages can use Delphi for .NET assemblies without concern for the details of unit initialization.
See Also
Memory Management on the Win32 Platform ( see page 644)
656
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Topics
Name Description
Language Overview ( see page 657) Delphi is a high-level, compiled, strongly typed language that supports structured
and object-oriented design. Based on Object Pascal, its benefits include
easy-to-read code, quick compilation, and the use of multiple unit files for
modular programming. Delphi has special features that support CodeGear's
component framework and RAD environment. For the most part, descriptions and
examples in this language guide assume that you are using CodeGear
development tools.
Most developers using CodeGear software development tools write and compile
their code in the integrated development environment (IDE). CodeGear
development tools handle many details of setting up projects and source files,
such as maintenance... more ( see page 657)
Most developers using CodeGear software development tools write and compile their code in the integrated development
environment (IDE). CodeGear development tools handle many details of setting up projects and source files, such as
maintenance of dependency information among units. The product also places constraints on program organization that are not,
strictly speaking, part of the Object Pascal language specification. For example, CodeGear development tools enforce certain
file- and program-naming conventions that you can avoid if you write your programs outside of the IDE and compile them from
the command prompt.
This language guide generally assumes that you are working in the IDE and that you are building applications that use the
CodeGear Visual Component Library (VCL). Occasionally, however, Delphi-specific rules are distinguished from rules that apply
to all Object Pascal programming. This text covers both the Win32 Delphi language compiler, and the Delphi for .NET language
compiler. Platform-specific language differences and features are noted where necessary.
• Program Organization. Covers the basic language features that allow you to partition your application into units and
namespaces.
• Example Programs. Small examples of both console and GUI applications are shown, with basic instructions on running the
compiler from the command-line.
Program Organization
Delphi programs are usually divided into source-code modules called units. Most programs begin with a program heading,
which specifies a name for the program. The program heading is followed by an optional uses clause, then a block of
declarations and statements. The uses clause lists units that are linked into the program; these units, which can be shared by
different programs, often have uses clauses of their own.
The uses clause provides the compiler with information about dependencies among modules. Because this information is stored
in the modules themselves, most Delphi language programs do not require makefiles, header files, or preprocessor "include"
directives. 3
657
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Unit source files typically contain most of the code in an application. Each application has a single project file and several unit
files; the project file, which corresponds to the program file in traditional Pascal, organizes the unit files into an application.
CodeGear development tools automatically maintain a project file for each application.
If you are compiling a program from the command line, you can put all your source code into unit (.pas) files. If you use the IDE
to build your application, it will produce a project (.dpr) file.
Package source files are similar to project files, but they are used to construct special dynamically linkable libraries called
packages.
• VCL form files (which have a .dfm extension on Win32, and .nfm on .NET)
• Resource files (which end with .res)
• Project options files (which end with .dof )
A VCL form file contains the description of the properties of the form and the components it owns. Each form file represents a
single form, which usually corresponds to a window or dialog box in an application. The IDE allows you to view and edit form
files as text, and to save form files as either text (a format very suitable for version control) or binary. Although the default
behavior is to save form files as text, they are usually not edited manually; it is more common to use CodeGear's visual
design tools for this purpose. Each project has at least one form, and each form has an associated unit (.pas) file that, by
default, has the same name as the form file.
In addition to VCL form files, each project uses a resource (.res) file to hold the application's icon and other resources such as
strings. By default, this file has the same name as the project (.dpr) file.
A project options (.dof) file contains compiler and linker settings, search path information, version information, and so forth. Each
project has an associated project options file with the same name as the project (.dpr) file. Usually, the options in this file are
set from Project Options dialog.
Various tools in the IDE store data in files of other types. Desktop settings (.dsk) files contain information about the arrangement
of windows and other configuration options; desktop settings can be project-specific or environment-wide. These files have no
direct effect on compilation.
Compiler-Generated Files
The first time you build an application or a package, the compiler produces a compiled unit file (.dcu on Win32, .dcuil on .NET)
for each new unit used in your project; all the .dcu/.dcuil files in your project are then linked to create a single executable or
shared package. The first time you build a package, the compiler produces a file for each new unit contained in the package, and
then creates both a .dcp and a package file.If you use the GD switch, the linker generates a map file and a .drc file; the .drc file,
which contains string resources, can be compiled into a resource file.
When you build a project, individual units are not recompiled unless their source (.pas) files have changed since the last
compilation, their .dcu/.dpu files cannot be found, you explicitly tell the compiler to reprocess them, or the interface of the unit
depends on another unit which has been changed. In fact, it is not necessary for a unit's source file to be present at all, as long
as the compiler can find the compiled unit file and that unit has no dependencies on other units that have changed.
Example Programs
The examples that follow illustrate basic features of Delphi programming. The examples show simple applications that would not
3
normally be compiled from the IDE; you can compile them from the command line.
{$APPTYPE CONSOLE}
658
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
begin
MyMessage := 'Hello world!';
Writeln(MyMessage);
end.
The first line declares a program called Greeting. The {$APPTYPE CONSOLE} directive tells the compiler that this is a console
application, to be run from the command line. The next line declares a variable called MyMessage, which holds a string. (Delphi
has genuine string data types.) The program then assigns the string "Hello world!" to the variable MyMessage, and sends the
contents of MyMessage to the standard output using the Writeln procedure. (Writeln is defined implicitly in the System unit,
which the compiler automatically includes in every application.)
You can type this program into a file called greeting.pas or greeting.dpr and compile it by entering
dcc32 greeting
to produce a managed .NET executable. In either case, the resulting executable prints the message Hello world!
Aside from its simplicity, this example differs in several important ways from programs that you are likely to write with CodeGear
development tools. First, it is a console application. CodeGear development tools are most often used to write applications with
graphical interfaces; hence, you would not ordinarily call Writeln. Moreover, the entire example program (save for Writeln) is
in a single file. In a typical GUI application, the program heading the first line of the example would be placed in a separate
project file that would not contain any of the actual application logic, other than a few calls to routines defined in unit files.
{$APPTYPE CONSOLE}
uses Unit1;
begin
PrintMessage('Hello World!');
end.
The first line declares a program called greeting, which, once again, is a console application. The uses Unit1; clause tells
the compiler that the program greeting depends on a unit called Unit1. Finally, the program calls the PrintMessage
procedure, passing to it the string Hello World! The PrintMessage procedure is defined in Unit1. Here is the source code
for Unit1, which must be saved in a file called Unit1.pas:
unit Unit1;
interface
end.
659
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Unit1 defines a procedure called PrintMessage that takes a single string as an argument and sends the string to the standard
output. (In Delphi, routines that do not return a value are called procedures. Routines that return a value are called functions.)
Notice that PrintMessage is declared twice in Unit1. The first declaration, under the reserved word interface, makes
PrintMessage available to other modules (such as greeting) that use Unit1. The second declaration, under the reserved
word implementation, actually defines PrintMessage.
You can now compile Greeting from the command line by entering
dcc32 greeting
There is no need to include Unit1 as a command-line argument. When the compiler processes greeting.dpr, it automatically
looks for unit files that the greeting program depends on. The resulting executable does the same thing as our first example: it
prints the message Hello world!
A VCL Application
Our next example is an application built using the Visual Component Library (VCL) components in the IDE. This program uses
automatically generated form and resource files, so you won't be able to compile it from the source code alone. But it illustrates
important features of the Delphi Language. In addition to multiple units, the program uses classes and objects ( see page 514)
The program includes a project file and two new unit files. First, the project file:
program greeting;
begin
// Calls to global Application instance
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
Once again, our program is called greeting. It uses three units: Forms, which is part of VCL; Unit1, which is associated with
the application's main form (Form1); and Unit2, which is associated with another form (Form2).
The program makes a series of calls to an object named Application, which is an instance of the TApplication class defined in
the Forms unit. (Every project has an automatically generated Application object.) Two of these calls invoke a TApplication
method named CreateForm. The first call to CreateForm creates Form1, an instance of the TForm1 class defined in Unit1. The
second call to CreateForm creates Form2, an instance of the TForm2 class defined in Unit2.
Unit1 looks like this:
unit Unit1;
3 interface
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;
660
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
end.
Unit1 creates a class named TForm1 (derived from TForm) and an instance of this class, Form1. TForm1 includes a
buttonButton1, an instance of TButton and a procedure named Button1Click that is called when the user presses
Button1. Button1Click hides Form1 and it displays Form2 (the call to Form2.ShowModal).
Note: In the previous example, Form2.ShowModal relies on the use of auto-created forms. While this is fine for example code,
using auto-created forms is actively discouraged.
Form2 is defined in Unit2:
unit Unit2;
interface
type
TForm2 = class(TForm)
Label1: TLabel;
CancelButton: TButton;
procedure CancelButtonClick(Sender: TObject);
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
end.
Unit2 creates a class named TForm2 and an instance of this class, Form2. TForm2 includes a button (CancelButton, an
instance of TButton) and a label (Label1, an instance of TLabel). You can't see this from the source code, but Label1 displays 3
a caption that reads Hello world! The caption is defined in Form2's form file, Unit2.dfm.
TForm2 declares and defines a method CancelButtonClick which will be invoked at runtime whenever the user presses
CancelButton. This procedure (along with Unit1's TForm1.Button1Click) is called an event handler because it responds
to events that occur while the program is running. Event handlers are assigned to specific events by the form files for Form1 and
Form2.
When the greeting program starts, Form1 is displayed and Form2 is invisible. (By default, only the first form created in the
project file is visible at runtime. This is called the project's main form.) When the user presses the button on Form1, Form2,
661
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
displays the Hello world! greeting. When the user presses the CancelButton or the Close button on the title bar, Form2
closes.
See Also
Programs and Units ( see page 683)
Topics
Name Description
Procedures and Functions ( see page 662) This topic covers the following items:
• Parameter semantics
• String parameters
• Array parameters
• Default parameters
662
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Function calls, because they return a value, can be used as expressions in assignments and operations. For example,
I := SomeFunction(X);
calls SomeFunction and assigns the result to I. Function calls cannot appear on the left side of an assignment statement.
Procedure calls - and, when extended syntax is enabled ({$X+}), function calls - can be used as complete statements. For
example,
DoSomething;
calls the DoSomething routine; if DoSomething is a function, its return value is discarded.
Procedure Declarations
A procedure declaration has the form
procedure procedureName(parameterList); directives;
localDeclarations;
begin
statements
end;
where procedureName is any valid identifier, statements is a sequence of statements that execute when the procedure is called,
and (parameterList), directives;, and localDeclarations; are optional.
Function Declarations
A function declaration is like a procedure declaration except that it specifies a return type and a return value. Function
663
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
The function's statement block is governed by the same rules that apply to procedures. Within the statement block, you can use
variables and other identifiers declared in the localDeclarations part of the function, parameter names from the parameter list,
and any identifiers within whose scope the function declaration falls. In addition, the function name itself acts as a special
variable that holds the function's return value, as does the predefined variable Result.
As long as extended syntax is enabled ({$X+}), Result is implicitly declared in every function. Do not try to redeclare it.
For example,
function WF: Integer;
begin
WF := 17;
end;
defines a constant function called WF that takes no parameters and always returns the integer value 17. This declaration is
equivalent to
function WF: Integer;
begin
Result := 17;
end;
Here is a more complicated function declaration:
function Max(A: array of Real; N: Integer): Real;
var
X: Real;
I: Integer;
begin
X := A[0];
for I := 1 to N - 1 do
if X < A[I] then X := A[I];
Max := X;
end;
You can assign a value to Result or to the function name repeatedly within a statement block, as long as you assign only values
that match the declared return type. When execution of the function terminates, whatever value was last assigned to Result or to
the function name becomes the function's return value. For example,
function Power(X: Real; Y: Integer): Real;
var
I: Integer;
begin
Result := 1.0;
I := Y;
3 while I > 0 do
begin
if Odd(I) then Result := Result * X;
I := I div 2;
X := Sqr(X);
end;
end;
Result and the function name always represent the same value. Hence
function MyFunction: Integer;
664
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
begin
MyFunction := 5;
Result := Result * 2;
MyFunction := Result + 1;
end;
returns the value 11. But Result is not completely interchangeable with the function name. When the function name appears on
the left side of an assignment statement, the compiler assumes that it is being used (like Result) to track the return value; when
the function name appears anywhere else in the statement block, the compiler interprets it as a recursive call to the function
itself. Result, on the other hand, can be used as a variable in operations, typecasts, set constructors, indexes, and calls to other
routines.
If the function exits without assigning a value to Result or the function name, then the function's return value is undefined.
Calling Conventions
When you declare a procedure or function, you can specify a calling convention using one of the directives register, pascal,
cdecl, stdcall, and safecall. For example,
function MyFunction(X, Y: Real): Real; cdecl;
Calling conventions determine the order in which parameters are passed to the routine. They also affect the removal of
parameters from the stack, the use of registers for passing parameters, and error and exception handling. The default calling
convention is register.
• The register and pascal conventions pass parameters from left to right; that is, the left most parameter is evaluated and
passed first and the rightmost parameter is evaluated and passed last. The cdecl, stdcall, and safecall conventions pass
parameters from right to left.
• For all conventions except cdecl, the procedure or function removes parameters from the stack upon returning. With the
cdecl convention, the caller removes parameters from the stack when the call returns.
• The register convention uses up to three CPU registers to pass parameters, while the other conventions pass all parameters
on the stack.
• The safecall convention implements exception 'firewalls.' On Win32, this implements interprocess COM error notification.
The table below summarizes calling conventions.
Calling conventions
The default register convention is the most efficient, since it usually avoids creation of a stack frame. (Access methods for
published properties must use register.) The cdecl convention is useful when you call functions from shared libraries written in
3
C or C++, while stdcall and safecall are recommended, in general, for calls to external code. On Win32, the operating system
APIs are stdcall and safecall. Other operating systems generally use cdecl. (Note that stdcall is more efficient than cdecl.)
The safecall convention must be used for declaring dual-interface methods. The pascal convention is maintained for backward
compatibility.
The directives near, far, and export refer to calling conventions in 16-bit Windows programming. They have no effect in Win32,
or in .NET applications and are maintained for backward compatibility only.
665
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
A forward declaration and its defining declaration must appear in the same type declaration section. That is, you can't add a
new section (such as a var section or const section) between the forward declaration and the defining declaration. The defining
declaration can be an external or assembler declaration, but it cannot be another forward declaration.
The purpose of a forward declaration is to extend the scope of a procedure or function identifier to an earlier point in the source
code. This allows other procedures and functions to call the forward-declared routine before it is actually defined. Besides letting
you organize your code more flexibly, forward declarations are sometimes necessary for mutual recursions.
The forward directive has no effect in the interface section of a unit. Procedure and function headers in the interface section
behave like forward declarations and must have defining declarations in the implementation section. A routine declared in the
interface section is available from anywhere else in the unit and from any other unit or program that uses the unit where it is
declared.
External Declarations
The external directive, which replaces the block in a procedure or function declaration, allows you to call routines that are
compiled separately from your program. External routines can come from object files or dynamically loadable libraries.
When importing a C function that takes a variable number of parameters, use the varargs directive. For example,
function printf(Format: PChar): Integer; cdecl; varargs;
The varargs directive works only with external routines and only with the cdecl calling convention.
On the Win32 platform, declarations like the ones above are frequently used to access external routines written in assembly
language. You can also place assembly-language routines directly in your Delphi source code.
666
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
externalstringConstant;
to the end of a normal procedure or function header, where stringConstant is the name of the library file in single quotation
marks. For example, on Win32
function SomeFunction(S: string): string; external 'strlib.dll';
imports a function called SomeFunction from strlib.dll.
You can import a routine under a different name from the one it has in the library. If you do this, specify the original name in the
external directive:
externalstringConstant1namestringConstant2;
where the first stringConstant gives the name of the library file and the second stringConstant is the routine's original name.
The following declaration imports a function from user32.dll (part of the Win32 API).
function MessageBox(HWnd: Integer; Text, Caption: PChar; Flags: Integer): Integer; stdcall;
external 'user32.dll' name 'MessageBoxA';
The function's original name is MessageBoxA, but it is imported as MessageBox.
Instead of a name, you can use a number to identify the routine you want to import:
externalstringConstantindexintegerConstant;
In your importing declaration, be sure to match the exact spelling and case of the routine's name. Later, when you call the
imported routine, the name is case-insensitive.
You can pass to an overloaded routine parameters that are not identical in type with those in any of the routine's declarations,
but that are assignment-compatible with the parameters in more than one declaration. This happens most frequently when a
routine is overloaded with different integer types or different real types - for example,
procedure Store(X: Longint); overload;
3
procedure Store(X: Shortint); overload;
In these cases, when it is possible to do so without ambiguity, the compiler invokes the routine whose parameters are of the type
with the smallest range that accommodates the actual parameters in the call. (Remember that real-valued constant expressions
are always of type Extended.)
Overloaded routines must be distinguished by the number of parameters they take or the types of their parameters. Hence the
following pair of declarations causes a compilation error.
667
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
When an overloaded routine is declared in a forward or interface declaration, the defining declaration must repeat the routine's
parameter list.
The compiler can distinguish between overloaded functions that contain AnsiString/PChar and WideString/WideChar
parameters in the same parameter position. String constants or literals passed into such an overload situation are translated into
the native string or character type, which is AnsiString/PChar.
procedure test(const S: String); overload;
procedure test(const W: WideString); overload;
var
a: string;
b: widestring;
begin
a := 'a';
b := 'b';
test(a); // calls String version
test(b); // calls WideString version
test('abc'); // calls String version
test(WideString('abc')); // calls widestring version
end;
Variants can also be used as parameters in overloaded function declarations. Variant is considered more general than any
simple type. Preference is always given to exact type matches over variant matches. If a variant is passed into such an overload
situation, and an overload that takes a variant exists in that parameter position, it is considered to be an exact match for the
Variant type.
This can cause some minor side effects with float types. Float types are matched by size. If there is no exact match for the float
variable passed to the overload call but a variant parameter is available, the variant is taken over any smaller float type.
For example:
procedure foo(i: integer); overload;
procedure foo(d: double); overload;
procedure foo(v: variant); overload;
var
v: variant;
begin
foo(1); // integer version
foo(v); // variant version
foo(1.2); // variant version (float literals -> extended precision)
end;
3 This example calls the variant version of foo, not the double version, because the 1.2 constant is implicitly an extended type and
extended is not an exact match for double. Extended is also not an exact match for Variant, but Variant is considered a more
general type (whereas double is a smaller type than extended).
foo(Double(1.2));
This typecast does not work. You should use typed consts instead.
const d: double = 1.2;
begin
668
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
foo(d);
end;
The above code works correctly, and calls the double version.
const s: single = 1.2;
begin
foo(s);
end;
The above code also calls the double version of foo. Single is a better fit to double than to variant.
When declaring a set of overloaded routines, the best way to avoid float promotion to variant is to declare a version of your
overloaded function for each float type (Single, Double, Extended) along with the variant version.
If you use default parameters in overloaded routines, be careful not to introduce ambiguous parameter signatures.
You can limit the potential effects of overloading by qualifying a routine's name when you call it. For example,
Unit1.MyProcedure(X, Y) can call only routines declared in Unit1; if no routine in Unit1 matches the name and
parameter list in the call, an error results.
Local Declarations
The body of a function or procedure often begins with declarations of local variables used in the routine's statement block. These
declarations can also include constants, types, and other routines. The scope of a local identifier is limited to the routine where it
is declared.
Nested Routines
Functions and procedures sometimes contain other functions and procedures within the local-declarations section of their blocks.
For example, the following declaration of a procedure called DoSomething contains a nested procedure.
procedure DoSomething(S: string);
var
X, Y: Integer;
begin
...
NestedProc(S);
...
end;
The scope of a nested routine is limited to the procedure or function in which it is declared. In our example, NestedProc can be
called only within DoSomething.
For real examples of nested routines, look at the DateTimeToString procedure, the ScanDate function, and other routines in the
SysUtils unit.
See Also
Parameters ( see page 672) 3
Calling Procedures and Functions ( see page 669)
669
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
• expressions used to pass typed const and value parameters must be assignment-compatible with the corresponding formal
parameters.
• expressions used to pass var and out parameters must be identically typed with the corresponding formal parameters, unless
the formal parameters are untyped.
• only assignable expressions can be used to pass var and out parameters.
• if a routine's formal parameters are untyped, numerals and true constants with numeric values cannot be used as actual
parameters.
When you call a routine that uses default parameter values, all actual parameters following the first accepted default must also
use the default values; calls of the form SomeFunction(,,X) are not legal.
You can omit parentheses when passing all and only the default parameters to a routine. For example, given the procedure
procedure DoSomething(X: Real = 1.0; I: Integer = 0; S: string = '');
the following calls are equivalent.
DoSomething();
DoSomething;
Open Array Constructors
Open array constructors allow you to construct arrays directly within function and procedure calls. They can be passed only as
open array parameters or variant open array parameters.
An open array constructor, like a set constructor, is a sequence of expressions separated by commas and enclosed in brackets.
670
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
inline directive to improve performance. If the function or procedure meets certain criteria, the compiler will insert code directly,
rather than generating a call. Inlining is a performance optimization that can result in faster code, but at the expense of space.
Inlining always causes the compiler to produce a larger binary file. The inline directive is used in function and procedure
declarations and definitions, like other directives.
procedure MyProc(x:Integer); inline;
begin
// ...
end;
• Inlining will not occur on any form of late-bound method. This includes virtual, dynamic, and message methods.
• Routines containing assembly code will not be inlined.
• Constructors and destructors will not be inlined.
• The main program block, unit initialization, and unit finalization blocks cannot be inlined.
• Routines that are not defined before use cannot be inlined.
• Routines that take open array parameters cannot be inlined.
• Code can be inlined within packages, however, inlining never occurs across package boundaries.
• No inlining will be done between units that are circularly dependent. This included indirect circular dependencies, for example,
unit A uses unit B, and unit B uses unit C which in turn uses unit A. In this example, when compiling unit A, no code from unit
B or unit C will be inlined in unit A.
• The compiler can inline code when a unit is in a circular dependency, as long as the code to be inlined comes from a unit
outside the circular relationship. In the above example, if unit A also used unit D, code from unit D could be inlined in A, since
it is not involved in the circular dependency.
• If a routine is defined in the interface section and it accesses symbols defined in the implementation section, that routine
cannot be inlined.
• In Delphi.NET, routines in classes cannot be inlined if they access members with less (i.e. more restricted) visibility than the
method itself. For example, if a public method accesses private symbols, it cannot be inlined.
• If a routine marked with inline uses external symbols from other units, all of those units must be listed in the uses statement,
otherwise the routine cannot be inlined.
• Procedures and functions used in conditional expressions in while-do and repeat-until statements cannot be expanded
inline.
• Within a unit, the body for an inline function should be defined before calls to the function are made. Otherwise, the body of
the function, which is not known to the compiler when it reaches the call site, cannot be expanded inline.
If you modify the implementation of an inlined routine, you will cause all units that use that function to be recompiled. This is
different from traditional rebuild rules, where rebuilds were triggered only by changes in the interface section of a unit.
3
The {$INLINE} compiler directive gives you finer control over inlining. The {$INLINE} directive can be used at the site of the
inlined routine's definition, as well as at the call site. Below are the possible values and their meaning:
671
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
{$INLINE Behaves like {$INLINE ON}, with the addition that routines not {$INLINE AUTO} has no effect on
AUTO} marked with inline will be inlined if their code size is less than or whether a routine will be inlined when it
equal to 32 bytes. is used at the call site of the routine.
{$INLINE The routine will not be marked as inlineable, even if it is tagged with The routine will not be expanded inline.
OFF} inline.
See Also
Procedures and Functions ( see page 662)
3.1.3.10.3 Parameters
This topic covers the following items:
• Parameter semantics
• String parameters
• Array parameters
• Default parameters
About Parameters
Most procedure and function headers include a parameter list. For example, in the header
function Power(X: Real; Y: Integer): Real;
the parameter list is (X: Real; Y: Integer).
A parameter list is a sequence of parameter declarations separated by semicolons and enclosed in parentheses. Each
declaration is a comma-delimited series of parameter names, followed in most cases by a colon and a type identifier, and in
some cases by the = symbol and a default value. Parameter names must be valid identifiers. Any declaration can be preceded
by var, const, or out. Examples:
(X, Y: Real)
(var S: string; X: Integer)
(HWnd: Integer; Text, Caption: PChar; Flags: Integer)
(const P; I: Integer)
The parameter list specifies the number, order, and type of parameters that must be passed to the routine when it is called. If a
routine does not take any parameters, omit the identifier list and the parentheses in its declaration:
procedure UpdateRecords;
begin
...
end;
Within the procedure or function body, the parameter names (X and Y in the first example) can be used as local variables. Do not
redeclare the parameter names in the local declarations section of the procedure or function body.
3 Parameter Semantics
Parameters are categorized in several ways:
• Every parameter is classified as value, variable, constant, or out. Value parameters are the default; the reserved words var,
const, and out indicate variable, constant, and out parameters, respectively.
• Value parameters are always typed, while constant, variable, and out parameters can be either typed or untyped.
• Special rules apply to array parameters.
Files and instances of structured types that contain files can be passed only as variable (var) parameters.
672
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
A value parameter acts like a local variable that gets initialized to the value passed in the procedure or function call. If you pass a
variable as a value parameter, the procedure or function creates a copy of it; changes made to the copy have no effect on the
original variable and are lost when program execution returns to the caller.
A variable parameter, on the other hand, acts like a pointer rather than a copy. Changes made to the parameter within the body
of a function or procedure persist after program execution returns to the caller and the parameter name itself has gone out of
scope.
Even if the same variable is passed in two or more var parameters, no copies are made. This is illustrated in the following
example.
procedure AddOne(var X, Y: Integer);
begin
X := X + 1;
Y := Y + 1;
end;
var I: Integer;
begin
I := 1;
AddOne(I, I);
end; 3
After this code executes, the value of I is 3.
If a routine's declaration specifies a var parameter, you must pass an assignable expression - that is, a variable, typed constant
(in the {$J+} state), dereferenced pointer, field, or indexed variable to the routine when you call it. To use our previous
examples, DoubleByRef(7) produces an error, although DoubleByValue(7) is legal.
Indexes and pointer dereferences passed in var parameters - for example, DoubleByRef(MyArray[I]) - are evaluated once,
before execution of the routine.
673
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Constant Parameters
A constant (const) parameter is like a local constant or read-only variable. Constant parameters are similar to value parameters,
except that you can't assign a value to a constant parameter within the body of a procedure or function, nor can you pass one as
a var parameter to another routine. (But when you pass an object reference as a constant parameter, you can still modify the
object's properties.)
Using const allows the compiler to optimize code for structured - and string-type parameters. It also provides a safeguard
against unintentionally passing a parameter by reference to another routine.
Here, for example, is the header for the CompareStr function in the SysUtils unit:
function CompareStr(const S1, S2: string): Integer;
Because S1 and S2 are not modified in the body of CompareStr, they can be declared as constant parameters.
Out Parameters
An out parameter, like a variable parameter, is passed by reference. With an out parameter, however, the initial value of the
referenced variable is discarded by the routine it is passed to. The out parameter is for output only; that is, it tells the function or
procedure where to store output, but doesn't provide any input.
Out parameters are frequently used with distributed-object models like COM. In addition, you should use out parameters when
you pass an uninitialized variable to a function or procedure.
Untyped Parameters
You can omit type specifications when declaring var, const, and out parameters. (Value parameters must be typed.) For
example,
procedure TakeAnything(const C);
declares a procedure called TakeAnything that accepts a parameter of any type. When you call such a routine, you cannot
pass it a numeral or untyped numeric constant.
Within a procedure or function body, untyped parameters are incompatible with every type. To operate on an untyped parameter,
you must cast it. In general, the compiler cannot verify that operations on untyped parameters are valid.
The following example uses untyped parameters in a function called Equal that compares a specified number of bytes of any
3
two variables.
function Equal(var Source, Dest; Size: Integer): Boolean;
type
TBytes = array[0..MaxInt - 1] of Byte;
var
N : Integer;
begin
N := 0;
while (N < Size) and (TBytes(Dest)[N] = TBytes(Source)[N]) do
674
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Inc(N);
Equal := N = Size;
end;
Given the declarations
type
TVector = array[1..10] of Integer;
TPoint = record
X, Y: Integer;
end;
var
Vec1, Vec2: TVector;
N: Integer;
P: TPoint;
you could make the following calls to Equal:
Equal(Vec1, Vec2, SizeOf(TVector)); // compare Vec1 to Vec2
Equal(Vec1, Vec2, SizeOf(Integer) * N); // compare first N elements of Vec1 and Vec2
Equal(Vec1[1], Vec1[6], SizeOf(Integer) * 5); // compare first 5 to last 5 elements of Vec1
Equal(Vec1[1], P, 4); // compare Vec1[1] to P.X and Vec1[2] to P.Y
String Parameters
When you declare routines that take short-string parameters, you cannot include length specifiers in the parameter declarations.
That is, the declaration
procedure Check(S: string[20]); // syntax error
causes a compilation error. But
type TString20 = string[20];
procedure Check(S: TString20);
is valid. The special identifier OpenString can be used to declare routines that take short-string parameters of varying length:
procedure Check(S: OpenString);
When the {$H} and {$P+} compiler directives are both in effect, the reserved word string is equivalent to OpenString in
parameter declarations.
Short strings, OpenString, $H, and $P are supported for backward compatibility only. In new code, you can avoid these
considerations by using long strings.
Array Parameters
When you declare routines that take array parameters, you cannot include index type specifiers in the parameter declarations.
That is, the declaration
procedure Sort(A: array[1..10] of Integer) // syntax error<
causes a compilation error. But
type TDigits = array[1..10] of Integer;
procedure Sort(A: TDigits);
is valid. Another approach is to use open array parameters.
Since the Delphi language does not implement value semantics for dynamic arrays, 'value' parameters in routines do not 3
represent a full copy of the dynamic array. In this example
type
TDynamicArray = array of Integer;
procedure p(Value: TDynamicArray);
begin
Value[0] := 1;
end;
675
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
procedure Run;
var
a: TDynamicArray;
begin
SetLength(a, 1);
a[0] := 0;
p(a);
Writeln(a[0]); // Prints '1'
end;
Note that the assignment to Value[0] in routine p will modify the content of dynamic array of the caller, despite Value being a
by-value parameter. If a full copy of the dynamic array is required, use the Copy standard procedure to create a value copy of
the dynamic array.
Note: The syntax of open array parameters resembles that of dynamic array types, but they do not mean the same thing. The
previous example creates a function that takes any array of Char
elements, including (but not limited to) dynamic arrays. To declare parameters that must be dynamic arrays, you need to specify
a type identifier:
type TDynamicCharArray = array of Char;
function Find(A: TDynamicCharArray): Integer;
Within the body of a routine, open array parameters are governed by the following rules.
• They are always zero-based. The first element is 0, the second element is 1, and so forth. The standard Low and High
functions return 0 and Length1, respectively. The SizeOf function returns the size of the actual array passed to the routine.
• They can be accessed by element only. Assignments to an entire open array parameter are not allowed.
• They can be passed to other procedures and functions only as open array parameters or untyped var parameters. They
cannot be passed to SetLength.
• Instead of an array, you can pass a variable of the open array parameter's base type. It will be treated as an array of length 1.
When you pass an array as an open array value parameter, the compiler creates a local copy of the array within the routine's
stack frame. Be careful not to overflow the stack by passing large arrays.
The following examples use open array parameters to define a Clear procedure that assigns zero to each element in an array
of reals and a Sum function that computes the sum of the elements in an array of reals.
procedure Clear(var A: array of Real);
var
I: Integer;
begin
for I := 0 to High(A) do A[I] := 0;
end;
3
function Sum(const A: array of Real): Real;
var
I: Integer;
S: Real;
begin
S := 0;
for I := 0 to High(A) do S := S + A[I];
Sum := S;
end;
676
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
When you call routines that use open array parameters, you can pass open array constructors to them.
On the .NET platform, a variant open array parameter is equivalent to array of TObject. To determine the type of an
element in the array, you may use the ClassName or GetType methods.
On the Win32 platform, the array of const construction is equivalent to array ofTVarRec. TVarRec, declared in the
System unit, represents a record with a variant part that can hold values of integer, Boolean, character, real, string, pointer,
class, class reference, interface, and variant types. TVarRec's VType field indicates the type of each element in the array. Some
types are passed as pointers rather than values; in particular, long strings are passed as Pointer and must be typecast to string.
The following Win32 example, uses a variant open array parameter in a function that creates a string representation of each
element passed to it and concatenates the results into a single string. The string-handling routines called in this function are
defined in SysUtils. This function will not compile on .NET because it depends on the variant implementation of array of
const.
function MakeStr(const Args: array of const): string;
var
I: Integer;
begin
Result := '';
for I := 0 to High(Args) do
with Args[I] do
case VType of
vtInteger: Result := Result + IntToStr(VInteger);
vtBoolean: Result := Result + BoolToStr(VBoolean);
vtChar: Result := Result + VChar;
vtExtended: Result := Result + FloatToStr(VExtended^);
vtString: Result := Result + VString^;
vtPChar: Result := Result + VPChar;
vtObject: Result := Result + VObject.ClassName;
vtClass: Result := Result + VClass.ClassName;
vtAnsiString: Result := Result + string(VAnsiString);
vtCurrency: Result := Result + CurrToStr(VCurrency^);
vtVariant: Result := Result + string(VVariant^);
vtInt64: Result := Result + IntToStr(VInt64^);
end;
end;
We can call this function using an open array constructor. For example,
MakeStr(['test', 100, ' ', True, 3.14159, TForm])
returns the string 'test100 T3.14159TForm'.
Default Parameters
You can specify default parameter values in a procedure or function heading. Default values are allowed only for typed const 3
and value parameters. To provide a default value, end the parameter declaration with the = symbol followed by a constant
expression that is assignment-compatible with the parameter's type.
677
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
FillArray(MyArray, 0);
A multiple-parameter declaration cannot specify a default value. Thus, while
function MyFunction(X: Real = 3.5; Y: Real = 3.5): Real;
is legal,
function MyFunction(X, Y: Real = 3.5): Real; // syntax error
is not.
Parameters with default values must occur at the end of the parameter list. That is, all parameters following the first declared
default value must also have default values. So the following declaration is illegal.
procedure MyProcedure(I: Integer = 1; S: string); // syntax error
Default values specified in a procedural type override those specified in an actual routine. Thus, given the declarations
type TResizer = function(X: Real; Y: Real = 1.0): Real;
function Resizer(X: Real; Y: Real = 2.0): Real;
var
F: TResizer;
N: Real;
the statements
F := Resizer;
F(N);
result in the values (N, 1.0) being passed to Resizer.
Default parameters are limited to values that can be specified by a constant expression. Hence parameters of a dynamic-array,
procedural, class, class-reference, or interface type can have no value other than nil as their default. Parameters of a record,
variant, file, static-array, or object type cannot have default values at all.
3 See Also
Procedures and Functions ( see page 662)
678
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Topics
Name Description
Program Control ( see page 679) The concepts of passing parameters and function result processing are important
to understand before you undertake your application projects Treatment of
parameters and function results is determined by several factors, including calling
conventions, parameter semantics, and the type and size of the value being
passed.
This following topics are covered in this material:
• Passing Parameters.
• Handling Function Results.
• Handling Method Calls.
• Understanding Exit Procedures.
• Passing Parameters.
• Handling Function Results.
• Handling Method Calls.
• Understanding Exit Procedures.
Passing Parameters
Parameters are transferred to procedures and functions via CPU registers or the stack, depending on the routine's calling
convention. For information about calling conventions, see the topic on Calling Conventions.
Value and constant (const) parameters are passed by value or by reference, depending on the type and size of the parameter:
• An ordinal parameter is passed as an 8-bit, 16-bit, 32-bit, or 64-bit value, using the same format as a variable of the
corresponding type.
• A real parameter is always passed on the stack. A Single parameter occupies 4 bytes, and a Double, Comp, or Currency
parameter occupies 8 bytes. A Real48 occupies 8 bytes, with the Real48 value stored in the lower 6 bytes. An Extended
occupies 12 bytes, with the Extended value stored in the lower 10 bytes.
• A short-string parameter is passed as a 32-bit pointer to a short string.
• A long-string or dynamic-array parameter is passed as a 32-bit pointer to the dynamic memory block allocated for the long
string. The value nil is passed for an empty long string.
• A pointer, class, class-reference, or procedure-pointer parameter is passed as a 32-bit pointer.
3
• A method pointer is passed on the stack as two 32-bit pointers. The instance pointer is pushed before the method pointer so
that the method pointer occupies the lowest address.
• Under the register and pascal conventions, a variant parameter is passed as a 32bit pointer to a Variant value.
• Sets, records, and static arrays of 1, 2, or 4 bytes are passed as 8-bit, 16-bit, and 32bit values. Larger sets, records, and static
arrays are passed as 32-bit pointers to the value. An exception to this rule is that records are always passed directly on the
stack under the cdecl, stdcall, and safecall conventions; the size of a record passed this way is rounded upward to the
nearest double-word boundary.
679
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
• An open-array parameter is passed as two 32-bit values. The first value is a pointer to the array data, and the second value is
one less than the number of elements in the array.
When two parameters are passed on the stack, each parameter occupies a multiple of 4 bytes (a whole number of double
words). For an 8-bit or 16-bit parameter, even though the parameter occupies only a byte or a word, it is passed as a double
word. The contents of the unused parts of the double word are undefined.
Register Convention
Under the register convention, up to three parameters are passed in CPU registers, and the rest (if any) are passed on the
stack. The parameters are passed in order of declaration (as with the pascal convention), and the first three parameters that
qualify are passed in the EAX, EDX, and ECX registers, in that order. Real, method-pointer, variant, Int64, and structured types
do not qualify as register parameters, but all other parameters do. If more than three parameters qualify as register parameters,
the first three are passed in EAX, EDX, and ECX, and the remaining parameters are pushed onto the stack in order of
declaration. For example, given the declaration
procedure Test(A: Integer; var B: Char; C: Double; const D: string; E: Pointer);
a call to Test passes A in EAX as a 32-bit integer, B in EDX as a pointer to a Char, and D in ECX as a pointer to a long-string
memory block; C and E are pushed onto the stack as two double-words and a 32-bit pointer, in that order.
Note: Delphi language procedures and functions are generally invoked with the assumption that the FPU stack is empty: The
compiler tries to use all eight FPU stack entries when it generates code.
When working with the MMX and XMM instructions, be sure to preserve the values of the xmm and mm registers. Delphi
functions are invoked with the assumption that the x87 FPU data registers are available for use by x87 floating point instructions.
That is, the compiler assumes that the EMMS/FEMMS instruction has been called after MMX operations. Delphi functions do not
make any assumptions about the state and content of xmm registers. They do not guarantee that the content of xmm registers is
unchanged.
• Ordinal results are returned, when possible, in a CPU register. Bytes are returned in AL, words are returned in AX, and
3 double-words are returned in EAX.
• Real results are returned in the floating-point coprocessor's top-of-stack register (ST(0)). For function results of type Currency,
the value in ST(0) is scaled by 10000. For example, the Currency value 1.234 is returned in ST(0) as 12340.
• For a string, dynamic array, method pointer, or variant result, the effects are the same as if the function result were declared
as an additional var parameter following the declared parameters. In other words, the caller passes an additional 32-bit
pointer that points to a variable in which to return the function result.
• Int64 is returned in EDX:EAX.
• Pointer, class, class-reference, and procedure-pointer results are returned in EAX.
680
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
• For static-array, record, and set results, if the value occupies one byte it is returned in AL; if the value occupies two bytes it is
returned in AX; and if the value occupies four bytes it is returned in EAX. Otherwise, the result is returned in an additional var
parameter that is passed to the function after the declared parameters.
Handling Method Calls
Methods use the same calling conventions as ordinary procedures and functions, except that every method has an additional
implicit parameter Self, which is a reference to the instance or class in which the method is called. The Self parameter is passed
as a 32-bit pointer.
• Under the register convention, Self behaves as if it were declared before all other parameters. It is therefore always passed
in the EAX register.
• Under the pascal convention, Self behaves as if it were declared after all other parameters (including the additional var
parameter sometimes passed for a function result). It is therefore pushed last, ending up at a lower address than all other
parameters.
• Under the cdecl, stdcall, and safecall conventions, Self behaves as if it were declared before all other parameters, but after
the additional var parameter (if any) passed for a function result. It is therefore the last to be pushed, except for the additional
var parameter.
Constructors and destructors use the same calling conventions as other methods, except that an additional Boolean flag
parameter is passed to indicate the context of the constructor or destructor call.
A value of False in the flag parameter of a constructor call indicates that the constructor was invoked through an instance object
or using the inherited keyword. In this case, the constructor behaves like an ordinary method. A value of True in the flag
parameter of a constructor call indicates that the constructor was invoked through a class reference. In this case, the
constructor creates an instance of the class given by Self, and returns a reference to the newly created object in EAX.
A value of False in the flag parameter of a destructor call indicates that the destructor was invoked using the inherited keyword.
In this case, the destructor behaves like an ordinary method. A value of True in the flag parameter of a destructor call
indicates that the destructor was invoked through an instance object. In this case, the destructor deallocates the instance
given by Self just before returning.
The flag parameter behaves as if it were declared before all other parameters. Under the register convention, it is passed in the
DL register. Under the pascal convention, it is pushed before all other parameters. Under the cdecl, stdcall, and safecall
conventions, it is pushed just before the Self parameter.
Since the DL register indicates whether the constructor or destructor is the outermost in the call stack, you must restore the
value of DL before exiting so that BeforeDestruction or AfterConstruction can be called properly.
Understanding Exit Procedures
Exit procedures ensure that specific actions such as updating and closing filesare carried out before a program terminates. The
ExitProc pointer variable allows you to install an exit procedure, so that it is always called as part of the program's termination
whether the termination is normal, forced by a call to Halt, or the result of a runtime error. An exit procedure takes no
parameters.
Note: It is recommended that you use finalization sections rather than exit procedures for all exit behavior. Exit procedures are
available only for executables. For .DLLs (Win32) you can use a similar variable, DllProc, which is called when the library is
loaded as well as when it is unloaded. For packages, exit behavior must be implemented in a finalization section. All exit
procedures are called before execution of finalization sections.
Units as well as programs can install exit procedures. A unit can install an exit procedure as part of its initialization code, relying
on the procedure to close files or perform other clean-up tasks. 3
When implemented properly, an exit procedure is part of a chain of exit procedures. The procedures are executed in reverse
order of installation, ensuring that the exit code of one unit isn't executed before the exit code of any units that depend on it. To
keep the chain intact, you must save the current contents of ExitProc before pointing it to the address of your own exit
procedure. Also, the first statement in your exit procedure must reinstall the saved value of ExitProc.
681
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
ExitSave: Pointer;
procedure MyExit;
begin
ExitProc := ExitSave; // always restore old vector first
.
.
.
end;
begin
ExitSave := ExitProc;
ExitProc := @MyExit;
.
.
.
end.
On entry, the code saves the contents of ExitProc in ExitSave, then installs the MyExit procedure. When called as part of
the termination process, the first thing MyExit does is reinstall the previous exit procedure.
The termination routine in the runtime library keeps calling exit procedures until ExitProc becomes nilnil. To avoid infinite
loops, ExitProc is set to nil before every call, so the next exit procedure is called only if the current exit procedure assigns an
address to ExitProc. If an error occurs in an exit procedure, it is not called again.
An exit procedure can learn the cause of termination by examining the ExitCode integer variable and the ErrorAddr pointer
variable. In case of normal termination, ExitCode is zero and ErrorAddr is nil. In case of termination through a call to Halt,
ExitCode contains the value passed to Halt and ErrorAddr is nil. In case of termination due to a runtime error, ExitCode
contains the error code and ErrorAddr contains the address of the invalid statement.
The last exit procedure (the one installed by the runtime library) closes the Input and Output files. If ErrorAddr is not nil, it
outputs a runtime error message. To output your own runtime error message, install an exit procedure that examines ErrorAddr
and outputs a message if it's not nil; before returning, set ErrorAddr to nil so that the error is not reported again by other exit
procedures.
Once the runtime library has called all exit procedures, it returns to the operating system, passing the value stored in ExitCode
as a return code.
See Also
Procedures and Functions ( see page 662)
682
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Topics
Name Description
Programs and Units ( see page 683) A Delphi program is constructed from source code modules called units. The
units are tied together by a special source code module that contains either the
program, library, or package header. Each unit is stored in its own file and
compiled separately; compiled units are linked to create an application. RAD
Studio introduces hierarchical namespaces, giving you even more flexibility in
organizing your units. Namespaces and units allow you to
Note: Strictly speaking, you need not explicitly use any units in a project, but all programs automatically use the System unit
and the SysInit unit. 3
The source code file for an executable Delphi application contains
• a program heading,
• a uses clause (optional), and
• a block of declarations and executable statements.
Additionally, a RAD Studio program may contain a namespaces clause, to specify additional namespaces in which to search for
generic units. This topic is covered in more detail in the section Using .NET Namespaces with Delphi.
683
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
The compiler, and hence the IDE, expect to find these three elements in a single project (.dpr) file.
The following example shows the project source file for a program called Editor. Since the program is called Editor, this
project file is called Editor.dpr.
program Editor;
{$R *.res}
begin
Application.Title := 'Text Editor';
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.
The first line contains the program heading. The uses clause in this example specifies a dependency on three additional units:
Forms, REAbout, and REMain. The $R compiler directive links the project's resource file into the program. Finally, the block of
statements between the begin and end keywords are executed when the program runs. The project file, like all Delphi source
files, ends with a period (not a semicolon).
Delphi project files are usually short, since most of a program's logic resides in its unit files. A Delphi project file typically contains
only enough code to launch the application's main window, and start the event processing loop. Project files are generated and
maintained automatically by the IDE, and it is seldom necessary to edit them manually.
In standard Pascal, a program heading can include parameters after the program name:
program Calc(input, output);
CodeGear's Delphi ignores these parameters.
In RAD Studio, a the program heading introduces its own namespace, which is called the project default namespace. This is
also true for the library and package headers, when these types of projects are compiled for the .NET platform.
The uses clause consists of the keyword uses, followed by a comma delimited list of units the project file directly depends on.
The Block
The block contains a simple or structured statement that is executed when the program runs. In most program files, the block
consists of a compound statement bracketed between the reserved words begin and end, whose component statements are
3
simply method calls to the project's Application object. Most projects have a global Application variable that holds an
instance of TApplication, TWebApplication, or TServiceApplication. The block can also contain declarations of constants, types,
variables, procedures, and functions; these declarations must precede the statement part of the block.
684
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
A unit file begins with a unit heading, which is followed by the interface keyword. Following the interface keyword, the uses
clause specifies a list of unit dependencies. Next comes the implementation section, followed by the optional initialization, and
finalization sections. A skeleton unit source file looks like this:
unit Unit1;
interface
implementation
initialization
finalization
end.
The unit must conclude with the reserved word end followed by a period.
Unit names must be unique within a project. Even if their unit files are in different directories, two units with the same name
cannot be used in a single program.
The interface declaration of a procedure or function includes only the routine's signature. That is, the routine's name,
parameters, and return type (for functions). The block containing executable code for the procedure or function follows in the
implementation section. Thus procedure and function declarations in the interface section work like forward declarations.
The interface declaration for a class must include declarations for all class members: fields, properties, procedures, and
functions.
3
The interface section can include its own uses clause, which must appear immediately after the keyword interface.
685
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
functions may be defined and called in any order. You can omit parameter lists from public procedure and function headings
when you define them in the implementation section; but if you include a parameter list, it must match the declaration in the
interface section exactly.
In addition to definitions of public procedures and functions, the implementation section can declare constants, types (including
classes), variables, procedures, and functions that are private to the unit. That is, unlike the interface section, entities declared
in the implementation section are inaccessible to other units.
The implementation section can include its own uses clause, which must appear immediately after the keyword
implementation. The identifiers declared within units specified in the implementation section are only available for use within
the implementation section itself. You cannot refer to such identifiers in the interface section.
For units in the interfaceuses list, the initialization sections of the units used by a client are executed in the order in which the
units appear in the client's uses clause.
Finalization sections are executed in the opposite order from initialization sections. For example, if your application initializes
units A, B, and C, in that order, it will finalize them in the order C, B, and A.
Once a unit's initialization code starts to execute, the corresponding finalization section is guaranteed to execute when the
application shuts down. The finalization section must therefore be able to handle incompletely initialized data, since, if a runtime
error occurs, the initialization code might not execute completely.
Note: The initialization and finalization sections behave differently when code is compiled for the managed .NET environment.
See the chapter on Memory Management for more information.
686
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
If such an explicit reference appears in the project file, other source files can refer to the unit with a simple uses clause that does
not need to match case:
uses Myunit;
uses
Forms,
Main;
• You have used a source file that is in a different directory from the project file, and that directory is not in the compiler's search
path.
• Different directories in the compiler's search path have identically named units.
• You are compiling a console application from the command line, and you have named a unit with an identifier that doesn't
match the name of its source file.
The compiler also relies on the in ... construction to determine which units are part of a project. Only units that appear in a
project (.dpr) file's uses clause followed by in and a file name are considered to be part of the project; other units in the
uses clause are used by the project without belonging to it. This distinction has no effect on compilation, but it affects IDE
tools like the Project Manager.
In the uses clause of a unit, you cannot use in to tell the compiler where to find a source file. Every unit must be in the compiler's
search path. Moreover, unit names must match the names of their source files.
A uses clause need include only units used directly by the program or unit in which the clause appears. That is, if unit A
3
references constants, types, variables, procedures, or functions that are declared in unit B, then A must use B explicitly. If B in
turn references identifiers from unit C, then A is indirectly dependent on C; in this case, C needn't be included in a uses clause in
A, but the compiler must still be able to find both B and C in order to process A.
687
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
unit Unit2;
interface
uses Unit1;
const b = c;
// ...
unit Unit1;
interface
const c = 1;
// ...
In this example, Prog depends directly on Unit2, which depends directly on Unit1. Hence Prog is indirectly dependent on
Unit1. Because Unit1 does not appear in Prog's uses clause, identifiers declared in Unit1 are not available to Prog.
To compile a client module, the compiler needs to locate all units that the client depends on, directly or indirectly. Unless the
source code for these units has changed, however, the compiler needs only their .dcu (Win32) or .dcuil (.NET) files, not their
source (.pas) files.
When a change is made in the interface section of a unit, other units that depend on the change must be recompiled. But when
changes are made only in the implementation or other sections of a unit, dependent units don't have to be recompiled. The
compiler tracks these dependencies automatically and recompiles units only when necessary.
In the simplest case of two mutually dependent units, this means that the units cannot list each other in their interface uses
clauses. So the following example leads to a compilation error:
unit Unit1;
interface
uses Unit2;
// ...
unit Unit2;
interface
uses Unit1;
// ...
However, the two units can legally reference each other if one of the references is moved to the implementation section:
unit Unit1;
interface
uses Unit2;
// ...
unit Unit2;
interface
3 //...
implementation
uses Unit1;
// ...
To reduce the chance of circular references, it's a good idea to list units in the implementation uses clause whenever possible.
Only when identifiers from another unit are used in the interface section is it necessary to list that unit in the interface uses
clause.
688
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
See Also
Using Namespaces with Delphi ( see page 689)
Unlike traditional Delphi units, namespaces can be nested to form a containment hierarchy. Nested namespaces provide a way
to organize identifiers and types, and are used to disambiguate types with the same name. Since they are a container for Delphi
units, namespaces may also be used to differentiate between units of the same name, that reside in different packages.
For example, the class MyClass in MyNameSpace, is different from the class MyClass in YourNamespace. At runtime, the
CLR always refers to classes and types by their fully qualified names: the assembly name, followed by the namespace that
contains the type. The CLR itself has no concept or implementation of the namespace hierarchy; it is purely a notational
convenience of the programming language.
Second, notice that the dots imply the conceptual nesting, or containment, of one namespace within another. The example
above declares the unit MyUnit to be a member of the MyWidgets namespace, which itself is contained in the MyCompany
namespace. Again, it should be noted that this containment is for documentation purposes only.
A project default namespace declares a namespace for all of the units in the project. Consider the following declarations:
Program MyCompany.Programs.MyProgram;
Library MyCompany.Libs.MyLibrary;
Package MyCompany.Packages.MyPackage;
These statements establish the project default namespace for the program, library, and package, respectively. The namespace 3
is determined by removing the rightmost identifier (and dot) from the declaration.
A unit that omits an explicit namespace is called a generic unit. A generic unit automatically becomes a member of the project
default namespace. Given the preceding program declaration, the following unit declaration would cause the compiler to treat
MyUnit as a member of the MyCompany.Programs namespace.
unit MyUnit;
The project default namespace does not affect the name of the Delphi source file for a generic unit. In the preceding example,
689
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
the Delphi source file name would be MyUnit.pas. The compiler does however prefix the dcuil file name with the project
default namespace. The resulting dcuil file in the current example would be MyCompany.Programs.MyUnit.dcuil.
Namespace strings are not case-sensitive. The compiler considers two namespaces that differ only in case to be equivalent.
However, the compiler does preserve the case of a namespace, and will use the preserved casing in output file names, error
messages, and RTTI unit identifiers. RTTI for class and type names will include the full namespace specification.
Searching Namespaces
A unit must declare the other units on which it depends. As with the Win32 platform, the compiler must search these units for
identifiers. For units in explicit namespaces the search scope is already known, but for generic units, the compiler must establish
a namespace search scope.
1. MyCompany.ProjectX.ProgramY
2. MyCompany.ProjectX
3. Namespaces specified by compiler options.
Note that if the current unit is generic (i.e. it does not have an explicit namespace declaration in its unit statement), then
3 resolution begins with the project default namespace.
Using Namespaces
Delphi's uses clause brings a module into the context of the current unit. The uses clause must either refer to a module by its
fully qualified name (i.e. including the full namespace specification), or by its generic name, thereby relying on the namespace
resolution mechanisms to locate the unit.
690
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
begin
writeln(MyCompany.Libs.Unit2.SomeString);
writeln(SomeString);
end.
A fully qualified identifier must include the full namespace specification. In the preceding example, it would be an error to refer to
SomeString using only a portion of the namespace:
writeln(Unit2.SomeString); // ERROR!
writeln(Libs.Unit2.SomeString); // ERROR!
writeln(MyCompany.Libs.Unit2.SomeString); // Correct.
writeln(SomeString); // Correct.
It is also an error to refer to only a portion of a namespace in the uses clause. There is no mechanism to import all units and
symbols in a namespace. The following code does not import all units and symbols in the MyCompany namespace:
uses MyCompany; // ERROR!
This restriction also applies to the with-do statement. The following will produce a compiler error:
with MyCompany.Libs do // ERROR!
This difference in namespace metadata is visible only to external consumers of the assembly. The Delphi code within the
assembly still treats the entire dotted name as the fully qualified name.
Multi-unit Namespaces
Multiple units can belong to the same namespace, if the unit declarations refer to the same namespace. For example, one can
create two files, unit1.pas and unit2.pas, with the following unit declarations:
3
// in file 'unit1.pas'
unit MyCompany.ProjectX.ProgramY.Unit1
// in file 'unit2.pas'
unit MyCompany.ProjectX.ProgramY.Unit2
In this example, the namespace MyCompany.ProjectX.ProgramY logically contains all of the interface symbols from
unit1.pas and unit2.pas.
Symbol names in a namespace must be unique, across all units in the namespace. In the example above, it is an error for
691
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Unit1 and Unit2 to both define a global interface symbol named mySymbol.
The individual units aggregated in a namespace are not available to source code unless the individual units are explicitly used in
the file's uses clause. In other words, if a source file uses only the namespace, then fully qualified identifier expressions referring
to a symbol in a unit in that namespace must use the namespace name, not just the name of the unit that defines that symbol.
A uses clause may refer to a namespace as well as individual units within that namespace. In this case, a fully qualified
expression referring to a symbol from a specific unit listed in the uses clause may be referred to using the actual unit name or
the fully-qualified name (including namespace and unit name) for the qualifier. The two forms of reference are identical and refer
to the same symbol.
clause will only work when you are compiling from source or dcu files. If the namespace units are compiled into an assembly
and the assembly is referenced by the project instead of the individual units, then the source code that explicitly refers to a unit in
the namespace will fail.
See Also
Programs and Units ( see page 683)
Topics
Name Description
Standard Routines and I/O ( see page 692) These topics discuss text and file I/O and summarize standard library routines.
Many of the procedures and functions listed here are defined in the System and
SysInit units, which are implicitly used with every application. Others are built into
the compiler but are treated as if they were in the System unit.
Some standard routines are in units such as SysUtils, which must be listed in
a uses clause to make them available in programs. You cannot, however, list
System in a uses clause, nor should you modify the System unit or try to rebuild
it explicitly.
Some standard routines are in units such as SysUtils, which must be listed in a uses clause to make them available in
programs. You cannot, however, list System in a uses clause, nor should you modify the System unit or try to rebuild it explicitly.
Procedure or Description
function
Append Opens an existing text file for appending.
AssignFile Assigns the name of an external file to a file variable.
BlockRead Reads one or more records from an untyped file.
BlockWrite Writes one or more records into an untyped file.
692
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
A file variable is any variable whose type is a file type. There are three classes of file: typed, text, and untyped. The syntax for
declaring file types is given in File types. Note that file types are only available on the Win32 platform.
Before a file variable can be used, it must be associated with an external file through a call to the AssignFile procedure. An
external file is typically a named disk file, but it can also be a device, such as the keyboard or the display. The external file stores
the information written to the file or supplies the information read from the file.
Once the association with an external file is established, the file variable must be opened to prepare it for input or output. An
existing file can be opened via the Reset procedure, and a new file can be created and opened via the Rewrite procedure. Text
files opened with Reset are read-only and text files opened with Rewrite and Append are write-only. Typed files and untyped files
always allow both reading and writing regardless of whether they were opened with Reset or Rewrite.
Every file is a linear sequence of components, each of which has the component type (or record type) of the file. The
3
components are numbered starting with zero.
Files are normally accessed sequentially. That is, when a component is read using the standard procedure Read or written using
the standard procedure Write, the current file position moves to the next numerically ordered file component. Typed files and
untyped files can also be accessed randomly through the standard procedure Seek, which moves the current file position to a
specified component. The standard functions FilePos and FileSize can be used to determine the current file position and the
current file size.
693
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
When a program completes processing a file, the file must be closed using the standard procedure CloseFile. After a file is
closed, its associated external file is updated. The file variable can then be associated with another external file.
By default, all calls to standard I/O procedures and functions are automatically checked for errors, and if an error occurs an
exception is raised (or the program is terminated if exception handling is not enabled). This automatic checking can be turned on
and off using the {$I+} and {$I-} compiler directives. When I/O checking is off, that is, when a procedure or function call is
compiled in the {$I-} state an I/O error doesn't cause an exception to be raised; to check the result of an I/O operation, you must
call the standard function IOResult instead.
You must call the IOResult function to clear an error, even if you aren't interested in the error. If you don't clear an error and {$I-}
is the current state, the next I/O function call will fail with the lingering IOResult error.
Text Files
This section summarizes I/O using file variables of the standard type Text.
When a text file is opened, the external file is interpreted in a special way: It is considered to represent a sequence of characters
formatted into lines, where each line is terminated by an end-of-line marker (a carriage-return character, possibly followed by a
line feed character). The type Text is distinct from the type file of Char.
For text files, there are special forms of Read and Write that let you read and write values that are not of type Char. Such values
are automatically translated to and from their character representation. For example, Read(F, I), where I is a type Integer
variable, reads a sequence of digits, interprets that sequence as a decimal integer, and stores it in I.
There are two standard text file variables, Input and Output The standard file variable Input is a read-only file associated with the
operating system's standard input (typically, the keyboard). The standard file variable Output is a write-only file associated with
the operating system's standard output (typically, the display). Before an application begins executing, Input and Output are
automatically opened, as if the following statements were executed:
AssignFile(Input, '');
Reset(Input);
AssignFile(Output, '');
Rewrite(Output);
Note: For Win32 applications, text-oriented I/O is available only in console applications, that is, applications compiled with the
Generate console application
option checked on the Linker page of the Project Options dialog box or with the -cc command-line compiler option. In a GUI
(non-console) application, any attempt to read or write using Input or Output will produce an I/O error.
Some of the standard I/O routines that work on text files don't need to have a file variable explicitly given as a parameter. If the
file parameter is omitted, Input or Output is assumed by default, depending on whether the procedure or function is input- or
output-oriented. For example, Read(X) corresponds to Read(Input, X) and Write(X) corresponds to Write(Output, X).
If you do specify a file when calling one of the input or output routines that work on text files, the file must be associated with an
external file using AssignFile, and opened using Reset, Rewrite, or Append. An error occurs if you pass a file that was opened
with Reset to an output-oriented procedure or function. An error also occurs if you pass a file that was opened with Rewrite or
Append to an input-oriented procedure or function.
3 Untyped Files
Untyped files are low-level I/O channels used primarily for direct access to disk files regardless of type and structuring. An
untyped file is declared with the word file and nothing more. For example,
var DataFile: file;
For untyped files, the Reset and Rewrite procedures allow an extra parameter to specify the record size used in data transfers.
For historical reasons, the default record size is 128 bytes. A record size of 1 is the only value that correctly reflects the exact
size of any file. (No partial records are possible when the record size is 1.)
694
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Except for Read and Write, all typed-file standard procedures and functions are also allowed on untyped files. Instead of Read
and Write, two procedures called BlockRead and BlockWrite are used for high-speed data transfers.
The four functions that define each device driver are Open, InOut, Flush, and Close. The function header of each function is
function DeviceFunc(var F: TTextRec): Integer;
where DeviceFunc is the name of the function (that is, Open, InOut, Flush, or Close). The return value of a device-interface
function becomes the value returned by IOResult. If the return value is zero, the operation was successful.
To associate the device-interface functions with a specific file, you must write a customized Assign procedure. The Assign
procedure must assign the addresses of the four device-interface functions to the four function pointers in the text file variable. In
addition, it should store the fmClosedmagic constant in the Mode field, store the size of the text file buffer in BufSize, store a
pointer to the text file buffer in BufPtr, and clear the Name string.
Assuming, for example, that the four device-interface functions are called DevOpen, DevInOut, DevFlush, and DevClose, the
Assign procedure might look like this:
procedure AssignDev(var F: Text);
begin
with TTextRec(F) do
begin
Mode := fmClosed;
BufSize := SizeOf(Buffer);
BufPtr := @Buffer;
OpenFunc := @DevOpen;
InOutFunc := @DevInOut;
FlushFunc := @DevFlush;
CloseFunc := @DevClose;
Name[0] := #0;
end;
end;
The device-interface functions can use the UserData field in the file record to store private information. This field isn't modified by
the product file system at any time.
The Open function prepares the file for input or output, according to the Mode value. If Mode specified fmInOut (indicating that
Open was called from Append), it must be changed to fmOutput before Open returns.
Open is always called before any of the other device-interface functions. For that reason, AssignDev only initializes the
OpenFunc field, leaving initialization of the remaining vectors up to Open. Based on Mode, Open can then install pointers to
either input- or output-oriented functions. This saves the InOut, Flush functions and the CloseFile procedure from determining
the current mode. 3
When Mode is fmInput, the InOut function reads up to BufSize characters into BufPtr^, and returns the number of characters
read in BufEnd. In addition, it stores zero in BufPos. If the InOut function returns zero in BufEnd as a result of an input
695
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
When Mode is fmOutput, the InOut function writes BufPos characters from BufPtr^, and returns zero in BufPos.
If Mode is fmInput, the Flush function can store zero in BufPos and BufEnd to flush the remaining (unread) characters in the
buffer. This feature is seldom used.
If Mode is fmOutput, the Flush function can write the contents of the buffer exactly like the InOut function, which ensures that
text written to the device appears on the device immediately. If Flush does nothing, the text doesn't appear on the device until
the buffer becomes full or the file is closed.
Function Description
StrAlloc Allocates a character buffer of a given size on the heap.
StrBufSize Returns the size of a character buffer allocated using StrAlloc or StrNew.
StrCat Concatenates two strings.
StrComp Compares two strings.
StrCopy Copies a string.
StrDispose Disposes a character buffer allocated using StrAlloc or StrNew.
StrECopy Copies a string and returns a pointer to the end of the string.
StrEnd Returns a pointer to the end of a string.
StrFmt Formats one or more values into a string.
StrIComp Compares two strings without case sensitivity.
StrLCat Concatenates two strings with a given maximum length of the resulting string.
3 StrLComp Compares two strings for a given maximum length.
StrLCopy Copies a string up to a given maximum length.
StrLen Returns the length of a string.
StrLFmt Formats one or more values into a string with a given maximum length.
StrLIComp Compares two strings for a given maximum length without case sensitivity.
StrLower Converts a string to lowercase.
696
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Standard string-handling functions have multibyte-enabled counterparts that also implement locale-specific ordering for
characters. Names of multibyte functions start with Ansi-. For example, the multibyte version of StrPos is AnsiStrPos. Multibyte
character support is operating-system dependent and based on the current locale.
Wide-Character Strings
The System unit provides three functions, WideCharToString, WideCharLenToString, and StringToWideChar, that can be used
to convert null-terminated wide character strings to single- or double-byte long strings.
Assignment will also convert between strings. For instance, the following are both valid:
MyAnsiString := MyWideString;
MyWideString := MyAnsiString;
Other Standard Routines
The table below lists frequently used procedures and functions found in CodeGear product libraries. This is not an exhaustive
inventory of standard routines.
Procedure or Description
function
Addr Returns a pointer to a specified object.
AllocMem Allocates a memory block and initializes each byte to zero.
ArcTan Calculates the arctangent of the given number.
Assert Raises an exception if the passed expression does not evaluate to true.
Assigned Tests for a nil (unassigned) pointer or procedural variable.
Beep Generates a standard beep.
Break Causes control to exit a for, while, or repeat statement.
ByteToCharIndex Returns the position of the character containing a specified byte in a string.
Chr Returns the character for a specified integer value.
Close Closes a file. 3
CompareMem Performs a binary comparison of two memory images.
CompareStr Compares strings case sensitively.
CompareText Compares strings by ordinal value and is not case sensitive.
Continue Returns control to the next iteration of for, while, or repeat statements.
Copy Returns a substring of a string or a segment of a dynamic array.
697
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
698
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
699
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
See Also
Data Types ( see page 553)
Topics
Name Description
Fundamental Syntactic Elements ( see page 701) This topic introduces the Delphi language character set, and describes the syntax
for declaring:
• Identifiers
• Numbers
• Character strings
• Labels
• Source code comments
Declarations and Statements ( see page 705) This topic describes the syntax of Delphi declarations and statements.
Aside from the uses clause (and reserved words like implementation that
demarcate parts of a unit), a program consists entirely of declarations and
statements, which are organized into blocks.
This topic covers the following items:
• Declarations
• Simple statements such as assignment
• Structured statements such as conditional tests (e.g.,
if-then, and case), iteration (e.g., for, and while).
string;
The syntax and placement of a declaration depend on the
3 kind of identifier you are defining. In general, declarations
can occur only at the beginning of a... more ( see page 705)
Expressions ( see page 720) circuit evaluation is usually preferable because it guarantees minimum execution
time and, in most cases, minimum code size. Complete evaluation is sometimes
convenient when one operand is a function with side effects that alter the
execution of the program.
circuit evaluation also allows the use of constructions that might otherwise result
in illegal runtime operations. For example, the following code iterates through the
string S, up to the first comma.
700
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
• Identifiers
• Numbers
• Character strings
• Labels
• Source code comments
The Delphi Character Set
The Delphi Language uses the Unicode character set, including alphabetic and alphanumeric Unicode characters and the
underscore. It is not case-sensitive. The space character and the ASCII control characters (ASCII 0 through 31 including ASCII
13, the return or end-of-line character) are called blanks.
The RAD Studio compiler will accept a file encoded in UCS-2 or UCS-4 if the file contains a byte order mark. The speed of
compilation may be penalized by the use for formats other than UTF–8, however. All characters in a UCS-4 encoded source file
must be representable in UCS-2 without surrogate pairs. UCS-2 encodings with surrogate pairs (including GB18030) are
accepted only if the codepage compiler option is specified.
Fundamental syntactic elements, called tokens, combine to form expressions, declarations, and statements. A statement
describes an algorithmic action that can be executed within a program. An expression is a syntactic unit that occurs within a
statement and denotes a value. A declaration defines an identifier (such as the name of a function or variable) that can be used
in expressions and statements, and, where appropriate, allocates memory for the identifier.
Special Symbols
Special symbols are non-alphanumeric characters, or pairs of such characters, that have fixed meanings. The following single
characters are special symbols:
# $ & ' ( ) * + , - . / : ; < = > @ [ ] ^ { }
3
The following character pairs are also special symbols:
(* (. *) .) .. // := <= >= <>
701
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
] .)
{ (*
} *)
The left bracket [ is equivalent to the character pair of left parenthesis and period (.
The right bracket ] is equivalent to the character pair of period and right parenthesis .)
The left brace { is equivalent to the character pair of left parenthesis and asterisk (*.
The right brace } is equivalent to the character pair of right parenthesis and asterisk *)
Note: %, ?, \, !, " (double quotation marks), _ (underscore), | (pipe), and ~ (tilde) are not special characters.
Identifiers
Identifiers denote constants, variables, fields, types, properties, procedures, functions, programs, units, libraries, and packages.
An identifier can be of any length, but only the first 255 characters are significant. An identifier must begin with an alphabetic
character or an underscore (_) and cannot contain spaces; alphanumeric characters, digits, and underscores are allowed after
the first character. Reserved words cannot be used as identifiers.
Note: The .NET SDK recommends against using leading underscores in identifiers, as this pattern is reserved for system use.
Since the Delphi Language is case-insensitive, an identifier like CalculateValue could be written in any of these ways:
CalculateValue
calculateValue
calculatevalue
CALCULATEVALUE
Since unit names correspond to file names, inconsistencies in case can sometimes affect compilation. For more information, see
the topic, Unit References and the Uses Clause.
Qualified Identifiers
When you use an identifier that has been declared in more than one place, it is sometimes necessary to qualify the identifier.
The syntax for a qualified identifier is
identifier1.identifier2
where identifier1 qualifies identifier2. For example, if two units each declare a variable called CurrentValue, you can specify
that you want to access the CurrentValue in Unit2 by writing
Unit2.CurrentValue
Qualifiers can be iterated. For example,
Form1.Button1.Click
calls the Click method in Button1 of Form1.
If you don't qualify an identifier, its interpretation is determined by the rules of scope described in Blocks and scope ( see page
3 705).
Extended Identifiers
Particularly when programming with Delphi for .NET, you might encounter identifiers (e.g. types, or methods in a class) having
the same name as a Delphi language keyword. For example, a class might have a method called begin. Another example is the
CLR class called Type, in the System namespace. Type is a Delphi language keyword, and cannot be used for an identifier
name.
If you qualify the identifier with its full namespace specification, then there is no problem. For example, to use the Type class,
702
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Reserved Words
The following reserved words cannot be redefined or used as identifiers.
Reserved Words
In addition to the words above, private, protected, public, published, and automated act as reserved words within class type
declarations, but are otherwise treated as directives. The words at and on also have special meanings, and should be treated as
reserved words.
Directives
Directives are words that are sensitive in specific locations within source code. Directives have special meanings in the Delphi
3
language, but, unlike reserved words, appear only in contexts where user-defined identifiers cannot occur. Hence -- although it is
inadvisable to do so -- you can define an identifier that looks exactly like a directive.
Directives
703
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Numerals
Integer and real constants can be represented in decimal notation as sequences of digits without commas or spaces, and
prefixed with the + or - operator to indicate sign. Values default to positive (so that, for example, 67258 is equivalent to +67258)
and must be within the range of the largest predefined real or integer type.
Numerals with decimal points or exponents denote reals, while other numerals denote integers. When the character E or e
occurs within a real, it means "times ten to the power of". For example, 7E2 means 7 * 10^2, and 12.25e+6 and 12.25e6 both
mean 12.25 * 10^6.
The dollar-sign prefix indicates a hexadecimal numeral, for example, $8F. Hexadecimal numbers without a preceding - unary
operator are taken to be positive values. During an assignment, if a hexadecimal value lies outside the range of the receiving
type an error is raised, except in the case of the Integer (32-bit integer) where a warning is raised. In this case, values exceeding
the positive range for Integer are taken to be negative numbers in a manner consistent with 2's complement integer
representation.
For more information about real and integer types, see Data Types ( see page 553). For information about the data types of
numerals, see True constants ( see page 589).
Labels
A label is a standard Delphi language identifier with the exception that, unlike other identifiers, labels can start with a digit.
Numeric labels can include no more than ten digits - that is, a numeral between 0 and 9999999999.
Labels are used in goto statements. For more information about goto statements and labels, see Goto statements ( see page
705).
Character Strings
A character string, also called a string literal or string constant, consists of a quoted string, a control string, or a combination of
quoted and control strings. Separators can occur only within quoted strings.
A quoted string is a sequence of up to 255 characters from the extended ASCII character set, written on one line and enclosed
by apostrophes. A quoted string with nothing between the apostrophes is a null string. Two sequential apostrophes in a quoted
string denote a single character, namely an apostrophe. For example,
3
'CodeGear' { CodeGear }
'You''ll see' { You'll see }
'''' { ' }
'' { null string }
' ' { a space }
A control string is a sequence of one or more control characters, each of which consists of the # symbol followed by an unsigned
integer constant from 0 to 255 (decimal or hexadecimal) and denotes the corresponding ASCII character. The control string
#89#111#117
704
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
A character string's length is the number of characters in the string. A character string of any length is compatible with any string
type and with the PChar type. A character string of length 1 is compatible with any character type, and, when extended syntax is
enabled (with compiler directive {$X+}), a nonempty character string of length n is compatible with zero-based arrays and
packed arrays of n characters. For more information, see Datatypes ( see page 553).
A comment that contains a dollar sign ($) immediately after the opening { or (* is a compiler directive. For example,
{$WARNINGS OFF}
tells the compiler not to generate warning messages.
See Also
Expressions ( see page 720)
Aside from the uses clause (and reserved words like implementation that demarcate parts of a unit), a program consists
entirely of declarations and statements, which are organized into blocks.
• Declarations
3
• Simple statements such as assignment
• Structured statements such as conditional tests (e.g., if-then, and case), iteration (e.g., for, and while).
string;
The syntax and placement of a declaration depend on the kind of identifier you are defining. In general, declarations can occur
only at the beginning of a block or at the beginning of the interface or implementation section of a unit (after the uses clause).
Specific conventions for declaring variables, constants, types, functions, and so forth are explained in the documentation for
705
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
those topics.
Hinting Directives
The 'hint' directives platform, deprecated, and library may be appended to any declaration. These directives will produce
warnings at compile time. Hint directives can be applied to type declarations, variable declarations, class, interface and structure
declarations, field declarations within classes or records, procedure, function and method declarations, and unit declarations.
When a hint directive appears in a unit declaration, it means that the hint applies to everything in the unit. For example, the
Windows 3.1 style OleAuto.pas unit on Windows is completely deprecated. Any reference to that unit or any symbol in that unit
will produce a deprecation message.
The platform hinting directive on a symbol or unit indicates that it may not exist or that the implementation may vary
considerably on different platforms. The library hinting directive on a symbol or unit indicates that the code may not exist or the
implementation may vary considerably on different library architectures.
The platform and library directives do not specify which platform or library. If your goal is writing platform-independent code,
you do not need to know which platform a symbol is specific to; it is sufficient that the symbol be marked as specific to some
platform to let you know it may cause problems for your goal of portability.
In the case of a procedure or function declaration, the hint directive should be separated from the rest of the declaration with a
semicolon. Examples:
procedure SomeOldRoutine; stdcall deprecated;
var
VersionNumber: Real library;
type
AppError = class(Exception)
...
end platform;
When source code is compiled in the {$HINTS ON} {$WARNINGS ON} state, each reference to an identifier declared with one
of these directives generates an appropriate hint or warning. Use platform to mark items that are specific to a particular
operating environment (such as Windows or .NET), deprecated to indicate that an item is obsolete or supported only for
backward compatibility, and library to flag dependencies on a particular library or component framework.
The RAD Studio compiler also recognizes the hinting directive experimental. You can use this directive to designate units which
are in an unstable, development state. The compiler will emit a warning when it builds an application that uses the unit.
Declarations
The names of variables, constants, types, fields, properties, procedures, functions, programs, units, libraries, and packages are
called identifiers. (Numeric constants like 26057 are not identifiers.) Identifiers must be declared before you can use them; the
only exceptions are a few predefined types, routines, and constants that the compiler understands automatically, the variable
Result when it occurs inside a function block, and the variable Self when it occurs inside a method implementation.
A declaration defines an identifier and, where appropriate, allocates memory for it. For example,
var Size: Extended;
3 declares a variable called Size that holds an Extended (real) value, while
function DoThis(X, Y: string): Integer;
declares a function called DoThis that takes two strings as arguments and returns an integer. Each declaration ends with a
semicolon. When you declare several variables, constants, types, or labels at the same time, you need only write the appropriate
reserved word once:
var
Size: Extended;
706
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Quantity: Integer;
Statements
Statements define algorithmic actions within a program. Simple statements like assignments and procedure calls can combine to
form loops, conditional statements, and other structured statements.
Multiple statements within a block, and in the initialization or finalization section of a unit, are separated by semicolons.
Simple Statements
A simple statement doesn't contain any other statements. Simple statements include assignments, calls to procedures and
functions, and goto jumps.
Assignment Statements
An assignment statement has the form
variable := expression
where variable is any variable reference, including a variable, variable typecast, dereferenced pointer, or component of a
structured variable. The expression is any assignment-compatible expression (within a function block, variable can be replaced
with the name of the function being defined. See Procedures and functions ( see page 662)). The := symbol is sometimes
called the assignment operator.
An assignment statement replaces the current value of variable with the value of expression. For example,
I := 3;
assigns the value 3 to the variable I. The variable reference on the left side of the assignment can appear in the expression on
the right. For example,
I := I + 1;
increments the value of I. Other assignment statements include
X := Y + Z;
Done := (I >= 1) and (I < 100);
Hue1 := [Blue, Succ(C)];
I := Sqr(J) - I * K;
Shortint(MyChar) := 122;
TByteRec(W).Hi := 0;
MyString[I] := 'A';
SomeArray[I + 1] := P^;
TMyObject.SomeProperty := True;
707
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
For more information about procedures and functions, see Procedures and functions ( see page 662).
Goto Statements
A goto statement, which has the form
goto label
transfers program execution to the statement marked by the specified label. To mark a statement, you must first declare the
label. Then precede the statement you want to mark with the label and a colon:
label: statement
A label can be any valid identifier or any numeral between 0 and 9999.
The label declaration, marked statement, and goto statement must belong to the same block. (See Blocks and Scope, below.)
Hence it is not possible to jump into or out of a procedure or function. Do not mark more than one statement in a block with the
same label.
For example,
label StartHere;
...
StartHere: Beep;
goto StartHere;
creates an infinite loop that calls the Beep procedure repeatedly.
The goto statement is generally discouraged in structured programming. It is, however, sometimes used as a way of exiting from
nested loops, as in the following example.
procedure FindFirstAnswer;
var X, Y, Z, Count: Integer;
label FoundAnAnswer;
begin
Count := SomeConstant;
for X := 1 to Count do
for Y := 1 to Count do
for Z := 1 to Count do
if ... { some condition holds on X, Y, and Z } then
goto FoundAnAnswer;
FoundAnAnswer:
3 ... { Code to execute when an answer is found }
end;
Notice that we are using goto to jump out of a nested loop. Never jump into a loop or other structured statement, since this can
have unpredictable effects.
Structured Statements
Structured statements are built from other statements. Use a structured statement when you want to execute other statements
sequentially, conditionally, or repeatedly.
708
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Compound Statements
A compound statement is a sequence of other (simple or structured) statements to be executed in the order in which they are
written. The compound statement is bracketed by the reserved words begin and end, and its constituent statements are
separated by semicolons. For example:
begin
Z := X;
X := Y;
X := Y;
end;
The last semicolon before end is optional. So we could have written this as
begin
Z := X;
X := Y;
Y := Z
end;
Compound statements are essential in contexts where Delphi syntax requires a single statement. In addition to program,
function, and procedure blocks, they occur within other structured statements, such as conditionals or loops. For example:
begin
I := SomeConstant;
while I > 0 do
begin
...
I := I - 1;
end;
end;
You can write a compound statement that contains only a single constituent statement; like parentheses in a complex term,
begin and end sometimes serve to disambiguate and to improve readability. You can also use an empty compound statement to
create a block that does nothing:
begin
end;
With Statements
A with statement is a shorthand for referencing the fields of a record or the fields, properties, and methods of an object. The
syntax of a with statement is 3
1. withobjdostatement, or
2. withobj1, ..., objndostatement
where obj is an expression yielding a reference to a record, object instance, class instance, interface or class type (metaclass)
instance, and statement is any simple or structured statement. Within the statement, you can refer to fields, properties, and
methods of obj using their identifiers alone, that is, without qualifiers.
For example, given the declarations
709
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
type
TDate = record
Day: Integer;
Month: Integer;
Year: Integer;
end;
var
OrderDate: TDate;
you could write the following with statement.
with OrderDate do
if Month = 12 then
begin
Month := 1;
Year := Year + 1;
end
else
Month := Month + 1;
you could write the following with statement.
if OrderDate.Month = 12 then
begin
OrderDate.Month := 1;
OrderDate.Year := OrderDate.Year + 1;
end
else
OrderDate.Month := OrderDate.Month + 1;
If the interpretation of obj involves indexing arrays or dereferencing pointers, these actions are performed once, before statement
is executed. This makes with statements efficient as well as concise. It also means that assignments to a variable within
statement cannot affect the interpretation of obj during the current execution of the with statement.
Each variable reference or method name in a with statement is interpreted, if possible, as a member of the specified object or
record. If there is another variable or method of the same name that you want to access from the with statement, you need to
prepend it with a qualifier, as in the following example.
with OrderDate do
begin
Year := Unit1.Year;
...
end;
When multiple objects or records appear after with, the entire statement is treated like a series of nested with statements. Thus
is equivalent to
with obj1 do
with obj2 do
...
with objn do
// statement
3 In this case, each variable reference or method name in statement is interpreted, if possible, as a member of objn; otherwise it is
interpreted, if possible, as a member of objn1; and so forth. The same rule applies to interpreting the objs themselves, so that,
for instance, if objn is a member of both obj1 and obj2, it is interpreted as obj2.objn.
If Statements
There are two forms of if statement: if...then and the if...then...else. The syntax of an if...then statement is
ifexpressionthenstatement
710
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
where expression returns a Boolean value. If expression is True, then statement is executed; otherwise it is not. For example,
if J <> 0 then Result := I / J;
The syntax of an if...then...else statement is
ifexpressionthenstatement1elsestatement2
where expression returns a Boolean value. If expression is True, then statement1 is executed; otherwise statement2 is
executed. For example,
if J = 0 then
Exit
else
Result := I / J;
The then and else clauses contain one statement each, but it can be a structured statement. For example,
if J <> o then
begin
Result := I / J;
Count := Count + 1;
end
else if Count = Last then
Done := True
else
Exit;
Notice that there is never a semicolon between the then clause and the word else. You can place a semicolon after an entire if
statement to separate it from the next statement in its block, but the then and else clauses require nothing more than a space or
carriage return between them. Placing a semicolon immediately before else (in an if statement) is a common programming error.
A special difficulty arises in connection with nested if statements. The problem arises because some if statements have else
clauses while others do not, but the syntax for the two kinds of statement is otherwise the same. In a series of nested
conditionals where there are fewer else clauses than if statements, it may not seem clear which else clauses are bound to which
ifs. Consider a statement of the form
ifexpression1thenifexpression2thenstatement1elsestatement2;
The compiler always parses in the first way. That is, in real code, the statement
if ... { expression1} then
if ... {expression2} then
... {statement1}
else
... {statement2}
is equivalent to
if ... {expression1} then
begin 3
if ... {expression2} then
... {statement1}
else
... {statement2}
end;
The rule is that nested conditionals are parsed starting from the innermost conditional, with each else bound to the nearest
available if on its left. To force the compiler to read our example in the second way, you would have to write it explicitly as
if ... {expression1} then
711
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
begin
if ... {expression2} then
... {statement1}
end
end
else
... {statement2};
Case Statements
The case statement may provide a readable alternative to deeply nested if conditionals. A case statement has the form
case selectorExpression of
caseList1: statement1;
...
caseListn: statementn;
end
where selectorExpression is any expression of an ordinal type smaller than 32 bits (string types and ordinals larger than 32 bits
are invalid) and each caseList is one of the following:
• A numeral, declared constant, or other expression that the compiler can evaluate without executing your program. It must be
of an ordinal type compatible with selectorExpression. Thus 7, True, 4 + 5 * 3, 'A', and Integer('A') can all be used as
caseLists, but variables and most function calls cannot. (A few built-in functions like Hi and Lo can occur in a caseList. See
Constant expressions ( see page 589).)
• A subrange having the form First..Last, where First and Last both satisfy the criterion above and First is less than or equal to
Last.
• A list having the form item1, ..., itemn, where each item satisfies one of the criteria above.
Each value represented by a caseList must be unique in the case statement; subranges and lists cannot overlap. A case
statement can have a final else clause:
case selectorExpression of
caseList1: statement1;
...
caselistn: statementn;
else
statements;
end
where statements is a semicolon-delimited sequence of statements. When a case statement is executed, at most one of
statement1 ... statementn is executed. Whichever caseList has a value equal to that of selectorExpression determines the
statement to be used. If none of the caseLists has the same value as selectorExpression, then the statements in the else clause
(if there is one) are executed.
712
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
else
Caption := '';
Other examples of case statements
case MyColor of
Red: X := 1;
Green: X := 2;
Blue: X = 3;
Yellow, Orange, Black: X := 0;
end;
case Selection of
Done: Form1.Close;
Compute: calculateTotal(UnitCost, Quantity);
else
Beep;
end;
Control Loops
Loops allow you to execute a sequence of statements repeatedly, using a control condition or variable to determine when the
execution stops. Delphi has three kinds of control loop: repeat statements, while statements, and for statements.
You can use the standard Break and Continue procedures to control the flow of a repeat, while, or for statement. Break
terminates the statement in which it occurs, while Continue begins executing the next iteration of the sequence.
Repeat Statements
The syntax of a repeat statement is
where expression returns a Boolean value. (The last semicolon before until is optional.) The repeat statement executes its
sequence of constituent statements continually, testing expression after each iteration. When expression returns True, the
repeat statement terminates. The sequence is always executed at least once because expression is not evaluated until after the
first iteration.
repeat
Write('Enter a value (0..9): ');
Readln(I);
until (I >= 0) and (I <= 9);
3
While Statements
A while statement is similar to a repeat statement, except that the control condition is evaluated before the first execution of the
statement sequence. Hence, if the condition is false, the statement sequence is never executed.
whileexpressiondostatement
where expression returns a Boolean value and statement can be a compound statement. The while statement executes its
713
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
constituent statement repeatedly, testing expression before each iteration. As long as expression returns True, execution
continues.
while I > 0 do
begin
if Odd(I) then Z := Z * X;
I := I div 2;
X := Sqr(X);
end;
For Statements
A for statement, unlike a repeat or while statement, requires you to specify explicitly the number of iterations you want the loop
to go through. The syntax of a for statement is
or
where
• counter is a local variable (declared in the block containing the for statement) of ordinal type, without any qualifiers.
• initialValue and finalValue are expressions that are assignment-compatible with counter.
• statement is a simple or structured statement that does not change the value of counter.
The for statement assigns the value of initialValue to counter, then executes statement repeatedly, incrementing or
decrementing counter after each iteration. (The for...to syntax increments counter, while the for...downto syntax decrements
it.) When counter returns the same value as finalValue, statement is executed once more and the for statement terminates. In
other words, statement is executed once for every value in the range from initialValue to finalValue. If initialValue is equal to
finalValue, statement is executed exactly once. If initialValue is greater than finalValue in a for...to statement, or less than
finalValue in a for...downto statement, then statement is never executed. After the for statement terminates (provided this
was not forced by a Break or an Exit procedure), the value of counter is undefined.
Warning: The iteration variable counter cannot be modified within the loop. This includes assignment, and passing the
variable to a var
parameter of a procedure. Doing so results in a compile-time warning. For purposes of controlling execution of the loop, the
expressions initialValue and finalValue are evaluated only once, before the loop begins. Hence the for...to statement is
almost, but not quite, equivalent to this while construction:
3 begin
counter := initialValue;
while counter <= finalValue do
begin
... {statement};
counter := Succ(counter);
end;
end
The difference between this construction and the for...to statement is that the while loop reevaluates finalValue before each
iteration. This can result in noticeably slower performance if finalValue is a complex expression, and it also means that changes
714
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
to the value of finalValue within statement can affect execution of the loop.
for I := 1 to 10 do
for J := 1 to 10 do
begin
X := 0;
for K := 1 to 10 do
X := X + Mat1[I,K] * Mat2[K,J];
Mat[I,J] := X;
end;
var
IArray1: array[0..9] of Integer = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
IArray2: array[1..10] of Integer = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
IArray3: array[1..2] of TIntArray = ((11, 12, 13, 14, 15, 16, 17, 18, 19, 20),
(21, 22, 23, 24, 25, 26, 27, 28, 29, 30)); 3
MultiDimTemp: TIntArray;
IDynArray: TGenericIntArray;
I: Integer;
begin
for I in IArray1 do
begin
715
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
begin
S1 := 'Now is the time for all good men to come to the aid of their country.';
S2 := '';
for C in S1 do
S2 := S2 + C;
if S1 = S2 then
WriteLn('SUCCESS #1');
else
WriteLn('FAIL #1');
for AC in OS1 do
OS2 := OS2 + AC;
716
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
var
MySet: TMySet;
MyThing: TMyThing;
CharSet: TCharSet;
{$IF DEFINED(CLR)}
C: AnsiChar;
{$ELSE}
C: Char;
{$IFEND}
begin
CharSet := [#0..#255];
for C in CharSet do
begin
// Do something with C...
end;
end.
To use the for-in loop construct on a class or interface, the class or interface must implement a prescribed collection pattern. A
type that implements the collection pattern must have the following attributes:
• The class or interface must contain a public instance method called GetEnumerator(). The GetEnumerator() method
must return a class, interface, or record type.
• The class, interface, or record returned by GetEnumerator() must contain a public instance method called MoveNext().
The MoveNext() method must return a Boolean.
• The class, interface, or record returned by GetEnumerator() must contain a public instance, read-only property called
Current. The type of the Current property must be the type contained in the collection.
If the enumerator type returned by GetEnumerator() implements the IDisposable interface, the compiler will call the Dispose
method of the type when the loop terminates.
The following code demonstrates iterating over an enumerable container in Delphi.
type
TMyIntArray = array of Integer;
TMyEnumerator = class
Values: TMyIntArray;
Index: Integer;
public
constructor Create;
function GetCurrent: Integer;
function MoveNext: Boolean;
property Current: Integer read GetCurrent;
end;
3
TMyContainer = class
public
function GetEnumerator: TMyEnumerator;
end;
constructor TMyEnumerator.Create;
begin
inherited Create;
Values := TMyIntArray.Create(100, 200, 300);
Index := -1;
717
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
end;
var
MyContainer: TMyContainer;
I: Integer;
Counter: Integer;
begin
MyContainer := TMyContainer.Create;
Counter := 0;
for I in MyContainer do
Inc(Counter, I);
• TList
• TCollection
• TStrings
• TInterfaceList
• TComponent
• TMenuItem
• TCustomActionList
• TFields
• TListItems
3 • TTreeNodes
• TToolBar
Blocks and Scope
Declarations and statements are organized into blocks, which define local namespaces (or scopes) for labels and identifiers.
Blocks allow a single identifier, such as a variable name, to have different meanings in different parts of a program. Each block is
part of the declaration of a program, function, or procedure; each program, function, or procedure declaration has one block.
718
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Blocks
A block consists of a series of declarations followed by a compound statement. All declarations must occur together at the
beginning of the block. So the form of a block is
{declarations}
begin
{statements}
end
The declarations section can include, in any order, declarations for variables, constants (including resource strings), types,
procedures, functions, and labels. In a program block, the declarations section can also include one or more exports clauses
(see Libraries and packages ( see page 635)).
Scope
An identifier, such as a variable or function name, can be used only within the scope of its declaration. The location of a
declaration determines its scope. An identifier declared within the declaration of a program, function, or procedure has a scope
limited to the block in which it is declared. An identifier declared in the interface section of a unit has a scope that includes any
other units or programs that use the unit where the declaration occurs. Identifiers with narrower scope, especially identifiers
declared in functions and procedures, are sometimes called local, while identifiers with wider scope are called global.
719
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Naming Conflicts
When one block encloses another, the former is called the outer block and the latter the inner block. If an identifier declared in an
outer block is redeclared in an inner block, the inner declaration takes precedence over the outer one and determines the
meaning of the identifier for the duration of the inner block. For example, if you declare a variable called MaxValue in the
interface section of a unit, and then declare another variable with the same name in a function declaration within that unit, any
unqualified occurrences of MaxValue in the function block are governed by the second, local declaration. Similarly, a function
declared within another function creates a new, inner scope in which identifiers used by the outer function can be redeclared
locally.
The use of multiple units further complicates the definition of scope. Each unit listed in a uses clause imposes a new scope that
encloses the remaining units used and the program or unit containing the uses clause. The first unit in a uses clause
represents the outermost scope and each succeeding unit represents a new scope inside the previous one. If two or more units
declare the same identifier in their interface sections, an unqualified reference to the identifier selects the declaration in the
innermost scope, that is, in the unit where the reference itself occurs, or, if that unit doesn't declare the identifier, in the last unit
in the uses clause that does declare the identifier.
The System and SysInit units are used automatically by every program or unit. The declarations in System, along with the
predefined types, routines, and constants that the compiler understands automatically, always have the outermost scope.
You can override these rules of scope and bypass an inner declaration by using a qualified identifier (see Qualified Identifiers (
see page 701)) or a with statement (see With Statements, above).
See Also
Fundamental Syntactic Elements ( see page 701)
3.1.3.14.3 Expressions
circuit evaluation is usually preferable because it guarantees minimum execution time and, in most cases, minimum code size.
Complete evaluation is sometimes convenient when one operand is a function with side effects that alter the execution of the
program.
circuit evaluation also allows the use of constructions that might otherwise result in illegal runtime operations. For example, the
following code iterates through the string S, up to the first comma.
while (I <= Length(S)) and (S[I] <> ',') do
begin
...
Inc(I);
end;
In the case where S has no commas, the last iteration increments I to a value which is greater than the length of S. When the
while condition is next tested, complete evaluation results in an attempt to read S[I], which could cause a runtime error. Under
short-circuit evaluation, in contrast, the second part of the while condition (S[I] <> ',') is not evaluated after the first part
fails.
3
Use the $B compiler directive to control evaluation mode. The default state is {$B}, which enables short-circuit evaluation. To
enable complete evaluation locally, add the {$B+} directive to your code. You can also switch to complete evaluation on a
project-wide basis by selecting Complete Boolean Evaluation in the Compiler Options dialog (all source units will need to be
recompiled).
Note: If either operand involves a Variant, the compiler always performs complete evaluation (even in the {$B} state).
720
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
String Operators
The relational operators =, <>, <, >, <=, and >= all take string operands (see Relational operators). The + operator concatenates
two strings.
String Operators
• The operands for + can be strings, packed strings (packed arrays of type Char), or characters. However, if one operand is of
type WideChar, the other operand must be a long string (AnsiString or WideString). 3
• The result of a + operation is compatible with any string type. However, if the operands are both short strings or characters,
and their combined length is greater than 255, the result is truncated to the first 255 characters.
Pointer Operators
The relational operators <, >, <=, and >= can take operands of type PChar and PWideChar (see Relational operators). The
following operators also take pointers as operands. For more information about pointers, see Pointers and pointer types ( see
721
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
page 575).
Character-pointer operators
The ^ operator dereferences a pointer. Its operand can be a pointer of any type except the generic Pointer, which must be
typecast before dereferencing.
P = Q is True just in case P and Q point to the same address; otherwise, P <> Q is True.
You can use the + and - operators to increment and decrement the offset of a character pointer. You can also use - to calculate
the difference between the offsets of two character pointers. The following rules apply.
• If I is an integer and P is a character pointer, then P + I adds I to the address given by P; that is, it returns a pointer to the
address I characters after P. (The expression I + P is equivalent to P + I.) P - I subtracts I from the address given by
P; that is, it returns a pointer to the address I characters before P. This is true for PChar pointers; for PWideChar pointers P
+ I adds SizeOf(WideChar) to P.
• If P and Q are both character pointers, then P - Q computes the difference between the address given by P (the higher
address) and the address given by Q (the lower address); that is, it returns an integer denoting the number of characters
between P and Q. P + Q is not defined.
Set Operators
The following operators take sets as operands.
Set Operators
722
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Relational Operators
Relational operators are used to compare two operands. The operators =, <>, <=, and >= also apply to sets.
Relational Operators
For most simple types, comparison is straightforward. For example, I = J is True just in case I and J have the same value,
and I <> J is True otherwise. The following rules apply to relational operators.
• Operands must be of compatible types, except that a real and an integer can be compared.
• Strings are compared according to the ordinal values that make up the characters that make up the string. Character types
are treated as strings of length 1.
• Two packed strings must have the same number of components to be compared. When a packed string with n components is
compared to a string, the packed string is treated as a string of length n.
• Use the operators <, >, <=, and >= to compare PChar (and PWideChar) operands only if the two pointers point within the
same character array.
• The operators = and <> can take operands of class and class-reference types. With operands of a class type, = and <> are
evaluated according the rules that apply to pointers: C = D is True just in case C and D point to the same instance object, and
C <> D is True otherwise. With operands of a class-reference type, C = D is True just in case C and D denote the same
class, and C <> D is True otherwise. This does not compare the data stored in the classes. For more information about
classes, see Classes and objects ( see page 514).
Class Operators
The operators as and is take classes and instance objects as operands; as operates on interfaces as well. For more information,
see Classes and objects ( see page 514) and Object interfaces ( see page 625). 3
The relational operators = and <> also operate on classes.
The @ Operator
The @ operator returns the address of a variable, or of a function, procedure, or method; that is, @ constructs a pointer to its
operand. For more information about pointers, see Pointers and pointer types ( see page 575). The following rules apply to @.
• If X is a variable, @X returns the address of X. (Special rules apply when X is a procedural variable; see Procedural types in
723
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
statements and expressions ( see page 578).) The type of @X is Pointer if the default {$T} compiler directive is in effect. In
the {$T+} state, @X is of type ^T, where T is the type of X (this distinction is important for assignment compatibility, see
Assignment-compatibility).
• If F is a routine (a function or procedure), @F returns F's entry point. The type of @F is always Pointer.
• When @ is applied to a method defined in a class, the method identifier must be qualified with the class name. For example,
@TMyClass.DoSomething
points to the DoSomething method of TMyClass. For more information about classes and methods, see Classes and objects
( see page 514).
Note: When using the @ operator, it is not possible to take the address of an interface method as the address is not known at
compile time and cannot be extracted at runtime.
Operator Precedence
In complex expressions, rules of precedence determine the order in which operations are performed.
Precedence of operators
Operators Precedence
@, not first
(highest)
*, /, div, mod, and, shl, shr, as second
+, -, or, xor third
=, <>, <, >, <=, >=, in, is fourth
(lowest)
An operator with higher precedence is evaluated before an operator with lower precedence, while operators of equal precedence
associate to the left. Hence the expression
X + Y * Z
multiplies Y times Z, then adds X to the result; * is performed first, because is has a higher precedence than +. But
X - Y + Z
first subtracts Y from X, then adds Z to the result; - and + have the same precedence, so the operation on the left is performed
first.
You can use parentheses to override these precedence rules. An expression within parentheses is evaluated first, then treated
as a single operand. For example,
(X + Y) * Z
multiplies Z times the sum of X and Y.
Parentheses are sometimes needed in situations where, at first glance, they seem not to be. For example, consider the
expression
3 X = Y or X = Z
The intended interpretation of this is obviously
(X = Y) or (X = Z)
Without parentheses, however, the compiler follows operator precedence rules and reads it as
(X = (Y or X)) = Z
which results in a compilation error unless Z is Boolean.
724
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Parentheses often make code easier to write and to read, even when they are, strictly speaking, superfluous. Thus the first
example could be written as
X + (Y * Z)
Here the parentheses are unnecessary (to the compiler), but they spare both programmer and reader from having to think about
operator precedence.
Description
This topic describes syntax rules of forming Delphi expressions.
X variable
@X address of the variable X
15 integer constant
InterestRate variable
Calc(X, Y) function call
X * Y product of X and Y
Z / (1 - Z) quotient of Z and (1 - Z)
X = 1.5 Boolean
C in Range1 Boolean
not Done negation of a Boolean
['a', 'b', 'c'] set
Char(48) value typecast
The simplest expressions are variables and constants (described in Data types ( see page 553)). More complex expressions
are built from simpler ones using operators, function calls, set constructors, indexes, and typecasts.
Operators
Operators behave like predefined functions that are part of the Delphi language. For example, the expression (X + Y) is built
from the variables X and Y, called operands, with the + operator; when X and Y represent integers or reals, (X + Y) returns 3
their sum. Operators include @, not, ^, *, /, div, mod, and, shl, shr, as, +, -, or, xor, =, >, <, <>, <=, >=, in, and is.
The operators @, not, and ^ are unary (taking one operand). All other operators are binary (taking two operands), except that +
and - can function as either a unary or binary operator. A unary operator always precedes its operand (for example, -B), except
for ^, which follows its operand (for example, P^). A binary operator is placed between its operands (for example, A = 7).
Some operators behave differently depending on the type of data passed to them. For example, not performs bitwise negation
on an integer operand and logical negation on a Boolean operand. Such operators appear below under multiple categories.
725
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Except for ^, is, and in, all operators can take operands of type Variant ( see page 580).
The sections that follow assume some familiarity with Delphi data types ( see page 553).
For information about operator precedence in complex expressions, see Operator Precedence Rules, later in this topic.
Arithmetic Operators
Arithmetic operators, which take real or integer operands, include +, -, *, /, div, and mod.
• The value of x / y is of type Extended, regardless of the types of x and y. For other arithmetic operators, the result is of
type Extended whenever at least one operand is a real; otherwise, the result is of type Int64 when at least one operand is of
type Int64; otherwise, the result is of type Integer. If an operand's type is a subrange of an integer type, it is treated as if it
were of the integer type.
• The value of x div y is the value of x / y rounded in the direction of zero to the nearest integer.
• The mod operator returns the remainder obtained by dividing its operands. In other words, x mod y = x —(x div y) *
y.
• A runtime error occurs when y is zero in an expression of the form x / y, x div y, or x mod y.
Boolean Operators
The Boolean operators not, and, or, and xor take operands of any Boolean type and return a value of type Boolean.
Boolean Operators
726
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
These operations are governed by standard rules of Boolean logic. For example, an expression of the form x and y is True if
and only if both x and y are True.
Function Calls
Because functions return a value, function calls are expressions. For example, if you've defined a function called Calc that takes
two integer arguments and returns an integer, then the function call Calc(24,47) is an integer expression. If I and J are
integer variables, then I + Calc(J,8) is also an integer expression. Examples of function calls include
Sum(A, 63)
Maximum(147, J)
Sin(X + Y)
Eof(F)
Volume(Radius, Height)
GetValue
TSomeObject.SomeMethod(I,J);
For more information about functions, see Procedures and functions ( see page 662).
Set Constructors
A set constructor denotes a set-type value. For example,
[5, 6, 7, 8]
denotes the set whose members are 5, 6, 7, and 8. The set constructor
[ 5..8 ]
could also denote the same set.
where each item is either an expression denoting an ordinal of the set's base type or a pair of such expressions with two dots (..)
in between. When an item has the form x..y, it is shorthand for all the ordinals in the range from x to y, including y; but if x is
greater than y, then x..y, the set [x..y], denotes nothing and is the empty set. The set constructor [ ] denotes the empty
set, while [x] denotes the set whose only member is the value of x.
727
Delphi Language Guide RAD Studio (Common) 3.1 Delphi Reference
Typecasts
It is sometimes useful to treat an expression as if it belonged to different type. A typecast allows you to do this by, in effect,
temporarily changing an expression's type. For example, Integer('A') casts the character A as an integer.
typeIdentifier(expression)
If the expression is a variable, the result is called a variable typecast; otherwise, the result is a value typecast. While their syntax
is the same, different rules apply to the two kinds of typecast.
Value Typecasts
In a value typecast, the type identifier and the cast expression must both be ordinal or pointer types. Examples of value
typecasts include
Integer('A')
Char(48)
Boolean(0)
Color(2)
Longint(@Buffer)
The resulting value is obtained by converting the expression in parentheses. This may involve truncation or extension if the size
of the specified type differs from that of the expression. The expression's sign is always preserved.
The statement
I := Integer('A');
assigns the value of Integer('A'), which is 65, to the variable I.
A value typecast cannot be followed by qualifiers and cannot appear on the left side of an assignment statement.
Variable Typecasts
You can cast any variable to any type, provided their sizes are the same and you do not mix integers with reals. (To convert
numeric types, rely on standard functions like Int and Trunc.) Examples of variable typecasts include
Char(I)
Boolean(Count)
TSomeDefinedType(MyVariable)
Variable typecasts can appear on either side of an assignment statement. Thus
var MyChar: char;
...
Shortint(MyChar) := 122;
assigns the character z (ASCII 122) to MyChar.
You can cast variables to a procedural type. For example, given the declarations
type Func = function(X: Integer): Integer;
var
F: Func;
3 P: Pointer;
N: Integer;
you can make the following assignments.
F := Func(P); { Assign procedural value in P to F }
Func(P) := F; { Assign procedural value in F to P }
@F := P; { Assign pointer value in P to F }
P := @F; { Assign pointer value in F to P }
N := F(N); { Call function via F }
N := Func(P)(N); { Call function via P }
728
3.1 Delphi Reference RAD Studio (Common) Delphi Language Guide
Variable typecasts can also be followed by qualifiers, as illustrated in the following example.
type
TByteRec = record
Lo, Hi: Byte;
end;
TWordRec = record
Low, High: Word;
end;
var
B: Byte;
W: Word;
L: Longint;
P: Pointer;
begin
W := $1234;
B := TByteRec(W).Lo;
TByteRec(W).Hi := 0;
L := $1234567;
W := TWordRec(L).Low;
B := TByteRec(TWordRec(L).Low).Hi;
B := PByte(L)^;
end;
In this example, TByteRec is used to access the low- and high-order bytes of a word, and TWordRec to access the low- and
high-order words of a long integer. You could call the predefined functions Lo and Hi for the same purpose, but a variable
typecast has the advantage that it can be used on the left side of an assignment statement.
For information about typecasting pointers, see Pointers and pointer types ( see page 575). For information about casting class
and interface types, see The as operator ( see page 539) and Interface typecasts ( see page 631).
See Also
Fundamental Syntactic Elements ( see page 701)
729
Code Visualization RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Topics
Name Description
Code Visualization ( see page 730)
Components ( see page 732)
Database ( see page 737)
Edit ( see page 754)
Error Messages ( see page 760)
File ( see page 768)
HTML Elements ( see page 801)
Insert ( see page 813)
Testing Wizards ( see page 815)
NET_VS ( see page 817)
Project ( see page 819)
Propeditors ( see page 910)
Run ( see page 936)
Search ( see page 952)
Together ( see page 957)
Tools ( see page 979)
View ( see page 1014)
Win View ( see page 1062)
The following table shows the standard UML notations used on the diagram.
730
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Code Visualization
A class
An interface
Tip: If the diagram is too large to view all at once, you can use the Overview
See Also
Using Code Visualization
Use this dialog to create a file with the Code Visualization diagram. Various graphics file formats are supported, including
BMP, JPG, and GIF.
Item Description
Z The zoom (magnification) factor for the image. You can enter a numeric value in this field, or use the 3
Preview zoom slider on the preview pane. A value of 1.0 creates a full size image, while (for
example) a value of 0.5 scales the image to half its size. A value of 1.5 scales the image to 1.5 times
its size.
W The width of the image. The image will be scaled to the new size, and the zoom factor field will be
updated to reflect the new scaling value.
H The height of the image. The image will be scaled to the new size, and the zoom factor field will be
updated to reflect the new scaling value.
731
Components RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Preview Click to show or hide a preview of the image. The preview shows how the image will look, given the
current values of Z, W, and H.
Preview zoom Use the slider control to scale the image to a smaller size. When the slider is at the leftmost position,
a full size image (1:1) will be created. When at the rightmost position, the image size will be
decreased by 16 times (1:16).
Auto preview zoom Click to have the image Preview pane update in real-time, as you slide the Preview zoom control.
Save Click to open a Windows Save-as dialog that will let you choose the graphical file format for the
image file.
See Also
Using Code Visualization
3.2.2 Components
Topics
Name Description
Create Component Template ( see page 732) Component Create Component Template
Use this dialog box to save the selected components on the current form as a
reusable component template.
Import Component ( see page 733) Component Import Component
Imports a type library, ActiveX Control, or a .NET assembly.
You need to choose VCL for C++ or VCL for Delphi if you select Import
Component with no project open.
Packages ( see page 734) Components Install Packages
Specifies the design time packages installed in the IDE and the runtime
packages that you want to install on your system, for use on all projects.
Assembly Search Paths ( see page 734) Component Installed .NET Components
Use this page to change the assembly search path that RAD Studio uses when
locating assemblies.
Installed .NET Components ( see page 734) Component Installed .NET Components
Controls which .NET components are displayed in the Tool Palette.
.NET VCL Components ( see page 735) Component Installed .NET Components
Use this page to control which .NET VCL components are displayed in the Tool
Palette.
New Component ( see page 735) Component New VCL Component
Create the basic unit for a new component.
You need to choose VCL for C++, VCL for Delphi or VCL for Delphi .NET if
you select New VCL Component with no project open.
New VCL Component Wizard ( see page 736) Component New VCL Component
Use this wizard to create a new VCL.NET or VCL Win32 component.
3
3.2.2.1 Create Component Template
Component Create Component Template
Use this dialog box to save the selected components on the current form as a reusable component template.
732
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Components
Item Description
Component name Indicates the name of the new component template. By default, the name of the first component that
you selected is displayed and the word Template is appended to it. You can change this name, but
be careful not to duplicate existing component names.
Palette page Select the Tool Palette category in which you want the new template to appear.
Palette icon Indicates the icon used to represent the component template in the Tool Palette. By default, the icon
of the first component you selected is displayed. To change it, click the Change button and choose a
new file. The bitmap must be no larger than 24 pixels by 24 pixels.
See Also
Creating a Component Template ( see page 154)
You need to choose VCL for C++ or VCL for Delphi if you select Import Component with no project open.
Item Description
Import a Type Library Click to import a type library.
Import ActiveX Control Click to import an ActiveX Control.
Import .NET assembly Click to import a .NET assembly as a COM object.
Item Description
Component list Displays a list of registered type libraries, ActiveX Controls, or .NET assemblies in the Global
Assembly Cache.
Add Click to browse for a new component to add to the list.
Component
Use the component page to edit parameters used to import the component into the IDE.
Item Description
Class Name Displays the name of the class (or classes) that will be created.
Palette Page Select the Tool Palette category where you want the components to appear.
3
Unit name Type the name of the unit that will contain the component.
Browse button Click to navigate to the folder where the unit file will reside.
Search path Enter the search path for the new component. The default value is the environment options library
search path. The folder designated in the unit name field will be appended to the search path.
733
Components RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
3.2.2.3 Packages
Components Install Packages
Specifies the design time packages installed in the IDE and the runtime packages that you want to install on your system, for use
on all projects.
Item Description
Design packages Lists the design time packages available to the IDE and all projects. Check the design packages you
want to make available on a system-wide level. You do not need to have a project open to install
packages on a system-wide level.
Add Installs a design time package. The package will be available in all projects.
Remove Deletes the selected package. The package becomes unavailable in all projects.
Edit Opens the selected package in the Package Editor if the source code or .dcp file is available.
Use this page to change the assembly search path that RAD Studio uses when locating assemblies.
Item Description
Search Paths Lists the paths that will be searched for assemblies when a component is created in the development
environment. If a component exists in more than one assembly, it will be used from the first assembly
in which it is found.
Use the up and down arrow buttons to the right of the search path list to move the selected path up or
down in the search order.
Replace Replaces the currently selected path in the Search Path list with the path in the box above the
Replace button.
Add Adds the path displayed in the box above the Add button to the Search Path list.
Use the browse button to navigate to an existing folder.
Delete Deletes the currently selected path from the Search Path list.
Reset Sets assembly path search paths back to the original configuration.
Item Description
Indicates whether the component is displayed in the Tool Palette. Checked components are
displayed; unchecked components are not displayed.
Name The name of the component.
734
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Components
Category The functional category to which the component belongs. At least one component name must be
checked for the category to appear in the Tool Palette.
Namespace The namespace to which the component belongs.
Assembly Name The name of the assembly (.dll) that contains the component.
Assembly Path The location of the assembly.
Category Enter the category to which you want to add an assembly.
Select an Assembly Displays a dialog box allowing you to browse to an assembly or executable file.
Reset Sets installed components to the original configuration.
Use this page to control which .NET VCL components are displayed in the Tool Palette.
Item Description
Indicates whether this category of components is displayed in the Tool Palette.
Name The name of the component.
Namespace/unit The namespace and unit to which the component belongs.
Add Displays a dialog box, allowing you to navigate to and install a DLL containing .NET VCL
components.
Remove Removes the selected (highlighted) category of components from the Tool Palette.
Reset Restores the original configuration of installed components.
Tip: The status bar at the bottom of this dialog displays the path for the selected component category.
You need to choose VCL for C++, VCL for Delphi or VCL for Delphi .NET if you select New VCL Component with no project
open.
Item Description
Ancestor type Use the drop-down list to select a base class, or enter the name of a base class for your new 3
component. Unless you override them in the component declaration, your new component will inherit
all the properties, methods, and events from its ancestor class. After you enter a base class, default
entries are written to the Class name and Unit file name. You can accept or edit these entries.
Class name The name of the new class you are creating. In general, classe names are prefaced with a T. For
example, the name of your new button component might be TMyButton.
Palette page Use the drop-down list to select a category, or enter the name of the category, in which you want your
new component to appear on the Tool Palette.
735
Components RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Unit file name Specifies the name of the unit that will contain the new component. You can include a directory path
with the name; otherwise, the unit will be created in the current directory. If the unit directory is not in
the Search path, it will be added to the end of the path.
Search path Specifies the path the product uses to search for files.
OK Creates the component but does not install it. To install the component later, choose
Component Installed .NET Components.
Item Description
Delphi for VCL.NET Click to create a new component for the VCL.NET framework and platform.
Delphi for VCL Win32 Click to create a new component for the VCL Win32 framework and platform.
Ancestor Component
The Ancestor Component page displays a list of installed components that can be used as ancestors for the new component.
This dialog displays installed components for the platform selected on the previous page.
Item Description
Component list Shows a list of installed components for the platform selected in the previous page.
Component
The Component page allows you to edit parameters used to create the new component.
Item Description
Class Name Enter a class name for the new component, or accept the default value.
Palette Page Select the Tool Palette category on which the new component will appear.
Unit name Enter the name of the unit for the new component.
Search path Enter the search path for the new component. The default value is the environment options library
search path.
Install
Use the Install page to select an action for the IDE to take when it installs the new component.
Item Description
Create a unit Click to cause the IDE to create a new unit.
3
Install to Existing Click to install the new component into a package that already exists.
Package
Install to New Package Click to cause the IDE to generate a new package.
Note: If the new component's platform is Win32 and the active project is a Win32 package, an additional radio button will appear
allowing you to install the component into the active project. Similarly, if the new component's platform is .NET, and the active
project is a .NET package, an additional radio button will appear allowing you to install the component into the active project.
736
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Database
Existing Package
Use this dialog to select an existing package in which to install the new component.
Item Description
Installed package list Lists all the packages currently installed on the system.
New Package
Use this dialog to enter the name of a new package in which to install the new component
Item Description
File name Enter a file name for the new package. Click the browse button to navigate to the folder where the
new package will reside.
Description Enter a description for the new package.
3.2.3 Database
Topics
Name Description
Add Fields ( see page 739) Use this dialog box to create a persistent field component for a dataset.
Each time you open the dataset, the product verifies that each non-calculated
persistent field exists or can be created from data in the database, and then
creates persistent components for the fields you specified. If it cannot, it raises an
exception warning you that the field is not valid, and does not open the dataset.
After you have created a field component for the dataset, the product no longer
creates dynamic field components for every column in the underlying database.
Tip: To select multiple fields, press CTRL... more ( see page 739)
Assign Local Data ( see page 739) Use this dialog box to copy the current set of records from another dataset to the
selected client dataset. This is useful when populating client datasets for use as
lookup tables, or when testing client datasets at design-time. Select the dataset
you want to copy from the list of datasets available to the current form, then click
OK. To clear the records in a client dataset at design-time, set the dataset's
Active property to true, then right-click the client dataset and choose Clear Data.
Columns Collection Editor ( see page 740) Use this dialog to to create and remove columns in a dataset DataTable object
and to configure the properties for dataset columns. If you set your data adapter
Active property to True, the names of the dataset columns, as returned from the
database, appear in the members list.
Constraints Collection Editor ( see page 740) Use this dialog to add, configure, and remove constraints to or from a dataset's
DataTable columns. You can manage unique constraints and foreign key
constraints in this editor.
Relations Collection Editor ( see page 740) Use this dialog to create, edit, and delete relationships between the tables in the
current dataset.
Tables Collection Editor ( see page 741) Use this dialog to add and remove DataTable objects to or from a dataset and to
set the properties for each DataTable object. The members list automatically
displays one member for each DataTable in the corresponding dataset only if the
Active property is set to True for the data adapter.
CommandText Editor ( see page 741) Use this dialog box to construct the command text for the CommandText property
of the BdpCommand.
3
Command Text Editor ( see page 742) Use this dialog box to construct the command text (SQL statement) for dataset
components that have a CommandText property. The dialog buttons add
SELECT and FROM clauses; other clauses (WHERE, GROUP BY, HAVING,
ORDER BY, and so on) must be added manually to the SQL edit control.
Configure Data Adapter ( see page 742) Use this dialog box to construct the command text for the DataAdapter property
of the BdpDataAdapter.
Connection Editor ( see page 743) Use this dialog box to select a connection configuration or to edit the named
connections that are stored in the BdpConnection.xml file. This editor lets you
add, delete, and test your connection.
737
Database RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Connection Editor ( see page 743) Use this dialog box to select a connection configuration for a TSQLConnection
component or to edit the named connections that are stored in the
dbxconnections.ini file. Any changes you make in the dialog are written to the
dbxconnections.ini file when you click OK. The selected connection is also
assigned as the value of the SQL Connection component’s ConnectionName
property.
Connection String Editor (ADO) ( see page 744) Use this dialog box to specify the connection string used to connect an ADO data
component to an ADO data store. You can type the connection string, build it
using an ADO-supplied dialog box, or place the string in a file.
Data Adapter Dataset ( see page 744) Use this tab to select the dataset to associate with the Data Adapter.
DataAdapter Preview ( see page 744) Use this dialog box to preview the result set that is returned from the current SQL
Select statement. By reviewing the result set, you can tune your SQL statements
to provide a more accurate result set, which you can move into or out of the
DataSet. This dialog is accessed from the CommandText Editor and the
Configure Data Adapter dialog.
Database Editor ( see page 745) Use this dialog box to set up the connection to a database.
Database Form Wizard ( see page 745) Other New Other Delphi Projects Business Database From Wizard
Use this wizard to create a form that displays data from a local or remote
database. The wizard will connect the form to a TTable or TQuery component,
write SQL statements for TQuery components, define the form tab order, and
connect TDataSource components to TTable/TQuery components.
Follow the instructions on each wizard page. Click Next to continue to the next
page and then click Finish to generate the form based on the information you
have provided.
Tip: The Database Form Wizard
is also available from the Database Form Wizard menu.
Dataset Properties ( see page 746) Use this dialog to examine the tables, columns, and other properties of a dataset.
The left pane of the dialog displays the dataset and its tables. Select an object in
the left pane to display its properties in a read-only grid in the right pane.
Driver Settings ( see page 746) Use this dialog box to see what files are associated with each dbExpress driver
name. These associations are stored in the drivers.ini file.
Field Link Designer ( see page 746) Use this dialog box to establish a master-detail relationship between two tables.
Fields Editor ( see page 746) Use this dialog box to add new persistent fields to a dataset and create data
fields, calculated fields, and lookup fields. The dialog box is displayed when you
right-click any of several dataset components, such as TADODataSet or
TSQLDataSet, and choose Fields Editor.
Use the Fields Editor at design time to create persistent lists of the field
components used by the datasets in your application. Persistent fields
component lists are stored in your application, and do not change even if the
structure of a database underlying a dataset is changed. All fields in a dataset
are either persistent or dynamic.... more ( see page 746)
Foreign Key Constraint ( see page 747) Use this dialog box to define a foreign key constraint between tables in a dataset.
The table you selected when navigating to this dialog is automatically set to the
foreign key table. You could, therefore, attempt to set the master table in a
master-detail relationship to be the detail table. This could, at the very least
return unpredictable results. If the actual detail, or foreign key, table's foreign key
column contains duplicates, you may generate a design-time error.
Generate Dataset ( see page 748) Use this dialog box to sort records in a dataset, locate records quickly, limit
records that are visible, and establish master/detail relationships.
New Connection ( see page 748) Use this dialog box to create a new named database connection configuration.
New Field ( see page 748) Use this dialog box to create persistent fields in a dataset. You can add
persistent fields or replace existing persistent fields.
Relation ( see page 749) Use this dialog box to define a relationship between tables in a dataset.
Rename Connection ( see page 749) Enter a new name for the currently selected named connection in the
Connection Builder. Renaming a connection updates the dbxconnections.ini file
to change the name for the selected connection configuration. The old name
becomes unavailable and can no longer be used as the ConnectionName
3 property of a TSQLConnection component.
SQL Monitor ( see page 749) Database SQL Monitor
Use this dialog box to see the actual statement calls made through SQL Links to
a remote server or through the ODBC socket to an ODBC data source.
You can monitor different types of activity by choosing Options Trace
Options to display the Trace Options dialog box.
Sort Fields Editor ( see page 750) Use this dialog box to specify the fields used to sort records in a SQL dataset,
which has the CommandType property set to ctTable.
738
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Database
Stored Procedures Dialog ( see page 751) Use this dialog box to select a stored procedure for a BdpCommand. You can
specify values for Input or InputOutput parameters and execute the selected
stored procedure.
TableMappings Collection Editor ( see page 751) Use this dialog box to map columns between your data source and the
in-memory dataset.
Unique Constraint ( see page 752) Use this dialog box to select the dataset columns you want included in your
constraint, which means these columns will be forced to contain only unique
values. You can also set one or more columns as your primary key.
IBDatabase Editor dialog box ( see page 752) The Database Editor dialog box sets up the properties of a database that specify
the connection that should be made to a database. This dialog box allows you to
specify the type of database, the connection parameters, the user name, SQL
role, and password, and whether or not a login prompt is required.
These properties of the database component, as well as others, can also be
specified using the Object Inspector.
To display the Database Editor dialog box, double click on an IBDatabase
component.
IBTransaction Editor dialog box ( see page 753) The Transaction Editor dialog box allows you to set up transaction parameters.
This dialog box gives you four default transaction settings, which you can then
customize if you wish. Once you modify the default transaction, the radio button
is unset.
For a complete list of all the InterBase transaction parameters, refer to 'Working
with Transactions' in the InterBase API Guide.
These properties of the transaction component, as well as others, can also be
specified using the Object inspector.
To display the Transaction Editor dialog box, double click on an IBTransaction
component. The following four choices are displayed:
IBUpdateSQL and IBDataSet Editor dialog box ( see page 753) Use the editor to create SQL statements for updating a dataset.
The TIBUpdateSQL object must be associated with a TIBQuery object by setting
the TIBQuery property UpdateObject to the name of the TIBUpdateSQL object
used to contain the SQL statements. A datasource and database name must be
selected for the TIBQuery object. In addition, the SQL property must include an
SQL statement defining a table.
To open the SQL editor:
Each time you open the dataset, the product verifies that each non-calculated persistent field exists or can be created from data
in the database, and then creates persistent components for the fields you specified. If it cannot, it raises an exception warning
you that the field is not valid, and does not open the dataset.
After you have created a field component for the dataset, the product no longer creates dynamic field components for every
column in the underlying database.
739
Database RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
copy from the list of datasets available to the current form, then click OK. To clear the records in a client dataset at design-time,
set the dataset's Active property to true, then right-click the client dataset and choose Clear Data.
Item Description
Add Adds a column to the dataset DataTable object.
Remove Removes the selected column from the dataset DataTable object.
Properties Contains a list of database properties that you can apply to the dataset columns. These may change
based on the database type.
Properties | If you are mapping your dataset columns to an XML file, set this property to determine whether the
ColumnMapping column value should be treated as an element, an attribute, simple content, or if it should be hidden.
See Also
Using Standard Datasets
Item Description
Add Adds either a unique constraint or a foreign key constraint to the DataTable column.
Edit This button appears after you have added a constraint. It allows you to change the columns specified
in the constraint.
Remove Removes the selected constraint from a DataTable column.
Properties The properties list is read-only, because all properties displayed here are derived from existing
dataset and column definitions. You can, however, expand selections in this list to view the specific
properties for a given column, and for the constraint itself.
See Also
Using Standard Datasets
3
3.2.3.5 Relations Collection Editor
Use this dialog to create, edit, and delete relationships between the tables in the current dataset.
Item Description
Add Adds a new relation to the relation collection. Displays the Relation dialog, allowing you to specify a
relationship name, keys, and rules for tables in your dataset.
Edit Displays the Relation dialog, allowing you to change an existing table relation.
740
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Database
See Also
Using Standard Datasets
Item Description
Add Adds a DataTable object to the dataset.
Remove Removes the selected DataTable object from the dataset.
See Also
Using Standard Datasets
Item Description
Connection Specifies a connection from a list of live BdpConnection objects. You must select this item first to
populate the other text boxes with usable data.
Select Specifies that a SQL Select statement is to be generated by the BdpCommandBuilder. This
statement must exist for the BdpCommandBuilder to be able to construct other statements, such as
Update, Insert, or Delete statements. You can either supply your own Select statement in the
BdpCommand object, or use this dialog to create one.
Update Specifies that the BdpCommandBuilder is to generate an Update statement based on the Select
statement.
Insert Specifies that the BdpCommandBuilder is to generate an Insert statement based on the Select
statement.
Delete Specifies that the BdpCommandBuilder is to generate a Delete statement based on the Select
statement.
Generate SQL Generates SQL statements for the selected check box items.
Optimize Specifies that, when possible, the BdpCommandBuilder is to generate optimized SQL statements for 3
the selected check box items.
Tables Displays a list of tables from the current database, represented by the current BdpConnection. To
display a list of columns, select a table from the list. Select a table name to include it in the SQL
statement that is currently visible in the SQL text box.
Columns Displays a list of columns from a selected table. Select one or more column names to include them in
the SQL statement that is currently visible in the SQL text box.
741
Database RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Tables Displays the names of tables available in the current database. Select a table and click the Add
Table to SQL button to add it to the command (SQL statement) displayed in the SQL edit control.
Add Table to SQL Adds a SELECT clause for the table name selected in the Tables list to SQL edit box.
Fields Displays the names of the columns available in the table currently highlighted in the Tables list.
Select one or more columns and click the Add Field to SQL button to add it to the command (SQL
statement) displayed in the SQL edit control.
To select multiple columns, press CTRL and click the columns. To select a range of columns, press
SHIFT and click the first and last columns in the range.
Add Field to SQL Adds the columns selected in the Fields list to the SELECT clause.
SQL Displays the command (SQL statement) for the CommandText property of the dataset or command
component. This statement can be edited manually.
Item Description
Connection Specifies a connection from a list of live BdpConnections. You must select this item first to populate
the other text boxes with usable data.
Select Specifies that a SQL Select statement is to be generated by the BdpCommandBuilder. This
statement must exist for the BdpCommandBuilder to be able to construct other statements, such as
Update, Insert, or Delete statements. You can either supply your own Select statement in the
BdpCommand object, or use this dialog to create one.
Update Specifies that the BdpCommandBuilder is to generate an Update statement based on the Select
statement.
Insert Specifies that the BdpCommandBuilder is to generate an Insert statement based on the Select
statement.
Delete Specifies that the BdpCommandBuilder is to generate a Delete statement based on the Select
statement.
Generate SQL Generates SQL statements for the selected check box items.
Optimize Specifies that, when possible, the BdpCommandBuilder is to generate optimized SQL statements for
3 the selected check box items.
Tables Displays a list of tables from the current database, represented by the current BdpConnection. To
display a list of columns, select a table from the list. Select a table name to include it in the SQL
statement that is currently visible in the SQL text box.
Columns Displays a list of columns from a selected table. Select one or more column names to include them in
the SQL statement that is currently visible in the SQL text box.
742
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Database
Item Description
Connections Shows all the named connection configurations for the currently selected driver. When you select a
connection from this list box, the Connection Settings table displays the connection parameters for
that named connection.
Connection Settings Lists the connection parameters for the currently selected connection name. The Name column lists
the names of connection parameters that are applicable to the driver associated with the current
connection. The Value column changes the value of any connection parameter.
Add Lets you add a new named connection. Click the Add button to display the Add New Connection
dialog box to specify the name for the connection configuration and indicate what drivers to use.
Remove Deletes the connection currently selected in the Connections list box. Deleting a named connection
removes it from the dbxconnections.ini file so that it is no longer available for use by any application.
Test Attempts to establish a connection to the database server using the currently specified connection
settings. Click this button to check that the currently defined connection configuration can be used.
Item Description
Add Connection Displays the New Connection dialog, allowing you to specify the name for the connection
configuration and indicate what driver it uses. The new name connection configuration is added to the
dbxconnections.ini file.
Delete Connection Deletes the connection currently selected in the Connections list box. Deleting a named connection
removes it from the dbxconnections.ini file so that it is no longer available for use by any application.
Rename Connection Displays the Rename connection dialog, where you can specify a new name for the connection
currently selected in the Connections list box. Renaming a connection configuration renames it in
the dbxconnections.ini file so that the old name is no longer available for use by any application.
Test Connection Attempts to establish a connection to the database server using the currently specified connection
settings. Use this button to check that the currently defined connection configuration can be used.
View Driver Settings Displays the Driver Settings dialog, where you can obtain information about the currently installed
drivers.
Driver Name Lists all of the drivers for which there is a connection defined. When you select a driver, the
Connections list box displays only the names of connection configurations for the selected driver. 3
Connection Settings Lists the connection parameters for the currently selected connection name. The Key column lists the
names of all connection parameters that are applicable to the driver associated with the current
connection. You can select entries in the Value column to change the value of any connection
parameter.
Do not change the driver name for a connection. If you change the driver name, the listed connection
parameters will not be appropriate for the new driver you specify.
743
Database RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Connection Name Lists all of the named connection configurations for the currently selected driver. You can select a
connection name and edit the connection settings to make changes to the configuration stored in the
dbxconnections.ini file, or simply select a connection and click OK to assign that connection
configuration as the value of the ConnectionName.
Item Description
Use Data Link File Select or enter the name of a data link file, or click the Browse button to locate the file.
Use Connection String Enter the connection string with the connection information in the edit box.
Alternatively, click the Build button to display the Data Link Properties dialog to guide you through
setting up and testing the connection.
Tip: ADO supports the following four arguments for connection strings: provider, file name, remote provider, and remote server.
Any other arguments are passed on to the provider. Such parameters might include user ID, login password, the name of a
default database, persistent security information, ODBC data source names, connection time-out values, and locale identifiers.
These parameters and their values are specific to particular providers, servers, and ODBC drivers and not to either ADO or
Delphi. For specific information on them, consult the documentation for the provider, server, or ODBC driver.
Item Description
New Data Set Specifies a new data set if you do not have an existing one.
Existing Data Set Specifies an existing dataset associated with the Data Adapter.
None Does not specify any dataset.
Item Description
3
Limit Rows Specifies a rowlimit option on the current SQL statement.
Rows to fetch Sets the actual rowlimit maximum.
Refresh Refreshes the result set displayed in the list, by executing the SQL statement again.
744
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Database
Item Description
Name Specifies the name of the database. This name refers to the database component from within the
code of your application.
Alias Name Specifies the BDE alias for the database. Choose a database aliases from the drop-down list. This list
contains all aliases currently registered with the BDE. If you do not want to connect to a database that
is registered as a BDE alias, you can set the Driver property instead. If you set the Alias property, the
Driver property is cleared, as the driver type is implicit in the BDE alias.
Driver Name Specifies the type of database represented by the database component. Choose a driver type such
as STANDARD, ORACLE, SYBASE, or INTERBASE from the drop-down list. If the database server
has an alias registered with the BDE, you can set the Alias instead. Setting the Driver automatically
clears the Alias property, to avoid potential conflicts with the driver type implicit in the database alias.
Parameter overrides Specifies the values of all login parameters when connecting to the database. The specific
parameters depend on the type of database. To obtain a list of all parameters, as well as their default
values, click the Defaults button. You can then modify the default values to the values you want to
use.
Defaults Sets the Parameter overrides to the default values for the driver type.
Clear Removes all parameter overrides.
Login Prompt Causes a login dialog to appear automatically when the user connects to the database. Uncheck the
Login Prompt control to prevent the automatic login dialog. Most database servers (except for the
file-based STANDARD types) require the user to supply a password when connecting to the
database. For such servers, if the automatic login prompt is omitted, the application must supply the
user name and password in some other manner. These can be supplied either by providing
hard-coded parameter overrides, or by supplying an OnLogin event handler that sets the values for
these parameters.
Keep inactive Indicates that the application should remain connected to the database even if no datasets are
connection currently open. For connections to remote database servers, or for applications that frequently open
and close datasets, checking Keep inactive connection reduces network traffic, speeds up
applications, and avoids logging in to the server each time the connection is reestablished. Uncheck
Keep inactive connection to cause the database connection to be dropped when there are no open
datasets. Dropping a connection releases system resources allocated to the connection, but if a
dataset is later opened that uses the database, the connection must be reestablished and initialized.
Use this wizard to create a form that displays data from a local or remote database. The wizard will connect the form to a TTable
or TQuery component, write SQL statements for TQuery components, define the form tab order, and connect TDataSource 3
components to TTable/TQuery components.
Follow the instructions on each wizard page. Click Next to continue to the next page and then click Finish to generate the form
based on the information you have provided.
745
Database RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
The left pane of the dialog displays the dataset and its tables. Select an object in the left pane to display its properties in a
read-only grid in the right pane.
Item Description
Driver Name Lists the names of all drivers that appear in the drivers.ini file. These drivers represent the possible
values of the DriverName parameter in the Connection Editor, which determines the DriverName
property of a TSQLConnection component.
Library Name Displays the dbExpress driver file for the driver named in the Driver Name column. It determines the
LibraryName property of a TSQLConnection component that is added automatically when you set the
DriverName property.
Vendor Library Displays the client-side DLL for the database server associated with the specified driver. This DLL is
supplied by the database vendor. The value of Vendor Library determines the VendorLib property of
a TSQLConnection component that is added automatically when you set the DriverName property.
Item Description
Available Indexes (Not displayed for tables on a database server.) Shows the currently selected index used to join the
tables. Unless you specify a different index name in the table’s IndexName property, the default index
used for the link is the primary index for the table. Other available indexes defined on the table can be
selected from the drop-down list.
Detail Fields Lists the details fields in the table.
Add Adds the selected detail and master fields to the Joined Fields box.
Master Fields Lists the master fields in the table.
Joined Fields Displays the selected master and detail fields.
Delete Removes the selected line from the Joined Fields box.
Clear Removes all of the lines in the Joined Fields box..
3
746
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Database
Use the Fields Editor at design time to create persistent lists of the field components used by the datasets in your application.
Persistent fields component lists are stored in your application, and do not change even if the structure of a database underlying
a dataset is changed. All fields in a dataset are either persistent or dynamic.
Context Menu
Right-click the Fields Editor to access the following commands.
Item Description
Add fields Displays the Add Fields dialog box which enables you to add persistent field components for a
dataset.
New field Displays the New Field dialog box which enables you to create new persistent fields as additions to
or replacements of the other persistent fields in a dataset. The types of new persistent fields that may
be created are data fields, calculated fields, and lookup fields.
Add all Fields Creates persistent fields for every field in the underlying dataset.
Cut Removes the selected fields from the Fields Editor and places them on the clipboard.
Paste Pastes the clipboard contents into the Fields Editor.
Delete Deletes selected fields without copying them to the clipboard.
Select All Selects all of the fields in the Fields Editor.
Item Description
Name Specify the name of the relation.
Parent table Specify the parent table in the relation.
Child table Specifies the child table in the relation. This value is determined by the table you selected to get to
this dialog. It is read-only.
Key Columns Select one or more columns to act as the primary key in the parent table.
Foreign Key Columns Select one or more columns to act as the foreign key in the child table. Typically, these must
correspond to the columns you chose as your primary key, if not in name, then by data type and
value.
Update rule Select the Update rule to use when updating records. Applies to master-detail relationships and how
detail records are updated when a master record is updated.
Delete rule Select the Delete rule to use when deleting records. Applies to master-detail relationships and how
detail records are deleted when a master record is deleted.
3
Accept/Reject rule Select the Accept/Reject rule to use when an insert occurs in a master-detail relationship.
See Also
Using Standard Datasets
747
Database RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Existing Specifies an existing dataset previously created.
New Specifies a new dataset.
Choose which table(s) Selects a table or multiple tables to populate the dataset.
to add to the dataset
Item Description
Driver Name Shows all of the drivers listed in the drivers.ini file. Select the driver the new connection will use.
Connection Name Enter a name for the new named connection. This name should be unique: that is, it should not be
the same as any other connection name listed in the dbxconnections.ini file.
Item Description
Name Enter the component’s field name.
Component Displays a name you enter in the Name field, prefixed with the component name. The product
discards anything you enter directly in the Component edit box.
Type Select the field component’s data type. You must supply a data type for any new field component you
create. For example, to display floating point currency values in a field, select Currency from the
drop-down list.
Size Specify the maximum number of characters that can be displayed or entered in a string-based field or
the size of Bytes and VarBytes fields. For all other data types, Size is meaningless.
Data Replaces an existing field (for example to change its data type) and is based on columns in the table
or a query underlying a dataset.
Calculated Displays values calculated at runtime by a dataset’s OnCalcFields event handler.
3 Lookup Retrieve values from a specified dataset at runtime based on search criteria you specify (not
supported for unidirectional datasets).
InternalCalc Retrieves values calculated at runtime by a client dataset and stored with its data (instead of being
dynamically calculated in an OnCalcFields event handler). InternalCalc is only available if you are
working with a client dataset. Values calculated for an InternalCalc field are stored and retrieved as
part of the client dataset’s data.
Aggregate Retrieves a value summarizing the data in a set of records from a client dataset.
748
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Database
Key Fields Lists the fields in the current dataset for which you can match values. To match more than one field,
enter field names directly instead of choosing from the drop-down list. Separate multiple field names
with semicolons. If you are using more than one field, you must use persistent field components.
Dataset Lists the datasets in which to look up field values. The lookup dataset must be different from the
dataset for the field component itself, or a circular reference exception is raised at runtime.
Lookup Keys Used only to create lookup fields. If you choose Lookup as the field type, the Key Fields and
Dataset edit boxes in the Lookup definition group box are enabled. The Lookup Keys and Result
Field boxes are only enabled if you are connected to a second dataset.
Result Field Lists the fields in the lookup dataset that can be returned as the value of the lookup field you are
creating.
3.2.3.25 Relation
Use this dialog box to define a relationship between tables in a dataset.
Item Description
Name Specify the name of the relation.
Parent table Specify the parent table in the relation.
Child table Specify the child table in the relation.
Key Columns Select one or more columns to act as the primary key in the parent table.
Foreign Key Columns Select one or more columns to act as the foreign key in the child table. Typically, these must
correspond to the columns you chose as your primary key, if not in name, then by data type and
value.
Update rule Select the Update rule to use when updating records. Applies to master-detail relationships and how
detail records are updated when a master record is updated.
Delete rule Select the Delete rule to use when deleting records. Applies to master-detail relationships and how
detail records are deleted when a master record is deleted.
Accept/Reject rule Select the Accept/Reject rule to use when an insert occurs in a master-detail relationship.
See Also
Using Standard Datasets
Use this dialog box to see the actual statement calls made through SQL Links to a remote server or through the ODBC socket to
an ODBC data source.
You can monitor different types of activity by choosing Options Trace Options to display the Trace Options dialog box.
749
Database RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Prepared Query Prepared statements to be sent to the server.
Statements
Executed Query Statements to be executed by the server. Note that a single statement may be prepared once and
Statements executed several times with different parameter bindings.
Input Parameters Parameter data sent to servers when doing INSERTs or UPDATEs.
Fetched Data Data retrieved from servers.
Statement Operations Each operation performed such as ALLOCATE, PREPARE, EXECUTE, and FETCH
Connect / Disconnect Operations associated with connecting and disconnecting to databases, including allocation of
connection handles, freeing connection handles, if required by server.
Transactions Transaction operations such as BEGIN, COMMIT, and ROLLBACK (ABORT).
Blob I/O Operations on Blob datatypes, including GET BLOB HANDLE, STORE BLOB, and so on.
Miscellaneous Operations not covered by other categories.
Vendor Errors Error messages returned by the server. The error message may include an error code, depending on
the server.
Vendor Calls Actual API function calls to the server. For example, ORLON for Oracle, ISC_ATTACH for InterBase.
Item Description
Buffer Size Indicates the size of the buffer to be used for trace information.
Circular Writes trace information in a circular memory buffer, so that once the limit is reached, additional
traces replace the first traces.
Page to disk Writes trace information to a disk file when the memory buffer becomes full.
Filename Indicates the name of the trace file to be used if Page to disk is selected.
Item Description
Available Fields Lists all of the fields in the database table. Select fields in this list and use the arrow buttons to move
3 them to the list of fields on which to sort.
Order by Fields Displays the fields you have selected. The SQL dataset sorts its records by the first field. Within
groups defined by the first field, they are sorted by the second field, and so on.
Arrow buttons Use the arrow buttons to move fields between the two lists.
750
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Database
Item Description
Stored Procedures Shows all the stored procedures available for the BdpConnection associated with the BdpCommand.
When you select a stored procedure from this drop-down list box, the Parameters list box displays the
parameters for that stored procedure.
Stored Procedure Has If the stored procedure returns one or more cursors, check this check box to display the resultset in
One Or More Resultset the dialog box when the stored procedure is executed.
Parameters Shows all the parameters for the currently selected stored procedure. When you select a parameter
from this list box, the associated metadata appear and can be edited in the pane on the right.
Execute Attempts to execute the selected stored procedure using the currently specified parameter settings.
The results of the stored procedure execution (Output parameters, InputOutput parameters, return
values, cursor(s) returned) are all populated into a DataGrid in the bottom of the dialog box.
Item Description
Use a dataset to By checking this option, you are presented with a list of available typed datasets, if any, which will
suggest table and provide existing table and column names. Returns only a list of names from the schema of the given
column names typed dataset. Does not apply to standard datasets.
Dataset Displays the names of datasets that you can use for a model.
Source table Displays the name of the data source table. Because a data adapter can reference more than one
table, you can select from multiple tables in the data source, if available.
Dataset table Displays the name of the dataset table. Because you can create datasets that contain multiple tables,
you might see multiple tables listed here.
Source columns Displays the names of all columns in the data source table.
Dataset columns Displays the names of columns in the dataset to write the data source table columns to. When
performing updates to the data source, these are the columns that will be read from. You can change
the names to map one column to another non-corresponding column, or you can map to
corresponding columns between the source table and the dataset.
Delete Deletes the active column names in both source and dataset column lists. Deleted columns will not
appear in the dataset. Useful if your query returns more columns from the data source than you need
to use in the dataset.
Reset Resets the list of source table column names and dataset column names to their original values.
3
Enter key You can add a row by pressing Enter while the cursor is in the last row of the dataset column. This
allows you to create new columns which might exist already but don't display at designtime, for some
reason. For example, if you have derived or computed fields that you want to keep track of, you could
add a new column to account for that data. The order of columns does not have any impact on the
data.
751
Database RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Name Specifies the name of the constraint.
Columns Check each column you want included in the constraint. If you indicate a nonunique column as
unique, you may generate a runtime errror.
Primary key Selecting this option sets the checked columns in your constraint as the primary key for the current
DataTable. If you set a combination of columns, some of which contain duplicates or null values, you
may receive a design-time error and a runtime error. However, if you receive a design-time error, the
constraint may still be defined as you indicated, even if it is incorrect.
These properties of the database component, as well as others, can also be specified using the Object Inspector.
To display the Database Editor dialog box, double click on an IBDatabase component.
Option Meaning
Local Indicates that the database is on the local server. Enables the Browse button, allowing you to search
for the database with a Open File dialog.
Remote Indicates that the database is on a remote server. Activates the Protocol and Server fields
Protocol Sets the protocol for attaching to the remote server. The protocol can be TCP/IP, Named Pipe, or
SPX.
Server The name of the remote server.
Database The name of the database.
Database Parameters
Option Meaning
User Name The name of the database user.
3
Password The password for the database user.
SQLRole The SQLRole name used to connect to the database.
Character Set The character set used to connect to the database.
Login Prompt Indicates whether a login prompt is required to access the database.
752
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Database
Settings Displays the current parameters and allows you to add other parameters.
For example:
user_name=sysdba
password=masterkey
sql_role_name=finance
lc_ctype=WIN1252
For more information on database parameters, see the InterBase API Guide.
For a complete list of all the InterBase transaction parameters, refer to 'Working with Transactions' in the InterBase API Guide.
These properties of the transaction component, as well as others, can also be specified using the Object inspector.
To display the Transaction Editor dialog box, double click on an IBTransaction component. The following four choices are
displayed:
Snapshot
By default, Snapshot is set to concurrency and no wait, which means that the transaction is aware of other transactions, and
does not wait for locks to be released, returning an error instead.
Read Committed
By default, Read Committed is set to read_committed, rec_version, and no wait, which means that the transaction reads
changes made by concurrent transactions, can read the most recently committed version of a transaction, and does not wait for
locks to be released, returning an error instead.
For a complete list of all the InterBase transaction parameters, refer to 'Working with Transactions' in the InterBase API Guide.
The TIBUpdateSQL object must be associated with a TIBQuery object by setting the TIBQuery property UpdateObject to the
3
name of the TIBUpdateSQL object used to contain the SQL statements. A datasource and database name must be selected for
the TIBQuery object. In addition, the SQL property must include an SQL statement defining a table.
753
Edit RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
The Update SQL editor has two pages, the Options page and the SQL page.
The Options page
The Options page is visible when you first invoke the editor.
Table Name Use the Table Name combo box to select the table to update. When you specify a table name, the
Key Fields and Update Fields list boxes are populated with available columns.
Key Fields The Key Fields list box is used to specify the columns to use as keys during the update. Generally the
columns you specify here should correspond to an existing index.
Update Fields The Update Fields list box indicates which columns should be updated. When you first specify a
table, all columns in the Update Fields list box are selected for inclusion. You can multi-select fields
as desired.
Get Table Fields Read the table fields for the table name entered and list the fields.
Dataset Defaults Use this button to restore the default values of the associated dataset. This will cause all fields in the
Key Fields list and the Update Fields list to be selected and the table name to be restored.
Select Primary Keys Click the Primary Key button to select key fields based on the primary index for a table.
Generate SQL After you specify a table, select key columns, and select update columns, click the Generate SQL
button to generate the preliminary SQL statements to associate with the update component's
ModifySQL, InsertSQL, DeleteSQL, and RefreshSQL properties.
Quote Identifiers Check the box labeled Quote Field Names to specify that all field names in generated SQL be
enclosed by quotation marks. This option is disabled at this time.
Note: Note: Keep in mind that generated SQL statements are intended to be starting points for creating update statements. You
may need to modify these statements to make them execute correctly. Test each of the statements directly yourself before
accepting them.
Use the Statement Type radio buttons (Modify, Insert, Delete, or Refresh) to switch among generated SQL statements and edit
them as desired.
To accept the statements and associate them with the update component's SQL properties, click OK.
3.2.4 Edit
Topics
Name Description
Alignment ( see page 756) Edit Align
3 Lines up selected components in relation to each other or to the form.
Creation Order ( see page 756) Edit Creation Order
Specifies the order in which your application creates nonvisual components when
you load the form at design time or runtime.
The list box displays only those nonvisual components on the active form, their
type, and their current creation order. The default creation order is determined by
the order in which you placed the nonvisual components on the form.
754
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Edit
755
Edit RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Select All Controls ( see page 759) Edit Select All Controls
Selects all controls in the main window.
3.2.4.1 Alignment
Edit Align
Item Description
No change Does not change the alignment of the component.
Left sides Lines up the left edges of the selected components (horizontal only).
Centers Lines up the centers of the selected components.
Right sides Lines up the right edges of the selected components (horizontal only).
Tops Lines up the top edges of the selected components (vertical only).
Bottoms Lines up the bottom edges of the selected components (vertical only).
Space equally Lines up the selected components equidistant from each other.
Center in window Lines up the selected components with the center of the window.
See Also
Adding Components to a Form ( see page 152)
Specifies the order in which your application creates nonvisual components when you load the form at design time or runtime.
The list box displays only those nonvisual components on the active form, their type, and their current creation order. The default
creation order is determined by the order in which you placed the nonvisual components on the form.
Modifies the tab order of the components on the VCL Form, or within the selected component if that component contains other
components.
For example: a Form containing an edit control with the Tab property value of 0, and a button with the Tab property of 1, the edit
control comes before the button when you cycle through the controls with the Tab key. The Tab Order dialog facilitates changing
3 the values of the Tab property using the Up and Down arrows instead of explicitly having to specify values for the Tab property
in the Object Inspector.
Click the Up arrow to move the component up in the tab order, or click the Down arrow to move it down in the tab order.
756
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Edit
3.2.4.4 Scale
Edit Scale
Proportionally resizes all the components on the current form. Scaling the form repositions the components as well as resizing
them.
Enter a percentage to which you want to resize the form’s components. The scaling factor must be between 25 and 400.
Percentages over 100 grow the form’s components. Percentages under 100 shrink the form’s components.
See Also
Adding Components to a Form ( see page 152)
3.2.4.5 Size
Edit Size
Item Description
No change Does not change the size of the components.
Shrink to smallest Resizes the group of components to the height or width of the smallest selected component.
Grow to largest Resizes the group of components to the height or width of the largest selected component.
Width Sets a custom width for the selected components.
Height Sets a custom height for the selected components.
See Also
Adding Components to a Form ( see page 152)
Aligns selected objects to the grid in the Form Designer. By default, components are aligned to a four-pixel grid used by the
Form Designer. Press ALT to override this default when positioning components.
See Also
Adding Components to a Form ( see page 152)
Brings selected objects to the visual front of an active form. For example: if you have are working on a form in the Form
Designer and you drop a TPanel over a portion of a TListbox, select Bring to Front to have the TListbox lie over the TPanel.
757
Edit RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
3.2.4.8 Copy
Edit 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.
3.2.4.9 Cut
Edit 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.
3.2.4.10 Delete
Edit Delete
Removes the selected object or group of objects. Delete works with text when using the Code Editor and with components
when using the Form Designer.
Reverses Bi-Directional (BiDi) support. This is useful when you design a form for a language where the text reads right to left,
such as Japanese or Arabic.
Item Description
All Horizontally reverses all the controls on a form.
Selected Horizontally reverses all the selected controls on a form.
3.2.4.13 Paste
Edit Paste
Pastes contents of the clipboard previously caputured using Cut or Copy. Paste works with text when using the Code Editor
758
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Error Messages
Selects all objects in the main window. Select All works with text when using the Code Editor and with components when using
the Form Designer.
Moves selected objects to the visual back of an active form. For example: if you have a few buttons on a form in the Form
Designerand you would like them to be visually in front of a TPanel component, you can first arrange the buttons, then position a
TPanel component over the buttons and select Send to Back.
3.2.4.16 Undo
Edit Undo
Reverts the previous actions. Undo works in the text editor and the Form Designer. If you delete a character in the text editor,
selecting Undo brings the character back. If you delete a component (e.g., a button) in the Form Designer, selecting Undo
brings the component back.
The undo limit is set in Tools Options Editor Options Undo Limit. The default is 32,767.
3.2.4.17 Redo
Edit Redo
Re-executes the last command that was undone using Edit Undo. This command is available from the Form Designer.
759
Error Messages RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
760
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Error Messages
Field <Field Name> should be of type <Type1> but is declared as <Type2>. The type of specified field does not match its corresponding component on the
Correct the declaration? ( see page 764) form. This error will occur if you change the field declaration in the Code editor or
load the binary form file (.DFM) into the Code editor and modify the type of a
component.
If you select No and run your application, an error will occur when the form is
loaded.
Declaration of class <ClassName> is missing or incorrect ( see page 764) Delphi is unable to locate the form's class declaration in the interface section of
the unit. This is probably because the type declaration containing the class has
been deleted, commented out, or incorrectly modified. This error will occur if
Delphi cannot locate a class declaration equivalent to the following:
Module header is missing or incorrect ( see page 764) The module header has been deleted, commented out, or otherwise incorrectly
modified. Use UNDO to reverse your changes, or correct the declaration
manually.
In order to keep your form and source code synchronized, Delphi must be able to
find a valid module header at the beginning of the source file. A valid module
header consists of the reserved word unit, program or library, followed by an
identifier (for example, Unit1, Project1), followed by a semi-colon. The file name
must match the identifier.
For example, Delphi will look for a unit named Unit1 in UNIT1.PAS, a project
named Project1 in PROJECT1.DPR,... more ( see page 764)
IMPLEMENTATION part is missing or incorrect ( see page 765) In order to keep your form and source code synchronized, Delphi must be able to
find the unit's implementation section. This reserved word has been deleted,
commented out, or misspelled.
Use UNDO to reverse your changes or correct the reserved word manually.
Insufficient memory to run ( see page 765) Delphi was unable to run your application due to insufficient memory or Windows
resources. Close other Windows applications and try again.
This error sometimes occurs because of insufficient low (conventional) memory.
For further information, see the README.TXT file.
Breakpoint is set on line that contains no code or debug information. Run A breakpoint is set on a line that does not generate code or in a module which is
anyway? ( see page 765) not part of the project. If you choose to run anyway, invalid breakpoints will be
disabled (ignored).
<IDname> is not a valid identifier ( see page 765) The identifier name is invalid. Ensure that the first character is a letter or an
underscore (_). The characters that follow must be letters, digits, or underscores,
and there cannot be any spaces in the identifier.
<Library Name>is already loaded, probably as a result of an incorrect program An error occurred while attempting to initialize Delphi's component library. One or
termination. Your system may be unstable and you should exit and restart more DLLs are already in memory, probably as a result of an incorrect program
Windows now. ( see page 765) termination in a previous Delphi or BDE session.
You should exit and then restart Windows.
Incorrect method declaration in class <ClassName> ( see page 765) In order to keep your form and source code synchronized, Delphi must be able to
find and maintain the declaration of each method in the first section of the form's
class definition. The form Designer will report an error unless the field and
method declarations in this section are equivalent to the following:
Cannot find implementation of method <MethodName> ( see page 766) The indicated method is declared in the form's class declaration but cannot be
located in the implementation section of the unit. It probably has been deleted,
commented out, renamed, or incorrectly modified.
Use UNDO to reverse your changes, or correct the procedure declaration
manually. Be sure the declaration in the class is identical to the one in the
implementation section. (This is done automatically if you use the Object
Inspector to create and rename event handlers.)
The <Method Name> method referenced by <Form Name>.<Event Name> has A form has been loaded that contains an event property mapped to a method
an incompatible parameter list. Remove the reference? ( see page 766) with an incompatible parameter list. Parameter lists are incompatible if the
number or types of parameters are not identical.
For a list of methods declared in this form which are compatible for this event
property, use the dropdown list on the Object Inspector's Events page.
This error occurs when you manually modify a method declaration that is
referenced by an event property.
Note that it is unsafe to run this program without removing the reference or
correcting the error.
The <Method Name> method referenced by <Form Name> does not exist. The indicated method is no longer present in the class declaration of the form. 3
Remove the reference? ( see page 766) This error occurs when you manually delete or rename a method in the form's
class declaration that is assigned to an event property.
If you select No and run this application, an error will occur when the form is
loaded.
No code was generated for the current line ( see page 766) You are attempting to run to the cursor position, but you have specified a line that
did not generate code, or is in a module which is not part of the project.
Specify another line and try again.
Note that the smart linker will remove procedures that are declared but not called
by the program (unless they are virtual method of an object that is linked in).
761
Error Messages RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Property and method <MethodName> are not compatible ( see page 767) You are assigning a method to an event property even though they have
incompatible parameter lists. Parameter lists are incompatible if the number of
types of parameters are not identical. For a list of compatible methods in this
form, see the dropdown list on the Object Inspector Events page.
Cannot find <FileName.PAS> or <FileName.DCU> on the current search path ( The .pas or .dcu file you just specified cannot be found on the search path.
see page 767) You can modify the search path, copy the file to a directory along the path, or
remove the file from the list of installed units.
Source has been modified. Rebuild? ( see page 767) You have made changes to one or more source or form modules while your
application is running. When possible, you should terminate your application
normally (select No, switch to your running application, and select Close on the
System Menu), and then run or compile again.
If you select Yes, your application will be terminated and then recompiled.
Symbol <BrowseSymbol> not found. ( see page 767) The browser cannot find the specified symbol. This error occurs if you enter an
invalid symbol name or if debug information is not available for the module that
contains the specified symbol.
Debug session in progress. Terminate? ( see page 767) Your application is running and will be terminated if you proceed. When possible,
you should cancel this dialog and terminate your application normally (for
example, by selecting Close on the System Menu).
Uses clause is missing or incorrect ( see page 767) In order to keep your forms and source code synchronized, Delphi must be able
to find and maintain the uses clause of each module.
In a unit, a valid uses clause must be present immediately following the interface
reserved word. In a program or library, a valid uses clause must be present
immediately following the program or library header.
This error occurs because the uses clause has been deleted, commented out, or
incorrectly modified. Use undo to reverse your changes or correct the declaration
manually.
Invalid event profile <Name> ( see page 768) The VBX control you are installing is invalid.
You can still set this breakpoint, but be aware that it might get hit so often that the application cannot run properly.
If the data breakpoint has a two-byte length, then the Address should be aligned on a two-byte boundary. Similarly, the Address
of a four-byte data breakpoint should be aligned on a four-byte boundary.
You can still set this data breakpoint, but if you do, the breakpoint will be set on an address that is on an appropriate boundary.
This can trigger the breakpoint in unintended situations.
762
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Error Messages
A standalone debugger such as the Turbo Debugger for Windows can be used to debug applications even when Windows is in
hard mode.
For more information about "Insufficient memory to run" errors, see the README.TXT file.
For a complete list of all fields and methods defined, check the form declaration at the top of the unit source file.
763
Error Messages RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Field2:FieldType;
...
This error has occurred because one or more declarations in this section have been deleted, commented out, or incorrectly
modified. Use undo to reverse your changes or correct the declaration manually.
Note that this first section of the form's class declaration is reserved for use by the form Designer. To declare your own fields and
methods, place them in a separate public, private, or protected section.
To declare your own fields and methods, place them in a separate public, private, or protected section.
This error will also occur if you load the binary form file (.DFM) into the Code editor and delete or rename one or more
components.
If you select No and run your application, an error will occur when the form is loaded.
In order to keep your form and source code synchronized, Delphi must be able to find a valid module header at the beginning of
the source file. A valid module header consists of the reserved word unit, program or library, followed by an identifier (for
example, Unit1, Project1), followed by a semi-colon. The file name must match the identifier.
For example, Delphi will look for a unit named Unit1 in UNIT1.PAS, a project named Project1 in PROJECT1.DPR, and a library
(.DLL) named MyDLL in MYDLL.DPR.
764
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Error Messages
Use UNDO to reverse your changes or correct the reserved word manually.
This error sometimes occurs because of insufficient low (conventional) memory. For further information, see the README.TXT
file.
3
3.2.5.20 Incorrect method declaration in class <ClassName>
In order to keep your form and source code synchronized, Delphi must be able to find and maintain the declaration of each
method in the first section of the form's class definition. The form Designer will report an error unless the field and method
declarations in this section are equivalent to the following:
type
...
765
Error Messages RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
TForm1 = class(TForm)
Field1:FieldType;
Field2:FieldType;
...
<Method1 Declaration>;
<Method2 Declaration>;
...
...
This error has occurred because one or more method declarations in this section have been deleted, commented out, or
incorrectly modified. Use undo to reserve your changes or correct the declaration manually.
Note that this first section of the form's class declaration is reserved for use by the form Designer. To declare your own fields and
methods, place them in a separate public, private, or protected section.
Use UNDO to reverse your changes, or correct the procedure declaration manually. Be sure the declaration in the class is
identical to the one in the implementation section. (This is done automatically if you use the Object Inspector to create and
rename event handlers.)
For a list of methods declared in this form which are compatible for this event property, use the dropdown list on the Object
Inspector's Events page.
This error occurs when you manually modify a method declaration that is referenced by an event property.
Note that it is unsafe to run this program without removing the reference or correcting the error.
766
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Error Messages
Note that the smart linker will remove procedures that are declared but not called by the program (unless they are virtual method
of an object that is linked in).
You can modify the search path, copy the file to a directory along the path, or remove the file from the list of installed units.
If you select Yes, your application will be terminated and then recompiled.
In a unit, a valid uses clause must be present immediately following the interface reserved word. In a program or library, a valid
uses clause must be present immediately following the program or library header.
This error occurs because the uses clause has been deleted, commented out, or incorrectly modified. Use undo to reverse your
changes or correct the declaration manually.
767
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
3.2.6 File
Topics
Name Description
Active Form Wizard ( see page 771) File New Other... Active Form
Use the Active Form wizard to add an Active Form to an ActiveX Library project.
The wizard creates an ActiveX Library project (if needed), a type library, a form,
an implementation unit, and a unit containing corresponding type library
declarations.
Active Server Object wizard ( see page 772) File New Other Active Server Object
Use the Active Server Object wizard to create a simple active server object.
Before you create an Active Server Object, create or open the project for an
application containing functionality that you want to implement. The project can
be either an application or ActiveX library, depending on your needs.
In the dialog, specify the properties of your Active Server Object, which is a
special Automation object created by and called from the script running in an
Active Server Page.
Add ( see page 773) Use this dialog box to add a package to the Requires clause in the current
package.
Automation Object Wizard ( see page 773) File New Other...
Use the New Automation Object wizard to add an Automation server to an
ActiveX Library project. The wizard creates a type library, and the definition for
the Automation object.
Browse With Dialog box ( see page 774) Use this dialog box to maintain a list of external browsers and specify which
browser to use by default.
Browse With Dialog box ( see page 775) Use this dialog box to specify the properties for the selected external browser.
COM Object Wizard ( see page 775) File New Other...
Use the New COM Object wizard to create a simple COM object such as a shell
extension. Before you create a COM object, create or open the project for an
application containing functionality that you want to implement. The project can
be either an application or ActiveX library, depending on your needs.
COM+ Event Interface Selection dialog box ( see page 776) On the COM+ Subscription Object wizard, use the Browse button to display the
COM+ Event Interface Selection dialog box. It lists all event classes currently
installed in the COM+ Catalog. The dialog also contains a Browse button that you
can use to search for and select a type library containing the event interface.
COM+ Event Object Wizard ( see page 776) File New Other...
The COM+ Event Object wizard creates a COM+ event object that can be called
by a transactional server to generate events on clients. Because the project for a
COM+ object can only contain other COM+ objects, you may be prompted to
start a new project when you launch this wizard.
COM+ Subscription Object Wizard ( see page 776) File New Other COM+ Subscription Object
You can create the COM+ event subscriber component using the COM+
Subscription Object wizard. You use this with a COM+ Event Object to receive
notification of events fired by COM+ publisher applications.
Customize New Menu ( see page 777)
3 File New Customize
Use this dialog box to customize the content of the File New menu by
dragging menu items from the center pane and dropping them on the right pane.
Change Destination File Name ( see page 777) Use this dialog box to rename the selected file when it is copied to the
destination directory. The rename will not occur until you copy the file to the
destination directory. The source file will not be renamed.
If the file already exists in the destination directory with its original name, that file
will remain in the destination directory until you delete it.
FTP Connection Options ( see page 778) Use this dialog box to specify FTP server connection information for the
Deployment Manager.
768
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Interface Selection Wizard ( see page 778) File New Other... New COM Object
The Interface Selection wizard is accessed by clicking the List button on the
New COM Object wizard. The Interface Selection wizard lets you select a
predefined dual or custom interface that you want to implement with a COM
object you are creating. The selected interface becomes the default interface of
the newly created COM object. The COM object wizard adds skeletal method
implementations for all the methods on this interface to the generated
implementation unit. You can then fill in the bodies of these methods to provide
an implementation of the interface.
Warning: The... more ( see page 778)
New ASP.NET Application ( see page 779) File New Other ASP NET Application
Use this dialog box to set options for new Web Forms applications.
New ASP.NET Content Page ( see page 779) File New Other Delphi for .NET Projects ASP NET Content Page
Use this dialog box to create a new Content Page for an ASP.NET application.
New ASP.NET Generic Handler ( see page 779) File New Other Delphi for .NET Projects Generic Handler
Use this dialog box to create a new HTTP Generic Handler for an ASP.NET
application.
New ASP.NET Master Page ( see page 780) File New Other Delphi for .NET Projects ASP NET Master Page
Use this dialog box to create a new Master Page for an ASP.NET application.
New ASP.NET Master Page ( see page 780) File New Other Delphi for .NET Projects ASP NET Page
Use this dialog box to create a new Page for an ASP.NET application.
New ASP.NET User Control ( see page 780) File New Other Delphi for .NET Projects ASP NET User Control
Use this dialog box to create a new User Control for an ASP.NET application.
New ASP.NET Web Service ( see page 780) File New Other Delphi for .NET Projects ASP NET Web Service
Use this dialog box to create a new Web Service for an ASP.NET application.
New Console Application ( see page 780) File New Other
Use this dialog box to create an application that runs in a console window.
New DBWeb Control Wizard ( see page 781) File New Other Delphi ASP Projects DBWeb Control Library
Use this dialog box to create a data aware WebControl. This DB Web Control
can suppplement the DB Web Controls provided on the Tool Palette.
New Dynamic-link Library ( see page 781) File New Other
Use this dialog box to create a DLL project. A dynamic-link-library is a module of
compiled code that provides functionality for applications.
New Items ( see page 781) File New Other
Use this dialog box to create a new project or other entity. The New Items dialog
box displays project templates that are stored in the RAD Studio Object
Repository.
New Application ( see page 782) File New
Use this dialog box to specify a name and location for the new application.
New Remote Data Module Object ( see page 782) File New Other
Use this dialog box to create a data module that can be accessed remotely as a
dual-interface Automation server.
New Thread Object ( see page 783) File New Other Delphi Projects Delphi Files Thread Object
Use this dialog box to define a thread class that encapsulates a single execution
thread in a multi-threaded application.
Open ( see page 784) File Open
Use this dialog box to locate and open a file. The title of this dialog box varies,
depending on the function being performed.
Package ( see page 784) File New Other Delphi for .NET Projects Package
Use this dialog box to create a package.
Print Selection ( see page 785) File Print
Use this dialog box to print the current file.
Project Upgrade ( see page 785) File Open
Use this dialog box to upgrade an older Delphi project that has no corresponding
3
.bdsproj project file. When you upgrade the project, the .bdsproj file and
other files and directories used by RAD Studio will be created in the project's
directory.
769
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
770
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Add New WebService ( see page 793) File New Other Delphi Projects WebServices SOAP Server
Interface
Use this dialog box to generate a new unit that declares a invokable interface
and its implementation class. The interface descends from IInvokable, and the
implementation class from TInvokableClass. It also generates the code to
register the interface and implementation class with the invocation registry. After
exiting the wizard, edit the generated interface and class definitions, adding in
the properties and methods you want to expose as your Web Service.
Application Module Page Options/New WebSnap Page Module ( see page 794) Use this dialog box to define the basic properties of a page module. The dialog
title varies based on how you accessed the dialog.
New WebSnap Application ( see page 795) File New Other Delphi Projects WebSnap WebSnap Application
Use this dialog box to configure a new WebSnap application.
New WebSnap Data Module ( see page 796) Use this dialog box to specify how the server handles the creation and
destruction of your data module.
Web App Components ( see page 796) Use this dialog box to select component categories and to select specific
components in each of the following categories (some categories offer only one
choice).
XML Data Binding Wizard Options ( see page 797) File New Other Delphi Project New XML Data Binding Options
button
Use this dialog box to determine how the XML Data Binding Wizard generates
interfaces and implementation classes to represent an XML document or
schema.
XML Data Binding Wizard, page 1 ( see page 797) File New Other Delphi Project New XML Data Binding
Use this wizard to generate interface and class definitions that correspond to the
structure of an XML document or schema. The wizard generates a global
function that returns the interface for the root element of the document.
After you use the wizard to create these definitions, you can use the classes and
interfaces to work with XML documents that have the structure of the specified
document or schema.
XML Data Binding Wizard, page 2 ( see page 798) File New Other Delphi Project New XML Data Binding
Use this wizard page to specify what code the wizard generates.
XML Data Binding Wizard, page 3 ( see page 799) File New Other Delphi Project New XML Data Binding
Use this wizard page to confirm the choices you have made, specify unit-wide
code generation options, indicate where you want your choices saved, and tell
the wizard to generate code to represent the XML document or schema.
Close ( see page 799) File Close
File Close All
Closes the current open project or all the open projects.
Exit ( see page 799) File Exit
Closes the IDE and all open projects and files.
New ( see page 800) File New
Creates a project of the selected type.
Use the Active Form wizard to add an Active Form to an ActiveX Library project. The wizard creates an ActiveX Library project (if
needed), a type library, a form, an implementation unit, and a unit containing corresponding type library declarations.
Item Description
VCL Class Name When creating Active forms, this control is disabled because active forms are always based on
TActiveForm. 3
New ActiveX Name The wizard provides a default name that clients will use to identify your Active form. Change this
name to provide a different OLE class name.
Implementation Unit The wizard a default name for the unit that contains.CPP and .H files that contain the code that
implements the behavior of the Active form. You can accept the default name or type in a new name.
771
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Project Name Active forms must be added to an ActiveX library project. If you currently don't have an ActiveX
Library project open, a fourth field allows you to specify which ActiveX Library project to add the
ActiveForm control. A default Project Name is provided. This control is disabled if you have an
ActiveX Library open..
Threading Model Choose the threading model to indicate how COM serializes calls to your ActiveX form. Note: The
threading model you choose determines how the object is registered. You must make sure that your
object implementation adheres to the model selected.
Include Version This option includes version information in the .OCX file. Adding this resource to your control allows
Information your control to expose information about the module, such as copyright and file description, which
can be viewed in the browser. Version information can be specified by choosing Project Options
and selecting the Version Info page.
Include About Box When this box is checked, an About box is included in the project. The About box is a separate form
that you can modify. By default, the About box includes the name of the Active Form, an image,
copyright information, and an OK button.
Use the Active Server Object wizard to create a simple active server object. Before you create an Active Server Object, create or
open the project for an application containing functionality that you want to implement. The project can be either an application or
ActiveX library, depending on your needs.
In the dialog, specify the properties of your Active Server Object, which is a special Automation object created by and called from
the script running in an Active Server Page.
Item Description
CoClass Name Specify the name for the object that you want to implement. This is the CoClass name that appears in
the type library. The generated implementation class has the same name with a ‘T’ prepended.
Instancing Specify an instancing mode to indicate how your Active server is launched. (This value is ignored for
in-process servers.)
Instancing Meaning
Internal The object can only be created internally. An external application cannot create an instance of the
object directly.
Single Instance Allows only a single COM interface for each executable (application), so creating multiple instances
results in launching multiple instances of the application.
Multiple Instance Specifies that multiple clients can connect to the application. Any time a client requests the object, a
separate instance is created within a single process space. (That is, there can be multiple instances
in a single executable.)
Threading Model Choose the threading model to indicate how COM serializes calls to your active server object’s
3 interface. The threading model you choose determines how the object is registered. You must make
sure that your object implementation adheres to the model selected.
Active server objects can use the following threading models:
Model Description
Single Only one client thread can be serviced at a time. COM serializes all incoming calls to enforce this.
Your code needs no thread support.
772
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Apartment Each object instantiated by a client is accessed by one thread at a time. You must protect against
multiple threads accessing global memory, but objects can safely access their own instance data
(object properties and members).
Free Each object instance may be called by multiple threads simultaneously. You must protect instance
data as well as global memory.
Both This is the same as the Free-threaded model, except that all callbacks supplied by clients are
guaranteed to execute in the same thread. This means you do not need protect values supplied as
parameters to callback functions.
Neutral Multiple clients can call the object on different threads at the same time, but COM ensures that no
two calls conflict. You must guard against thread conflicts involving global data and any instance data
that is accessed by more than one method. This model should not be used with objects that have a
user interface. This model is only available under COM+. Under COM, it is mapped to the Apartment
model.
Page-level event Creates an active server object that implements OnStartPage and OnEndPage. These methods are
methods (OnStartPage/ called by the web server on initialization and finalization of the page. This style of active server
OnEndPage) objects is available for use with IIS 3 and IIS 4. Active server objects used by IIS 5 should be created
using the Object Context option.
Object Context Creates an active server object that uses MTS or COM+ to retrieve the correct instance data of your
object. Recommended for use with IIS 5 (may also work with IIS 4 and MTS).
Generate a template Optionally provide a pop-up link to a topic for the first of an unfamiliar term in a Help topic.
test script for this object
Item G Generates a simple .ASP page that creates the Active Server Object based on its ProgID. You can
then edit this Active Server page to call the methods of your object.
3.2.6.3 Add
Use this dialog box to add a package to the Requires clause in the current package.
Item Description
Package name Enter the name of the package to add. If the package is in the Search Path, a full path name is not
required. (If the package directory is not in the Search Path, it will be added to the end.)
Search Path If you haven't included a full directory path in the Package Name edit box (see above), make sure
the directory where your package resides is in this list. If you add a directory in the Search Path edit
box, you will be changing the global Library Search Path.
When a Delphi package is required by another package, the product must find the package's .dcpil
file in order to compile.
Use the New Automation Object wizard to add an Automation server to an ActiveX Library project. The wizard creates a type
library, and the definition for the Automation object.
Item Description
CoClass Name Specify the class whose properties and methods you want to expose to client applications. (Delphi
prepends a T to this name.)
773
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Instancing Specify an instancing mode to indicate how your Automation server is launched.
Threading Model Choose the threading model to indicate how COM serializes calls to your Automation object’s
interface. The threading model you choose determines how the object is registered. You must make
sure that your object implementation adheres to the model selected.
Generate Event Check this box to tell the wizard to implement a separate interface for managing events on your
support code Automation object. The separate interface has the name ICoClassNameEvents, and defines the
event handlers that must be implemented by the client. Your application does not implement this
interface.
The Instancing dropdown list can have any of the following instancing types:
Instancing Meaning
Internal The object can only be created internally. An external application cannot create an instance of the
object directly.
Single Instance Allows only a single COM interface for each executable (application), so creating multiple instances
results in launching multiple instances of the application.
Multiple Instance Specifies that multiple clients can connect to the application. Any time a client requests the object, a
separate instance is created within a single process space. (That is, there can be multiple instances
in a single executable.)
Note: Under COM+, the serialization of calls to your object is also influenced by how it participates in activities. This can be
configured using the COM+ page of the type library editor or the COM+ Component Manager.
The Threading Model dropdown list can have any of the following values:
Note: Under COM+, the serialization of calls to your object is also influenced by how it participates in activities. This can be
configured using the COM+ page of the type library editor or the COM+ Component Manager.
Item Description
Browser List Displays the list of available browsers.
Add, Delete, Edit Enable you to add or delete browsers, and edit information selected browsers in the list.
774
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Set as Default Specifies which external browser to use by default for viewing web pages and web services.
Item Description
Program Displays path and name of the executable for the browser.
Title Specifies the name of the browser as you want it to appear in the Browser List in the Browse With
dialog box.
Use the New COM Object wizard to create a simple COM object such as a shell extension. Before you create a COM object,
create or open the project for an application containing functionality that you want to implement. The project can be either an
application or ActiveX library, depending on your needs.
Item Description
CoClass Name Specify the class whose properties and methods you want to expose to client applications. This is the
name of the CoClass. The implementation class has the same name with a T prepended.
Instancing Specify an instancing mode to indicate how your COM object is launched. When your COM object is
used only as an in-process server, instancing is ignored.
Threading Model Choose the threading model to indicate how client applications can call your COM object’s interface.
The threading model you choose determines how the object is registered. You must make sure that
your object implementation adheres to the model selected.
Implemented Interface Indicates the name of the COM object’s default interface. By default, the COM object’s interface is the
same as the CoClass name, with an ‘I’ prepended. When you accept the default interface, your object
gets a new interface that descends from IUnknown, which you can then define using the Type Library
editor. You can change the default name of the interface by typing a name into the edit box.
Instead of implementing a new interface, you can choose to have your object implement any dual or
custom interface that is in a type library registered on your system. To choose the interface to
implement, click the List button, which displays the Interface Selection wizard. Note that this wizard
takes a bit of time to load because it must locate all interfaces that are defined in type libraries
registered on your system. Note that you must use the Interface Selection wizard to implement an
existing interface. If you type in the name of an existing interface, the wizard does not recognize this
as an existing interface and assumes you are simply providing the object with a different interface
name.
Description Enter a description of the COM object you are creating.
Include Type Library Check this box to generate a type library for this object. A type library contains type information that
3
allows you to expose any object interface and its methods and properties to client applications.
Mark interface Check this box to allow type library marshaling. This flag lets you avoid writing your own proxy-stub
OleAutomation DLL for custom marshaling.
When marking an interface as OleAutomation, you must ensure that it uses OLE Automation
compatible types.
775
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
The COM+ Event Object wizard creates a COM+ event object that can be called by a transactional server to generate events on
clients. Because the project for a COM+ object can only contain other COM+ objects, you may be prompted to start a new
project when you launch this wizard.
Item Description
CoClassName This is the name of your COM+ event object. Server objects that generate COM+ events create an
instance of this object and call its events, which COM+ dispatches so that they fire on registered
clients.
Interface This is the name of the interface that defines the event handlers for all events managed by the COM+
event object. It is implemented by client event sinks, which means the wizard does not generate an
implementation unit.
Description Optionally, enter a brief description of your event objects so that clients can easily understand the
purpose of the events.
When the COM+ Event Object wizard exits, you can define the methods of the generated interface using the Type Library
editor. When defining this interface, the following rules must be followed:
• All method names must be unique across all interfaces of the event object.
• All methods must return an HRESULT value.
• The modifier for all method parameters must be blank.
You can create the COM+ event subscriber component using the COM+ Subscription Object wizard. You use this with a COM+
Event Object to receive notification of events fired by COM+ publisher applications.
Item Description
Class Name Enter the name of the class that will implement the event interface.
3 Threading Model Choose the threading model. The threading model of a component determines how the methods of
the component are assigned to threads to be executed.
Interface In the Interface field, you can type the name of the event interface, or use the Browse button to bring
up a list of all event classes currently installed in the COM+ Catalog. The COM+ Event Interface
Selection dialog, which is displayed, also contains a Browse button that can be used to search for
and select a type library containing the event interface.
776
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Implement Existing When you select an interface, the wizard gives you the option of automatically implementing the
Interface interface supported by that event class. If you check the Implement Existing Interface checkbox, the
wizard will automatically stub out each method in the interface for you.
Implement Ancestor When you select an interface, the wizard gives you the option of automatically implementing the
Interfaces ancestor interfaces of that event class. You can elect to have the wizard implement inherited
interfaces by checking the Implement Ancestor Interfaces checkbox. Three ancestor interfaces are
never implemented by the wizard: IUnknown, IDispatch, and IAppServer.
Description Enter a brief description of your event subscriber component.
Use this dialog box to customize the content of the File New menu by dragging menu items from the center pane and dropping
them on the right pane.
Item Description
Gallery Items (left Displays the folders of gallery items that are available in the Object Repository. Click a folder to
pane) display its content in the center pane.
Menu Items (right Displays the items that are currently listed on the File New menu.
pane) To remove an item from the File New menu, drag it away from the list until its icon displays an X,
and release the mouse button. To change the text for a menu item, double-click the text and enter
new text. To add a separator bar between menu items, drag the Separator item from the center pane
to the menu list.
Drag an item here If you want to set a default application type, drag the item that represents the application type from
the center pane and drop it on this button. To remove the default application, click the button.
If the file already exists in the destination directory with its original name, that file will remain in the destination directory until you
delete it.
Item Description
Source Filename Indicates the name of the file in the source directory.
Subdirectory Indicates the name of the subdirectory in which the source file resides.
Destination Filename Enter the new name for the destination file.
3
See Also
Deploying ASP.NET Applications
777
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Server Specifies the internet host name or IP address for the FTP server. It will be prefixed with FTP://.
Port Indicates the port to use on the FTP server for the connection. The default port is 21.
Passive Mode Causes the connection to be established by your computer, rather than the FTP server. Check
Passive Mode if your computer is protected by a firewall that would block a connection initiated by
the FTP server.
Directory Specifies the directory on the FTP server to which you want to copy files.
Anonymous Login Logs into the FTP server with a user name of anonymous and a password of your email address,
rather than using an actual account on the server. (The FTP server must be configured to accept
anonymous logins.)
Email If you checked Anonymous Login, specify your email address, for example,
[email protected].
Username Specifies the user name for the connection when not using an anonymous login.
Password Specifies the password for the connection when not using an anonymous login.
Save Password (Clear Stores the password in the Deployment Manager file (.bdsdeploy)as plain, unencrypted text in
Text) the project directory and may compromise security.
Test Tests the connection to the FTP server and provides feedback.
See Also
Deploying ASP.NET Applications
The Interface Selection wizard is accessed by clicking the List button on the New COM Object wizard. The Interface
Selection wizard lets you select a predefined dual or custom interface that you want to implement with a COM object you are
creating. The selected interface becomes the default interface of the newly created COM object. The COM object wizard adds
skeletal method implementations for all the methods on this interface to the generated implementation unit. You can then fill in
the bodies of these methods to provide an implementation of the interface.
wizard does not add the interface to your project’s type library. This means that when you deploy your object, you must also
3 deploy the type library that defines your object’s interface.
Item Description
Interface list The wizard lists all the interfaces defined in registered type libraries. You can select any dual or
custom interface from this list. Each interface is prefixed with the name of the file that contains its
type library. This can be an executable (.exe), a library (.dll or .ocx), or a type library file (.tlb).
778
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Add Library If the desired interface is in a type library that is not currently registered, click the Add Library button,
navigate to the type library that contains the interface you want, and click OK. This registers the
selected type library and refreshes the interface list in the Interface Selection wizard.
Use this dialog box to set options for new Web Forms applications.
Item Description
Name Specify the name of your ASP.NET application.
Location Enter the root directory for your application.
Server Indicate the default Web Server for new Web application.
View Server Options Show/Hide server options such as access priviledges.
Alias Specify the name used to gain access to the virtual directory.
Permissions Specify access permissions for your application. These options are specific to Microsoft IIS server. To
select options for the Cassini Web Server, use the drop-down list.
Read: View directory of file content and properties.
Run scripts (such as ASP): Allows the Web Server to execute scripts.
Execute (such as ISAPI applications or CGI): Allows application execution for ISAPI or CGI type
applications.
Write: Allows you to upload files to the directory.
Browse: Allows you to access list of files and directories.
Use this dialog box to create a new Content Page for an ASP.NET application.
Item Description
Name Specifies the name of the ASP.NET Content Page.
Master Page File Specifies the Master Page referenced by the Content page.
Use this dialog box to create a new HTTP Generic Handler for an ASP.NET application.
Item Description
Name Specifies the name of the Generic Handler.
779
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this dialog box to create a new Master Page for an ASP.NET application.
Item Description
Name Specifies the name of the ASP.NET Content Page.
Use this dialog box to create a new Page for an ASP.NET application.
Item Description
Name Specifies the name of the ASP.NET Page.
Use this dialog box to create a new User Control for an ASP.NET application.
Item Description
Name Specifies the name of the ASP.NET User Control.
Use this dialog box to create a new Web Service for an ASP.NET application.
Item Description
Name Specifies the name of the ASP.NET Web Service.
Use this dialog box to create an application that runs in a console window.
Item Description
Source Type Specifies the language to use for the main module of the application.
780
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Use VCL Creates an application that can contain VCL components. This option is available only if you choose
C++ as your Source Type. Checking this option causes the IDE to include vcl.h and to change the
startup code and linker options for compatibility with VCL objects.
Multi Threaded Specifies more than one thread of execution. This option is required if you check Use VCL.
Console Application Creates a console window for your application.
Specify project source Allows you to specify an existing source file for the console application. To specify a source file,
check this option and click [...] to locate a file.
Use this dialog box to create a data aware WebControl. This DB Web Control can suppplement the DB Web Controls provided
on the Tool Palette.
Item Description
Control Name The unit name to assign to the DB Web Control you are generating.
Bind to DataTable Check this option to generate a DB Web Control that implements the IDBWebDataLink interface,
which provides access to the DBDataSource and TableName properties for all controls.
Bind to DataColumn Check this option to generate a DB Web Control that implements the IDBWebColumnLink interface,
which provides access to the ColumnName property for controls that retrieve data from a specific
column.
Support Lookup Check this option to generate a DB Web Control that implements the IDBWebLookupColumnLink
interface, which provides access to the LookupTableName, DataTextField, and DataValueField
properties for lookup controls. This check box is only enabled when Bind to DataColumn is selected.
Use this dialog box to create a DLL project. A dynamic-link-library is a module of compiled code that provides functionality for
applications.
Item Description
Source Type Specifies the language to use for the main module of the DLL.
Use VCL Creates a DLL that can contain VCL components. This option is available only if you choose C++ as
your Source Type. Checking this option causes the IDE to include vcl.h and to change the startup
code and linker options for compatibility with VCL objects.
Multi Threaded Specifies more than one thread of execution. This option is required if you check Use VCL.
3
VC++ Style DLL Sets the DLL entry point to DLLMain. Leave this option unchecked to use DLLEntryPoint as the
entry point.
781
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this dialog box to create a new project or other entity. The New Items dialog box displays project templates that are stored
in the RAD Studio Object Repository.
Item Description
Item Categories Click a folder displayed in the Item Categories pane to display the types of entities that you can
create.
Tip: Right-click the right pane to display a context menu for controlling the appearance of this dialog box.
See Also
New ASP.NET Application ( see page 779)
Use this dialog box to specify a name and location for the new application.
Item Description
Name Enter the name for the application or accept the suggested application name.
Location Enter a directory path or use the browse button to navigate to a directory. The default path for the
application is displayed.
3
3.2.6.27 New Remote Data Module Object
File New Other
Use this dialog box to create a data module that can be accessed remotely as a dual-interface Automation server.
782
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Item Description
CoClass Name Specifies the base name for the Automation interface and the remote data module. The class name
for the remote data module will be the CoClass Name prepended with a T. The implementation class
will inherit from an interface named using the CoClass Name prepended with an I.
To enable a client application to access this interface, set the ServerName property of the client
application's connection component to the CoClass Name.
Threading Model Specifies how client calls are passed to the interface of the remote data module.
Model Description
Single The data module services one client request at a time. Because client requests are serialized by
COM, you do not need to address thread conflicts.
Apartment Each instance of the remote data module services one request at a time. The DLL might handle
multple requests on separate threads if it creates multiple COM objects. Instance data is safe, but
you must ensure that global memory is guarded against thread conflicts.
This threading model is recommended if you use BDE-enabled datasets.
Free The remote data module can receive simultaneous client requests on multiple threads. You must
ensure that instance data and global memory are guarded against thread conflicts.
This threading model is recommended if you use ADO datasets.
Both This threading model is equivalent to the Free threading model, except all callbacks to client
interfaces are serialized.
Neutral Multiple clients can call the remote data module on different threads at the same time, but COM
ensures that no two calls conflict. You must guard against thread conflicts involving global data and
any instance data that is accessed by multiple interface methods.
This threading model is only available under COM+. Otherwise, it is mapped to the Apartment
threading model.
Description Specifies the text that appears in the registry next to the ProgID for the application server interface.
The Description text also acts as a help string for the interface in the type library.
Generate Event Implements a separate interface for managing events.
support code
See Also
Managing Events in Your Automation Object
Use this dialog box to define a thread class that encapsulates a single execution thread in a multi-threaded application.
Item Description
3
Class Name Type the full class name that you want to define. This dialog box does not prepend a T to the
supplied class name; type the full class name, such as TMyThread, rather than typing MyThread.
Named Thread If you want to name the thread, check Named Thread and then type a name in the Thread Name
field.
Naming the thread class adds a method to your thread class called SetName. When the thread starts
running, it calls the SetName method first.
Naming the thread class can make it easier to identify threads in the debugger Thread Status
window.
783
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Tip: Clicking OK
creates a new unit that defines a thread class with the name(s) supplied in the dialog. You must then supply the code that
executes when the thread is run by writing the Execute method in the new unit.
3.2.6.29 Open
File Open
Use this dialog box to locate and open a file. The title of this dialog box varies, depending on the function being performed.
Item Description
Look in Lists the current directory. Use the drop-down list to select a different drive or directory.
Go To Last Folder Moves to the last directory that you were in.
Visited
Up one directory Moves up one directory level from the current directory.
Create New Folder Creates a new subdirectory in the current directory.
View Menu Displays a list of files and directories along with time stamp, size, and attribute information in one of
five different ways: large icons, small icons, a vertical list, details (including time stamp, size, and
attribute information), and thumbnails (a miniature version of a graphical image of a file).
Files Displays the files in the current directory that match the wildcards in File name or the file type in Files
Of Type. You can display a list of files (default) or you can show details for each file.
File name Displays the name of the file you want to load. You can type wildcards to use as filters in the Files list
box, or click the drop-down arrow to select a previously opened file.
Files of type Displays the type of file you want to open. All files in the current directory of the selected type appear
in the Files list box.
Open Opens the selected file.
Tip: Press F1
3.2.6.30 Package
File New Other Delphi for .NET Projects Package
Item Description
3
Compile Compiles the current package. If changes to the package are required, a dialog box appears that lists
the changes that will be made to the package before it is compiled.
Add Adds an item to the package.
Remove Removes the selected item from the package.
Options Displays the Project Options dialog box.
784
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Install Installs the current package as a design time package. If changes to the package are required, a
dialog box appears that lists the changes that will be made to the package before it is compiled.
Contains Displays the units included in the package. To add a unit to the package, click the Add button. To edit
a unit's source code, double-click it.
Requires Displays the other packages required by the current package. To add a package, click Add. To
display a package in its own package editor, double-click it.
Tip: Right-click the package editor for a context menu with additional commands.
Item Description
Print selected block Prints only the selected block of text in the current file.
Header/page number Prints the file path and name as a heading on each page and numbers each page.
Line numbers Prints line numbers on the printed pages.
Syntax print Prints any syntax highlighting, such as bold keywords.
Use color Prints syntax highlighting in color when printing to a color printer.
Wrap lines Causes lines that exceed the width of the printed page to continue to the next line.
Left margin Sets the left margin for the printed pages.
Setup Opens the Print Setup dialog box.
Use this dialog box to upgrade an older Delphi project that has no corresponding .bdsproj project file. When you upgrade the
project, the .bdsproj file and other files and directories used by RAD Studio will be created in the project's directory.
This dialog box appears when a project from a previous version is automatically updated for RAD Studio. The following changes
are made to the project: 3
• The encoding of project data is updated.
• References to .libs, .bpis, and .csms are updated as needed.
Note: For compatibility issues, see the release notes.
785
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use the Remote Data Module wizard to create a data module that can be accessed remotely as a dual-interface Automation
server. A remote data module resides in the application server between a client and server in a multi-tiered database
environment.
Item Description
CoClass Name Enter the base name for the Automation interface of your remote data module. The class name for
your remote data module (a descendant of TRemoteDataModule) will be this name with a T
prepended. It will implement an interface named using this base name with an I prepended. To
enable a client application to access this interface, set the ServerName property of the client
application’s connection component to the base name you specify here.
Instancing Use the instancing combo box to indicate how your remote data module application is launched. The
following table lists the possible values:
Value Meaning
Internal The remote data module is created in an in-process server. Choose this option when creating a
remote data module as part of an active library (DLL).
Single Instance Only a single instance of the remote data module is created for each executable. Each client
connection launches its own instance of the executable. The remote data module instance is
therefore dedicated to a single client.
Multiple Instance A single instance of the application (process) instantiates all remote data modules created for clients.
Each remote data module is dedicated to a single client connection, but they all share the same
process space.
Threading Model Use the threading combo box to indicate how client calls are passed to your remote data module’s
interface. The following table lists the possible values:
Value Meaning
Single The data module only receives one client request at a time. Because all client requests are serialized
by COM, you don’t need to deal with threading issues.
Apartment Each instance of your remote data module services one request at a time. However, the DLL may
handle multiple requests on separate threads if it creates multiple COM objects. Instance data is safe,
but you must guard against thread conflicts on global memory. This is the recommended model when
using BDE-enabled datasets. (Note that when using BDE-enabled datasets you must add a session
component with AutoSessionName set to Ttrue.)
Free Your remote data module instances can receive simultaneous client requests on several threads. You
must protect instance data as well as global memory against thread conflicts. This is the
recommended model when using ADO datasets.
Both The same as Free except that all callbacks to client interfaces are serialized.
Neutral Multiple clients can call the remote data module on different threads at the same time, but COM
3 ensures that no two calls conflict. You must guard against thread conflicts involving global data and
any instance data that is accessed by multiple interface methods. This model is only available under
COM+. Otherwise, it is mapped to the Apartment model.
Description Enter the text that appears in the registry next to the ProgID for the application server interface. This
text also acts as a help string for the interface in the type library.
786
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Generate Event Check this box to tell the wizard to implement a separate interface for managing events.
Support Code
Use this wizard to add one or more satellite assemblies to a project. Follow the instructions on each wizard page.
See Also
Using Translation Tools ( see page 18)
Item Description
Yes Reverts the file or project to the previous saved version and abandons any changes you have made
in the editor buffer.
Note that reverting to the previous version does not automatically change the version in your
repository. You still need to check the reverted version into your source repository.
No Retains the contents of the editor buffer and cancels the revert operation.
Use this dialog box to define a new invokable interface and its implementation class. The dialog generates a new unit that
declares an invokable interface and the implementation class. The interface descends from IInvokable, and the implementation
class from TInvokableClass. It also generates the code to register the interface and implementation class with the invocation
registry. After exiting the wizard, edit the generated interface and class definitions, adding in the properties and methods you
want to expose as your Web Service.
Item Description
Service name Enter the name of the invokable interface (port type) that your Web Service application exposes to
clients. This name is used as the name of the interface. It is also used to generate the name of the
implementation class. Thus, for example, if you enter MyWebService, the wizard generates the
definition of an invokable interface named MyWebService, and an implementation class named 3
TMyWebServiceImpl.
Unit identifier Enter the name of the unit that the wizard should create to contain the interface and implementation
class definitions.
Generate comments Optional. Adds comments to the unit generated by the wizard, indicating what the code does.
Generate sample Optional. Adds sample code, as comments, to the unit generated by the wizard. You can then use the
methods sample code as a guideline for defining and implementing the invokable interface and implementation
class.
787
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Service activation Select the activation model you want from the drop-down list:
model Per Request creates a new instance of your implementation class in response to each request it
receives. That instance is freed after the request is handled.
Global Object creates a single instance of your implementation class, which is used to handle all
requests.
Use this dialog box to add a SOAP data module to a Web Service application. A SOAP data module allows a Web Service
application to export database information as a Web Service. Client datasets on the client application can display and update this
database information.
Item Description
Module Name Enter the base name of a TSoapDataModule descendant that your application creates. It is also the
base name of the interface for that class. For example, if you specify the class name MyDataServer,
the wizard creates a new unit declaring TMyDataServer, a descendant of TSoapDataModule, which
implements IMyDataServer, a descendant of IAppServerSOAP.
Use this dialog box to specify the type of server your Web Service application will work with.
Item Description
ISAPI/NSAPI Dynamic ISAPI and NSAPI Web server applications are DLLs that are loaded by the Web server. Client
Link Library request information is passed to the DLL as a structure. Each request message is handled in a
separate execution thread.
CGI stand-alone A CGI stand-alone Web server application is a console application that receives client request
executable information on standard input and passes the results back to the server on standard output. Each
request message is handled by a separate instance of the application.
Web App Debugger The Web Application Debugger provides an easy way to monitor HTTP requests, responses, and
executable response times. The Web Application Debugger takes the place of the Web server. Once you have
debugged your application, you can convert it to one of the other types of Web application and install
it with a commercial Web server.
Class Name If selecting Web App Debugger executable, provide a class name for the debugger to use to call
your Web module.
3
3.2.6.40 Save As
File Save As
Item Description
Save in Lists the current directory. Use the drop-down list to select a different drive or directory.
788
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Go To Last Folder Moves to the last directory that you were in.
Visited
Up one directory Moves up one directory level from the current directory.
Create New Folder Creates a new subdirectory in the current directory.
View Menu Displays a list of files and directories along with time stamp, size, and attribute information in one of
five different ways: large icons, small icons, a vertical list, details (including time stamp, size, and
attribute information), and thumbnails (a miniature version of a graphical image of a file).
Files Displays the files in the current directory that match the wildcards in File name or the file type in Files
Of Type. You can display a list of files (default) or you can show details for each file.
File name Displays the name of the file you want to save. You can type wildcards to use as filters in the Files
list box, or click the drop-down arrow to select a previously saved file.
Save as type Displays the type of file you want to save. All files in the current directory of the selected type appear
in the Files list box.
Save Saves the selected file.
Tip: Press F1
Item Description
Directory Name Displays the current directory. If you enter a directory that does not exist, the product creates it.
Directories Lists the current directory.
Files (*.*) Lists all the files in the current directory. You cannot select any of these files. The product displays
this file list so you know the contents of the current directory.
Drives Lists all the available drives. You can select one of the available drives.
Use the New Transactional Object wizard to create a server object that runs under MTS or COM+. Transactional objects are
used in distributed applications to make use of the special services supplied by MTS or COM+ for resource management,
transaction support, or security.
Item Description
3
CoClassName Specify the name for the object that you want to implement. The wizard generates an interface that
has this name with an ‘I’ prepended and an implementation class that has this name with a ‘T’
prepended.
Threading Model Choose the threading model to indicate how MTS or COM+ serializes calls to the transactional
object’s interface. The threading model you choose determines how the object is registered. You
must make sure that your object implementation adheres to the model selected. Threading model
values are shown below.
789
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Transaction model Specify the transaction attribute that is assigned to your object when you register it. The possible
values are shown below.
Generate event support Do not describe standard buttons, such as OK and Cancel.
code
The Threading Model combo box can take the following values:
Model Description
Single Your code has no thread support. Only one client thread can be serviced at a time.
Apartment Under COM+, each object instantiated by a client is accessed by one thread at a time. You must
protect against multiple threads accessing global memory, but objects can safely access their own
instance data (object properties and members). Under MTS, it is also the case that all client calls use
the thread under which the object was created.
Both The same as Apartment except that callbacks to clients are serialized as well.
Neutral Multiple clients can call the object on different threads at the same time, but COM ensures that no
two calls conflict. You must guard against thread conflicts involving global data and any instance data
that is accessed by more than one method. This model should not be used with objects that have a
user interface. This model is only available under COM+. Under COM, it is mapped to the Apartment
model.
Note: The serialization of calls to your object is also influenced by how it participates in activities. Under MTS, objects are
always synchronized by the current activity. Under COM+, this can be configured using the COM+ page of the Type Library
Editor
or the COM+ Component Manager. The Transaction model combo box can take the following values:
Value Meaning
Requires a transaction The object must execute within the scope of a transaction. When a new object is created, its object
context inherits the transaction from the context of the client. If the client does not have a transaction
context, a new transaction context is automatically generated.
Requires a new The object must execute within its own transaction. When a new object is created, a new transaction
transaction context is automatically created as well, regardless of whether its client has a transaction. The object
never runs inside the scope of its client's transaction. Instead, the system always creates
independent transactions for the new objects.
Supports Transactions The object can execute within the scope of its client's transactions. When a new object is created, its
object context inherits the transaction from the context of the client if there is one. Otherwise, the
object is not created in the scope of a transaction.
Does not support Under MTS, this setting behaves like Transactions Ignored under COM+ (see above). Under COM+,
transactions the object can’t run in the context of a transaction at all. If the client has a transaction, attempts to
create the object will fail.
Ignores Transactions The object does not run within the scope of transactions. When a new object is created, its object
context is created without a transaction, regardless of whether the client has a transaction. This
model is not supported under MTS.
3
Use this dialog box to make the contents of a unit available to the current unit. This dialog lists of all units in the project that are
not currently used or included by the current unit. You can only use units that are part of the current project.
790
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Connection Tab
Use the Connection tab page to provide information the wizard needs for connecting to the server that hosts the WSDL
document.
Item Description
User Name Specify the user name to use if the WSDL document is on a secure server that requires
authentication.
Password Specify the password to use with User Name when the WSDL document is on a secure server that
requires authentication.
Proxy Specify the host names for any proxy servers that must forward requests to the URL specified on the
Source page of the Web Services Import dialog.
Item Description
Declare Namespace This option is only valid when the importer generates C++ code. When checked, it puts all generated
type definitions in a C++ namespace that is named after the imported service.
One OutParam is When checked, the importer maps operations with a single output message into functions where the
Return output message is the return value. If this is not checked, the output message is mapped to an output
parameter.
Unwind Literal Params In document literal encoding, the Web Service does not describe operations. Rather, it describes two
records, one that describes the expected input and one that describes the output. When Unwind
Literal Params is checked, the importer converts these two records into method calls.
Generate Destructors When checked, the importer generates destructors on the classes that represent types. These
destructors free any nested members whose types are classes or arrays of classes. The generated
destructors simplify the work you must do when freeing instances of classes that represent types,
because you do not need to explicitly free class members that also use classes to represent the
remotable type.
Ignore Schema Errors When checked, the importer attempts to import WSDL documents that are not well-formed. Often the
importer can deduce the appropriate information even when the schema is badly formed.
Warnings Comments When checked, the importer adds warning messages to the comments it puts in the top of generated
files. These warnings describe problems such as invalid type definitions in the WSDL document when
Ignore Schema Errors is checked, problems encountered when unwinding literal parameters when
Unwind Literal Params is checked, and so on.
Emit Literal Types In document literal encoding, the Web Service does not describe operations. Rather, it describes two 3
records, one that describes the expected input and one that describes the output. When Generate
Literal Types is checked, the importer generates type definitions for these two records, even if it
converts them to method calls (that is, even if Unwind Literal Params is checked).
791
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Ambiguous Types as In some cases when the WSDL document does not make consistent use of schema definitions, the
Array importer has problems importing array types, which results in a type that is represented by a class
with no members. When Ambiguous Types as Array is checked, the importer compensates by
changing these empty classes to arrays. This option is always safe to use unless the WSDL
document describes a Web Service that uses document literal encoding. Document literal encoding
can also give rise to an empty class that represents a procedure. If you check Ambiguous Types as
Array when importing a WSDL document for a Web Service that uses document literal encoding, the
resulting generated code may not work.
Generate Server When checked, the importer generates implementation classes for the imported interfaces. Use this
Implementation option when writing a server that implements a Web Service that is already defined in a WSDL
document.
Map String to When checked, the importer maps all string types to WideString values. When Unchecked, the
WideString importer uses the string type instead. WideString values may be required to handle values that use
extended characters. If string values do not use extended characters, it is more efficient to use the
string type.
Use this wizard to import a WSDL document or XML schema that describes a Web Service. Once you have imported the WSDL
document or XML schema, the wizard generates all the interface and class definitions you need for calling on those Web
Services using a remote interfaced object (THTTPRIO). You can also tell the wizard to generate skeletal code you can complete
to create a Web Service application (for example, if you want to implement a Web Service that is already defined in a WSDL
document).
Source Page
The Source page of the wizard lets you specify the name of the WSDL document or XML schema to import.
Item Description
Location of WSDL File Enter either a WSDL file name or the URL where the document is published. Click the ellipsis button
or URL next to the edit box to browse for a file location.
If you do not know the URL of the WSDL document, or (for client applications) if you want to include
fail-over support, click the Search UDDI button to launch the UDDI browser. When you import a
WSDL document using the UDDI browser, it initializes the location in the WSDL importer, and causes
the importer to generate code that stores the location of the UDDI entry where you found the
document.
After entering a file name, you can click the Next button to move to the Preview page or click the
Options button to provide information the wizard needs for connecting to a server that contains the
WSDL document or for configuring how the wizard generates code to represent the definitions in that
document.
Preview Page
3 The Preview page of the wizard lets you preview the code it generates for the definitions in the specified WSDL document. It
lists only those definitions for which it knows how to generate code. When you are finished viewing the generated code, you can
move back to the Source page to select a different WSDL document, click the Options button to change the connection
information or configure how the wizard generates code for the definitions in the WSDL document, or click the Finish button,
which tells the wizard to define and register invokable interfaces and native type definitions.
792
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Item Description
WSDL Components Select the item for which you want to preview the generated code. You can select a service to see all
the definitions generated for that service, or you can select a single item that is a part of that service
(for example, a single interface, method, or type definition).
Code Preview This tab page shows the code that the wizard generates for the selected item.
Attributes This tab page shows information about the selected item such as its name, the namespace in which it
is defined, and details about its definition, such as the name of the class or type the wizard uses to
represent a defined type, the parameters and Soap Action for a method (operation), binding
information for an interface (port type), and so on.
Options Display the WSDL Import Options dialog, where you can specify the information the importer needs
to connect to the server that publishes the WSDL document or configure the way the wizard
generates code.
Use this dialog box to specify the type of server your Web server application will work with.
Item Description
ISAPI/NSAPI Dynamic ISAPI and NSAPI Web server applications are shared objects that are loaded by the Web server.
Link Library Client request information is passed to the DLL as a structure and evaluated by TISAPIApplication.
Each request message is handled in a separate execution thread. Selecting this type of application
adds the library header of the project files and required entries to the uses list and exports clause of
the project file.
CGI Stand-alone A CGI stand-alone Web server application is a console application that receives client request
executable information on standard input and passes the results back to the server on standard output. This data
is evaluated by TCGIApplication. Each request message is handled by a separate instance of the
application. In Delphi, selecting this type of application adds the required entries to the uses clause of
the project file and adds the appropriate $APPTYPE directive to the source.
Web App Debugger The Web Application Debugger provides an easy way to monitor HTTP requests, responses, and
executable response times. The Web Application Debugger takes the place of the Web server. Once you have
debugged your application, you can convert it to one of the other types of Web application and install
it with a commercial Web server.
When you select this type of application, you must specify a Class Name for the debugger
executable. This is simply a name used by the Web App Debugger to refer to your application. Most
developers use the application’s name as the Class Name.
793
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Service name Enter the name of the invokable interface (port type) that your Web Service application exposes to
clients. This name is used as the name of the interface. It is also used to generate the name of the
implementation class. For example, if you enter MyWebService, the wizard generates the definition of
an invokable interface named MyWebService, and an implementation class named
TMyWebServiceImpl.
Unit identifier Enter the name of the unit that the wizard should create to contain the interface and implementation
class definitions.
Generate comments Adds comments to the unit that it generates telling you what the generated code does.
Generate sample Adds comments to the unit that show sample code similar to the code you should add to define and
methods implement your invokable interface and implementation class.
Service activation Select the activation model you want from the drop-down list:
model Per Request creates a new instance of your implementation class in response to each request it
receives. That instance is freed after the request is handled.
Global Object creates a single instance of your implementation class, which is used to handle all
requests.
Item Description
Type The producer type for the page can be set to one of AdapterPageProducer, DataSetPageProducer,
InetXPageProducer, PageProducer, or XSLPageProducer.
Script Engine If the selected page producer supports scripting, use the Script Engine drop-down list to select the
language used to script the page.
AdapterPageProducer supports only JScript.
New File Creates a template file and manages it as part of the unit. A managed template file will appear in the
project manager and have the same file name and location as the unit source file. Uncheck New File
if you want to use the properties of the producer component (typically, the HTMLDoc or HTMLFile
property).
Template When New File is checked, choose the default content for the template file from the Template
drop-down. The Standard template displays the title of the application, the title of the page, and
hyperlinks to published pages.
Name Enter a page name and title for the page module. The page name is used to reference the page in an
HTTP request or within the application's logic.
Title Specifies the name that the end user will see when the page is displayed in a browser.
3 Published Check Published to allow the page to automatically respond to HTTP requests where the page name
matches the pathinfo in the request message.
Login Required Requires the user to log on before the page can be accessed.
Creation Displayed only on the New WebSnap Page Module. This parameter controls when an instance of
this module is created. If you want the instance created only when it is referenced, select On
Demand. If you want the instance created on startup, select Always.
794
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Caching Displayed only on the New WebSnap Page Module. This parameter controls when a module is
destroyed. At runtime, the instance of this module can be either kept in cache, or removed from
memory when the request has been serviced. Select Cache Instance to keep the instance in memory
even if there are no current references to it. Select Destroy Instance to allow the server to remove the
instance from memory if there are no references to it.
See Also
WebSnap Overview
Item Description
ISAPI/NSAPI Dynamic ISAPI and NSAPI Web server applications are shared objects that are loaded by the Web server.
Link Library Client request information is passed to the DLL as a structure and evaluated by TISAPIApplication.
Each request message is handled in a separate execution thread. Selecting this type of application
adds the library header of the project files and required entries to the uses list and exports clause of
the project file.
CGI Stand-alone A CGI stand-alone Web server application is a console application that receives client request
executable information on standard input and passes the results back to the server on standard output. This data
is evaluated by TCGIApplication. Each request message is handled by a separate instance of the
application. In Delphi, selecting this type of application adds the required entries to the uses clause of
the project file and adds the appropriate $APPTYPE directive to the source.
Web App Debugger The Web Application Debugger provides an easy way to monitor HTTP requests, responses, and
executable response times. The Web Application Debugger takes the place of the Web server. Once you have
debugged your application, you can convert it to one of the other types of Web application and install
it with a commercial Web server.
When you select this type of application, you must specify a class name for the debugger executable.
This is simply a name used by the Web Application Debugger to refer to your application. Most
developers use the application name as the class name.
Page Module Displays a Web data module that includes a PageProducer, WebAppServices, ApplicationAdapter,
LogicalPageDispatcher, and AdapterDispatcher component. With a Web Page Module, on the Code
Editor you can view a Web page’s unit, HTML code, and a preview the Web page after the module
has been compiled and run.
Data Module Displays a Web data module that includes a PageProducer, WebAppServices, ApplicationAdapter,
LogicalPageDispatcher, and AdapterDispatcher component.
Components Displays the Web App Components dialog box so you can select one or more components to add
functionality to your application.
Page Name If the selected application module type is page module, you can associate a name with the page by 3
entering a name in the this field.
Page Options Displays the Application Page Module Options dialog box, allowing you to define the basic
properties of a page module.
Caching At runtime, the instance of this module can be either kept in cache, or removed from memory when
the request has been serviced. Select one of the following:
Cache Instance stores the module in memory between user sessions.
Destroy Instance removes the module from memory as soon as the active session ends.
795
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
See Also
WebSnap Overview
Item Description
Creation Controls when an instance of this module is created:
On Demand creates the instance only when it is referenced.
Always creates the instance on startup.
Caching Controls when a module is destroyed. At runtime, the instance of this module can be either kept in
cache, or removed from memory when the request has been serviced.
Cache Instance keeps the instance in memory even if there are no current references to it.
Destroy Instance allows the server to remove the instance from memory if there are no references
to it.
See Also
WebSnap Overview
Item Description
Application Adapter Contains the field and action components that are available through the Application script variable.
End User Adapter Provides information about a user such as their name, access rights, and whether they are logged in.
TEndUserAdapter calls event handlers to retrieve user information.
Page Dispatcher Dispatches HTTP requests that reference a Web page module by name.
Adapter Dispatcher Handles HTML form submissions, and requests for dynamic images, by calling adapter action and
field components.
Dispatch Actions Passes an HTTP request message to the appropriate action items that assemble a response.
Locate File Service Controls the location of templates and include files at runtime.
Sessions Service Stores information about end user data that is needed for a short period of time. For example, the
3 TSessionsService can be used to keep track of all users that are currently logged in and
automatically log a user out after a period of inactivity..
User List Service Contains a list of user names, password, and access rights. It is used to validate login and check
access rights for a particular user.
See Also
WebSnap Overview
796
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Use this dialog box to determine how the XML Data Binding Wizard generates interfaces and implementation classes to
represent an XML document or schema.
Item Description
Category Choose a category of options such as Code Generation. The table at the right displays the options
for the selected category.
Options table Edit the values in the second column of the Options table to change one of the options that the wizard
uses.
When the Category is Data Type Map, this table displays the types that the wizard generates for
each XML type that appears in the XML schema. You can edit these values to change the mapped
type. For example, you may want to change a data type to Variant so that you can distinguish
between an empty string and a blank value.
Property Get Prefix Controls the name the wizard assigns to the methods it creates for reading property values. These
methods consist of the Get prefix followed by the name of the property (element).
Property Set Prefix Controls the name the wizard assigns to the methods it creates for writing property values. These
methods consist of the Set prefix followed by the name of the property (element).
Class Name Prefix Controls the names that the wizard assigns to implementation classes for nodes. These classes are
given the name of the element or attribute with the Class Name Prefix prepended.
Interface Prefix Controls the names that the wizard assigns to interfaces. These interfaces are given the name of the
element with Interface Prefix prepended.
Node List Type Suffix Controls the names that the wizard assigns to the classes and interfaces it generates for repeating
collections of child nodes. These classes get the name of the child node tag, with Node List Type
Suffix appended (and Class Name Prefix or Interface Prefix prepended).
Node Interface Base Specifies the interface that is used as a base from which all generated interfaces for nodes are
derived.
Node Class Base Specifies the class that is used as a base class from which all generated implementation classes are
derived. Node Class Base should implement the interface specified by Node Interface Base.
Collection Intf. Base Specifies the interface that is used as a base from which all generated interfaces that represent
repeating child nodes are derived.
Collection Class Base Specifies the class that is used as a base class from which all classes that represent repeating child
nodes
Default Data Type Specifies the type that is assigned to nodes by default on the second page of the wizard.
Use this wizard to generate interface and class definitions that correspond to the structure of an XML document or schema. The
wizard generates a global function that returns the interface for the root element of the document.
After you use the wizard to create these definitions, you can use the classes and interfaces to work with XML documents that
have the structure of the specified document or schema.
797
File RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Schema or XML Data Enter the file name of a schema or XML document for which you want the wizard to generate
File interfaces and implementation classes. Beside the edit control is a browse button (labeled with
ellipsis) that you can click to browse for an XML document or schema file.
Use XDB Settings File Indicates whether the wizard should be initialized to reflect the choices you made the last time you
used the wizard and saved your settings. When checked, the wizard starts by using the last XDB file
that you saved using the third page of the wizard.
Options Displays the XML Data Binding Wizard Options dialog box. You can select various options that
influence how the wizard generates code for the interfaces and implementation classes in your XML
document or schema.
Use this wizard page to specify what code the wizard generates.
Item Description
Schema components Displays a hierarchy of elements for which the wizard can generate interfaces and classes. This
hierarchy is divided into complex elements (nodes that correspond to tags that have child nodes) and
simple elements (simple data types that the schema defines for elements in the XML document).
Nodes for complex types can be expanded to display nodes for the child elements.
When you select a node in the Schema Components hierarchy, the right side of the dialog displays
detailed information about the node and lets you indicate what code, if any, the wizard should
generate for that node.
Source Name Displays the name of the type or tag in the XML schema. Edit the value if you want the wizard to
create or modify the schema file.
Source Datatype Displays the type of the selected node, as defined in the XML schema. Edit the value if you want the
wizard to create or modify the schema file.
Documentation Displays any comments from the XML schema to describe the type or node. Edit the value if you
want the wizard to create or modify the schema file.
Generate Binding Creates an interface and implementation class for a selected complex type, or a property on the
parent interface and class for simple elements that are children of a complex type.
Identifier Name Specifies the name of the interface to generate for a top-level complex type. For the children of a
complex type, Identifier Name specifies the name of the property created for this child in the parent
element’s interface.
Doc Element Type This option is available only for top-level complex types and indicates the type of the document
element (the root of the data hierarchy).
Element Name Specifies the tag name of the document element.
Data Type For any child node, indicates the type for the property that represents this child element. If the child
represents an element node that has children of its own, the drop-down list lets you select any
3 interface type that the wizard generates for a complex type. If the child represents a simple element,
the drop-down list lets you select a type such as Integer, String, or Variant. Note that representing
simple child elements as Variants allows your application to distinguish between elements with an
empty string for a value, and elements that do not appear in a particular document (Null Variants).
Repeating For child elements that represent complex types, indicates whether the parent node can have more
than one child node of this type.
Access Mode For child nodes that represent simple elements (as opposed to complex types), indicates whether the
generated property is read/write or read-only.
798
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) File
Native Type When a simple type is selected, specifies the data type that the wizard uses to represent values of
that type.
Options Displays the XML Data Binding Wizard Options dialog box. You can select various options that
influence how the wizard generates code for the interfaces and implementation classes in your XML
document or schema.
Use this wizard page to confirm the choices you have made, specify unit-wide code generation options, indicate where you want
your choices saved, and tell the wizard to generate code to represent the XML document or schema.
Item Description
Generated Interfaces indicates what interfaces the wizard will generate. When you select an interface in this control, you
can see the interface definition the wizard will generate in the Code Preview control.
Code Preview Displays the code that the wizard will generate for the currently selected interface in the Generated
Interfaces control.
Do not store settings Generates code for the choices you have made with the wizard, but does not save the choices.
Store in XML schema Updates the schema file with information about the choices you have made.
Store in file Enter the name of a schema file where the wizard stores information about your choices. This
schema file is independent of the XML document or schema file you selected on the first page of the
wizard. The wizard uses this file to initialize itself the next time you use it.
Options Displays the XML Data Binding Wizard Options dialog box. You can select various options that
influence how the wizard generates code for the interfaces and implementation classes in your XML
document or schema.
Finish Exits the wizard and generates the interfaces and implementation classes for your XML document or
schema.
3.2.6.56 Close
File Close
Item Description
Close Closes the active project.
Close All Closes all open projects. 3
3.2.6.57 Exit
File Exit
799
HTML Elements RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
3.2.6.58 New
File New
Item Description
C++ Builder Projects
Only
Package - C++ Builder Creates a skeleton of a C++ package project.
Unit - C++Builder Creates a new C++ unit skeleton. Typically you create a new unit after creating a new package or
application.
VCL Forms Application Creates a new C++ form-based application using VCL components.
- C++Builder
Form - C++Builder Creates a new C++ VCL form. Typically you would create a new form after creating a new package or
application.
Delphi for Win32
Projects Only
Package - Delphi for Creates a skeleton for a Delphi package project.
Win32
Unit - Delphi for Win32 Creates a new Delphi unit skeleton (using Pascal source). Typically you would create a new unit after
creating a new package or application.
VCL Forms Application Creates a new form-based application using VCL components.
- Delphi for Win32
Form - Delphi for Creates a new Delphi VCL form. Typically you create a new form after creating a new package or
Win32 application.
Delphi for .NET
Projects Only
ASP.NET Web Creates a new web form application using ASP.NET. A Web Form Application runs in a browser.
Application - Delphi
.NET
VCL Forms Application Creates a new form-based application using VCL components.
- Delphi for .NET
All Personalities
Other The New Items dialog box, which lists every file or project the IDE understands. Examples: XML files,
text files, and C++ projects.
Customize Opens the Customize New Menu dialog box that allows you to customize how projects and files are
listed in the File New menu.
3 See Also
Packages ( see page 640)
VCL Overview
800
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) HTML Elements
Item Description
accesskey Assigns an access key to an element. An access key is a single character from the document
character set. Authors should consider the input method of the expected reader when specifying an
accesskey.
charset Specifies the character encoding of the resource designated by the link.
class Assigns a class name or set of class names to an element. Any number of elements may be
assigned the same class name or names. Multiple class names must be separated by white space
characters.
coords Specifies the position and shape on the screen relative to the top, left corner of the object. The
number and order of values depends on the shape being defined. Possible combinations: 3
rect left-x, top-y, right-x, bottom-y.
circle center-x, center-y, radius. When the radius value is a percentage value, user agents should
calculate the final radius value based on the associated object's width and height. The radius should
be the smaller value of the two.
poly x1, y1, x2, y2, ..., xN, yN. The first x and y coordinate pair and the last should be the same to
close the polygon. When these coordinate values are not the same, user agents should infer an
additional coordinate pair to close the polygon.
801
HTML Elements RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
dir Specifies the direction of directionally neutral text in an element's content and attribute values:
ltr indicates left-to-right text or table.
rtl indicates right-to-left text or table.
href Specifies the location of a Web resource and definines a link between the current element (the
source anchor) and the destination anchor defined by this attribute.
hreflang Specifies the base language of the resource designated by href and may only be used when href is
specified.
id Assigns a name to an element. This name must be unique in a document.
lang Specifies the base language of an element's attribute values and text content. The default value of
this attribute is unknown.
name Assigns the control name.
onblur The onblur event occurs when an element loses focus either by the pointing device or by tabbing
navigation.
onclick The onclick event occurs when the pointing device button is clicked over an element.
ondblclick The ondblclick event occurs when the pointing device button is double clicked over an element.
onfocus The onfocus event occurs when an element receives focus either by the pointing device or by tabbing
navigation.
onkeydown The onkeydown event occurs when a key is pressed down over an element.
onkeypress The onkeypress event occurs when a key is pressed and released over an element.
onkeyup The onkeyup event occurs when a key is released over an element. This attribute may be used with
most elements.
onmousedown The onmousedown event occurs when the pointing device button is pressed over an element.
onmousemove The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseout The onmouseout event occurs when the pointing device is moved away from an element.
onmouseover The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseup The onmouseup event occurs when the pointing device button is released over an element.
rel Specifies the relationship from the current document to the anchor specified by the href attribute. The
value of this attribute is a space-separated list of link types.
rev Specifies a reverse link from the anchor specified by the href attribute to the current document. The
value of this attribute is a space-separated list of link types.
shape When the type attribute is set to image, this attribute specifies the location of the image to be used to
decorate the graphical submit button.
style Specifies style information for the current element. The syntax of the value of the style attribute is
determined by the default style sheet language.
tabindex Specifies the position of the current element in the tabbing order for the current document. This value
must be a number between 0 and 32767. User agents should ignore leading zeros.
title Specifies advisory information about the element for which it is set.
3
type Provides an advisory hint as to the content type of the content available at the link target address. It
allows user agents to opt to use a fallback mechanism rather than fetch the content if they are
advised that they will get content in a content type they do not support. Authors who use this attribute
take responsibility to manage the risk that it may become inconsistent with the content available at
the link target address. For the current list of registered content types, please consult the www.w3.org
web site.
802
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) HTML Elements
See Also
W3C HTML Home Page
3.2.7.2 Unit
Use this dialog box to specify a value and unit of measure for the CSS attribute selected from the Code Completion window.
Item Description
Value Select a number of units for the attribute.
Units Select one of the following units of measure for the attribute:
em equal to the font size of the current element
ex approximately half the height of the font-size
px pixel
in inch
cm centimeter
mm millimeter
pt point (one point is 1/72 of an inch)
pc pica (about 12 points)
Item Description
align Specifies the horizontal alignment of its element with respect to the surrounding context. Possible
values are left, right, center, and justify.
class Assigns a class name or set of class names to an element. Any number of elements may be
assigned the same class name or names. Multiple class names must be separated by white space
characters.
dir Specifies the direction of directionally neutral text in an element's content and attribute values:
ltr indicates left-to-right text or table.
rtl indicates right-to-left text or table.
id Assigns a name to an element. This name must be unique in a document.
lang Specifies the base language of an element's attribute values and text content. The default value of
this attribute is unknown.
onclick The onclick event occurs when the pointing device button is clicked over an element.
ondblclick The ondblclick event occurs when the pointing device button is double clicked over an element. 3
onkeydown The onkeydown event occurs when a key is pressed down over an element.
onkeypress The onkeypress event occurs when a key is pressed and released over an element.
onkeyup The onkeyup event occurs when a key is released over an element. This attribute may be used with
most elements.
onmousedown The onmousedown event occurs when the pointing device button is pressed over an element.
803
HTML Elements RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
onmousemove The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseout The onmouseout event occurs when the pointing device is moved away from an element.
onmouseover The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseup The onmouseup event occurs when the pointing device button is released over an element.
style Specifies style information for the current element. The syntax of the value of the style attribute is
determined by the default style sheet language.
title Specifies advisory information about the element for which it is set.
See Also
W3C HTML Home Page
Item Description
align Specifies the horizontal alignment of its element with respect to the surrounding context. Possible
values are left, right, center, and justify.
class Assigns a class name or set of class names to an element. Any number of elements may be
assigned the same class name or names. Multiple class names must be separated by white space
characters.
dir Specifies the direction of directionally neutral text in an element's content and attribute values:
ltr indicates left-to-right text or table.
rtl indicates right-to-left text or table.
id Assigns a name to an element. This name must be unique in a document.
lang Specifies the base language of an element's attribute values and text content. The default value of
this attribute is unknown.
noshade If set to true, the horizontal rule is rendered in a solid color. If set to false, the rule is rendered as a
two-color groove.
onclick The onclick event occurs when the pointing device button is clicked over an element.
ondblclick The ondblclick event occurs when the pointing device button is double clicked over an element.
onkeydown The onkeydown event occurs when a key is pressed down over an element.
onkeypress The onkeypress event occurs when a key is pressed and released over an element.
onkeyup The onkeyup event occurs when a key is released over an element. This attribute may be used with
most elements.
onmousedown The onmousedown event occurs when the pointing device button is pressed over an element.
3 onmousemove The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseout The onmouseout event occurs when the pointing device is moved away from an element.
onmouseover The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseup The onmouseup event occurs when the pointing device button is released over an element.
size Specifies the initial width of the control. The width is given in pixels except when type attribute is set
to text or password. In that case, its value refers to the (integer) number of characters.
804
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) HTML Elements
src When the type attribute is set to image, this attribute specifies the location of the image to be used to
decorate the graphical submit button.
style Specifies style information for the current element. The syntax of the value of the style attribute is
determined by the default style sheet language.
title Specifies advisory information about the element for which it is set.
width Specifies the width of the rule. The default width is 100%, which extends the rule across the entire
canvas.
See Also
W3C HTML Home Page
Item Description
align Specifies the horizontal alignment of its element with respect to the surrounding context. Possible
values are left, right, center, and justify.
alt For user agents that cannot display images, forms, or applets, this attribute specifies alternate text.
The language of the alternate text is specified by the lang attribute.
border Specifies the width of an image border, in pixels.
class Assigns a class name or set of class names to an element. Any number of elements may be
assigned the same class name or names. Multiple class names must be separated by white space
characters.
dir Specifies the direction of directionally neutral text in an element's content and attribute values:
ltr indicates left-to-right text or table.
rtl indicates right-to-left text or table.
height Specifies the image and object height override.
hspace Specifies the amount of white space to be inserted to the left and right of an image.
id Assigns a name to an element. This name must be unique in a document.
ismap For the IMG and INPUT elements, associates a server-side image map with the element.
lang Specifies the base language of an element's attribute values and text content. The default value of
this attribute is unknown.
longdesc Specifies a link to a long description of the image.
name Assigns the control name.
onclick The onclick event occurs when the pointing device button is clicked over an element.
ondblclick The ondblclick event occurs when the pointing device button is double clicked over an element.
3
onkeydown The onkeydown event occurs when a key is pressed down over an element.
onkeypress The onkeypress event occurs when a key is pressed and released over an element.
onkeyup The onkeyup event occurs when a key is released over an element. This attribute may be used with
most elements.
onmousedown The onmousedown event occurs when the pointing device button is pressed over an element.
onmousemove The onmousemove event occurs when the pointing device is moved while it is over an element.
805
HTML Elements RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
onmouseout The onmouseout event occurs when the pointing device is moved away from an element.
onmouseover The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseup The onmouseup event occurs when the pointing device button is released over an element.
src Specifies the location of the image to be used in the control.
style Specifies style information for the current element. The syntax of the value of the style attribute is
determined by the default style sheet language.
title Specifies advisory information about the element for which it is set.
usemap Associates an image map with an element. The image map is defined by a MAP element. The value
of usemap must match the value of the name attribute of the associated MAP element.
vspace Specifies the amount of white space to be inserted above and below an image.
width Specifies the image and object width override.
See Also
W3C HTML Home Page
Item Description
accept Specifies a comma-separated list of content types that a server processing this form will handle
correctly. User agents may use this information to filter non-conforming files when prompting a user
to select files to be sent to the server.
accesskey Assigns an access key to an element. An access key is a single character from the document
character set. Authors should consider the input method of the expected reader when specifying an
accesskey.
align Specifies the horizontal alignment of its element with respect to the surrounding context. Possible
values are left, right, center, and justify.
alt For user agents that cannot display images, forms, or applets, this attribute specifies alternate text.
The language of the alternate text is specified by the lang attribute.
checked When the type attribute has the value radio or checkbox, this boolean attribute specifies that the
button is on. User agents must ignore this attribute for other control types.
class Assigns a class name or set of class names to an element. Any number of elements may be
assigned the same class name or names. Multiple class names must be separated by white space
characters.
dir Specifies the direction of directionally neutral text in an element's content and attribute values:
ltr indicates left-to-right text or table.
rtl indicates right-to-left text or table.
3 disabled When set for a form control, this boolean attribute disables the control for user input.
id Assigns a name to an element. This name must be unique in a document.
ismap For the IMG and INPUT elements, associates a server-side image map with the element.
lang Specifies the base language of an element's attribute values and text content. The default value of
this attribute is unknown.
806
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) HTML Elements
maxlength When the type attribute is set to text or password, this attribute specifies the maximum number of
characters the user may enter. This number may exceed the specified size, in which case the user
agent should offer a scrolling mechanism. The default value for this attribute is an unlimited number.
name Assigns the control name.
onblur The onblur event occurs when an element loses focus either by the pointing device or by tabbing
navigation.
onchange The onchange event occurs when a control loses the input focus and its value has been modified
since gaining focus. This attribute applies to the following elements: INPUT, SELECT, and
TEXTAREA.
onclick The onclick event occurs when the pointing device button is clicked over an element.
ondblclick The ondblclick event occurs when the pointing device button is double clicked over an element.
onfocus The onfocus event occurs when an element receives focus either by the pointing device or by tabbing
navigation.
onkeydown The onkeydown event occurs when a key is pressed down over an element.
onkeypress The onkeypress event occurs when a key is pressed and released over an element.
onkeyup The onkeyup event occurs when a key is released over an element. This attribute may be used with
most elements.
onmousedown The onmousedown event occurs when the pointing device button is pressed over an element.
onmousemove The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseout The onmouseout event occurs when the pointing device is moved away from an element.
onmouseover The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseup The onmouseup event occurs when the pointing device button is released over an element.
onselect The onselect event occurs when a user selects some text in a text field. This attribute may be used
with the INPUT and TEXTAREA elements.
readonly When set for a form control, this boolean attribute prohibits changes to the control.
size Specifies the initial width of the control. The width is given in pixels except when type attribute is set
to text or password. In that case, its value refers to the (integer) number of characters.
src When the type attribute is set to image, this attribute specifies the location of the image to be used to
decorate the graphical submit button.
style Specifies style information for the current element. The syntax of the value of the style attribute is
determined by the default style sheet language.
tabindex Specifies the position of the current element in the tabbing order for the current document. This value
must be a number between 0 and 32767. User agents should ignore leading zeros.
title Specifies advisory information about the element for which it is set.
807
HTML Elements RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
type Specifies the type of control to create and can be set to:
button creates a push button. User agents should use the value of the value attribute as the button's
label.
checkbox creates a checkbox.
file creates a file select control. User agents may use the value of the value attribute as the
initial file name.
hidden creates a hidden control.
image creates a graphical submit button. The value of the src attribute specifies the URI of the
image that will decorate the button. For accessibility reasons, authors should provide
alternate text for the image via the alt attribute.
password creates a single-line text input control, but the input text is rendered to hide the
characters (for example, a series of asterisks). This control type is often used for sensitive
input such as passwords. Note that the current value is the text entered by the user, not the
text rendered by the user agent.
radio creates a radio button.
reset creates a reset button.
submit creates a submit button.
text creates a single-line text input control.
usemap Associates an image map with an element. The image map is defined by a MAP element. The value
of usemap must match the value of the name attribute of the associated MAP element.
value Specifies the initial value of the control. It is optional except when the type attribute has the value
radio or checkbox.
See Also
W3C HTML Home Page
Item Description
class Assigns a class name or set of class names to an element. Any number of elements may be
assigned the same class name or names. Multiple class names must be separated by white space
characters.
dir Specifies the direction of directionally neutral text in an element's content and attribute values:
ltr indicates left-to-right text or table.
rtl indicates right-to-left text or table.
disabled When set for a form control, this boolean attribute disables the control for user input.
id Assigns a name to an element. This name must be unique in a document.
3 lang Specifies the base language of an element's attribute values and text content. The default value of
this attribute is unknown.
multiple If set to true, allows multiple selections in the list box or dropdown list. If set to false, the SELECT
element only permits single selections.
name Assigns the control name.
onblur The onblur event occurs when an element loses focus either by the pointing device or by tabbing
navigation.
808
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) HTML Elements
onchange The onchange event occurs when a control loses the input focus and its value has been modified
since gaining focus. This attribute applies to the following elements: INPUT, SELECT, and
TEXTAREA.
onclick The onclick event occurs when the pointing device button is clicked over an element.
ondblclick The ondblclick event occurs when the pointing device button is double clicked over an element.
onfocus The onfocus event occurs when an element receives focus either by the pointing device or by tabbing
navigation.
onkeydown The onkeydown event occurs when a key is pressed down over an element.
onkeypress The onkeypress event occurs when a key is pressed and released over an element.
onkeyup The onkeyup event occurs when a key is released over an element. This attribute may be used with
most elements.
onmousedown The onmousedown event occurs when the pointing device button is pressed over an element.
onmousemove The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseout The onmouseout event occurs when the pointing device is moved away from an element.
onmouseover The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseup The onmouseup event occurs when the pointing device button is released over an element.
size Specifies the initial width of the control. The width is given in pixels except when type attribute is set
to text or password. In that case, its value refers to the (integer) number of characters.
style Specifies style information for the current element. The syntax of the value of the style attribute is
determined by the default style sheet language.
tabindex Specifies the position of the current element in the tabbing order for the current document. This value
must be a number between 0 and 32767. User agents should ignore leading zeros.
title Specifies advisory information about the element for which it is set.
See Also
W3C HTML Home Page
Item Description
class Assigns a class name or set of class names to an element. Any number of elements may be
assigned the same class name or names. Multiple class names must be separated by white space
characters.
dir Specifies the direction of directionally neutral text in an element's content and attribute values:
ltr indicates left-to-right text or table. 3
rtl indicates right-to-left text or table.
id Assigns a name to an element. This name must be unique in a document.
lang Specifies the base language of an element's attribute values and text content. The default value of
this attribute is unknown.
onclick The onclick event occurs when the pointing device button is clicked over an element.
ondblclick The ondblclick event occurs when the pointing device button is double clicked over an element.
809
HTML Elements RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
onkeydown The onkeydown event occurs when a key is pressed down over an element.
onkeypress The onkeypress event occurs when a key is pressed and released over an element.
onkeyup The onkeyup event occurs when a key is released over an element. This attribute may be used with
most elements.
onmousedown The onmousedown event occurs when the pointing device button is pressed over an element.
onmousemove The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseout The onmouseout event occurs when the pointing device is moved away from an element.
onmouseover The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseup The onmouseup event occurs when the pointing device button is released over an element.
style Specifies style information for the current element. The syntax of the value of the style attribute is
determined by the default style sheet language.
title Specifies advisory information about the element for which it is set.
See Also
W3C HTML Home Page
Item Description
align Specifies the horizontal alignment of its element with respect to the surrounding context. Possible
values are left, right, center, and justify.
bgcolor Sets the background color for the table cells.
border Specifies the width (in pixels only) of the frame around a table.
cellpadding Specifies the amount of space between the border of the cell and its contents. If the value of this
attribute is a pixel length, all four margins should be this distance from the contents. If the value of the
attribute is a percentage length, the top and bottom margins should be equally separated from the
content based on a percentage of the available vertical space, and the left and right margins should
be equally separated from the content based on a percentage of the available horizontal space.
cellspacing Specifies how much space the user agent should leave between the left side of the table and the
left-hand side of the leftmost column, the top of the table and the top side of the topmost row, and so
on for the right and bottom of the table.
3 class Assigns a class name or set of class names to an element. Any number of elements may be
assigned the same class name or names. Multiple class names must be separated by white space
characters.
datapagesize Specifies the number of records displayed in a table bound to a data source.
dir Specifies the direction of directionally neutral text in an element's content and attribute values:
ltr indicates left-to-right text or table.
rtl indicates right-to-left text or table.
810
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) HTML Elements
frame
id Assigns a name to an element. This name must be unique in a document.
lang Specifies the base language of an element's attribute values and text content. The default value of
this attribute is unknown.
onclick The onclick event occurs when the pointing device button is clicked over an element.
ondblclick The ondblclick event occurs when the pointing device button is double clicked over an element.
onkeydown The onkeydown event occurs when a key is pressed down over an element.
onkeypress The onkeypress event occurs when a key is pressed and released over an element.
onkeyup The onkeyup event occurs when a key is released over an element. This attribute may be used with
most elements.
onmousedown The onmousedown event occurs when the pointing device button is pressed over an element.
onmousemove The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseout The onmouseout event occurs when the pointing device is moved away from an element.
onmouseover The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseup The onmouseup event occurs when the pointing device button is released over an element.
rules Specifies which rules will appear between cells within a table. The rendering of rules is user agent
dependent. Possible values:
none No rules. This is the default value.
groups Rules will appear between row groups and column groups only.
rows Rules will appear between rows only.
cols Rules will appear between columns only.
all Rules will appear between all rows and columns.
style Specifies style information for the current element. The syntax of the value of the style attribute is
determined by the default style sheet language.
title Specifies advisory information about the element for which it is set.
width Specifies the desired width of the entire table and is intended for visual user agents. When the value
is a percentage value, the value is relative to the user agent's available horizontal space. In the
absence of any width specification, table width is determined by the user agent.
See Also
W3C HTML Home Page
Item Description
3
accesskey Assigns an access key to an element. An access key is a single character from the document
character set. Authors should consider the input method of the expected reader when specifying an
accesskey.
class Assigns a class name or set of class names to an element. Any number of elements may be
assigned the same class name or names. Multiple class names must be separated by white space
characters.
811
Insert RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
cols Specifies how many characters wide the text area is. Users should be able to enter longer lines than
this, so user agents should provide some means to scroll through the contents of the control when
the contents extend beyond the visible area. User agents may wrap visible text lines to keep long
lines visible without the need for scrolling.
dir Specifies the direction of directionally neutral text in an element's content and attribute values:
ltr indicates left-to-right text or table.
rtl indicates right-to-left text or table.
disabled When set for a form control, this boolean attribute disables the control for user input.
id Assigns a name to an element. This name must be unique in a document.
lang Specifies the base language of an element's attribute values and text content. The default value of
this attribute is unknown.
name Assigns the control name.
onblur The onblur event occurs when an element loses focus either by the pointing device or by tabbing
navigation.
onchange The onchange event occurs when a control loses the input focus and its value has been modified
since gaining focus. This attribute applies to the following elements: INPUT, SELECT, and
TEXTAREA.
onclick The onclick event occurs when the pointing device button is clicked over an element.
ondblclick The ondblclick event occurs when the pointing device button is double clicked over an element.
onfocus The onfocus event occurs when an element receives focus either by the pointing device or by tabbing
navigation.
onkeydown The onkeydown event occurs when a key is pressed down over an element.
onkeypress The onkeypress event occurs when a key is pressed and released over an element.
onkeyup The onkeyup event occurs when a key is released over an element. This attribute may be used with
most elements.
onmousedown The onmousedown event occurs when the pointing device button is pressed over an element.
onmousemove The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseout The onmouseout event occurs when the pointing device is moved away from an element.
onmouseover The onmousemove event occurs when the pointing device is moved while it is over an element.
onmouseup The onmouseup event occurs when the pointing device button is released over an element.
onselect The onselect event occurs when a user selects some text in a text field. This attribute may be used
with the INPUT and TEXTAREA elements.
readonly When set for a form control, this boolean attribute prohibits changes to the control.
rows Specifies the number of visible text lines in the control. Users should be able to enter more lines than
this, so user agents should provide some means to scroll through the contents of the control when
the contents extend beyond the visible area.
style Specifies style information for the current element. The syntax of the value of the style attribute is
3 determined by the default style sheet language.
tabindex Specifies the position of the current element in the tabbing order for the current document. This value
must be a number between 0 and 32767. User agents should ignore leading zeros.
title Specifies advisory information about the element for which it is set.
See Also
W3C HTML Home Page
812
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Insert
3.2.8 Insert
Topics
Name Description
Insert User Control ( see page 813) Insert Insert User Control
Use this dialog box to insert a user control into a Web Form or a User Control
template.
Insert Image ( see page 813) Insert Image
Use this dialog box to insert an image file into your ASP.NET Web Form or HTML
page. Once inserted, you can select and change the following image attributes.
Insert Input ( see page 814) Insert Input
Use this dialog box to create and modify controls on your ASP.NET Web Form or
HTML page before submitting it for deployment.
Insert Table ( see page 814) Insert Table
Use this dialog box to insert a table into your ASP.NET Web Form or HTML
page. Once inserted, you can modify the physical appearance of the table.
Color Selector ( see page 815) Use this dialog box to change the foreground and background color from the
HTML Designer.
Use this dialog box to insert a user control into a Web Form or a User Control template.
Item Description
Browse Search for the .ascx file in a directory.
OK Add the .ascx file to your project.
Cancel Exits the dialog without saving.
Use this dialog box to insert an image file into your ASP.NET Web Form or HTML page. Once inserted, you can select and
change the following image attributes.
Item Description
Alignment Specifies the position of the image or object with respect to its context.
Border size Specifies the width of an image or object border in pixels.
Width Specifies a new width for the image or object selected.
3
Horizontal spacing Specifies the amount of white space to be inserted to the left and right of an image or object.
Height Specifies a new height for the image or object selected.
Vertical spacing Specifies the amount of white space to be inserted above and below an image or object.
Alternate text Specify alternate text to serve as content when the element cannot be rendered normally.
813
Insert RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Image map Specifies a client-side image map (or other navigation mechanism) that may be associated with
another element.
Image map information Defines a server-side image map for the specified image.
on server
Use this dialog box to create and modify controls on your ASP.NET Web Form or HTML page before submitting it for
deployment.
Item Description
Input type Specifies the type of controls to create.
Name Specifies a name of the form.
Alignment Specifies the horizontal alignment of its element with respect to the surrounding context.
Value Specifies the initial value of the control.
Alt text Specifies alternative text when the element cannot be rendered normally, such as images or applets.
Tab Index Specifies the position of the current element in the tabbing order for the current document. Values
should be between 0 and 32767.
Read only Prohibits changes to the control.
Max length Specifies the maximum number of characters you may enter if the attribute has the text or password
value.
Use this dialog box to insert a table into your ASP.NET Web Form or HTML page. Once inserted, you can modify the physical
appearance of the table.
Item Description
Rows Specifies the number of visible text lines.
Columns Specifies the number of columns that appear in the table.
Width Specifies the desired width of the entire table.
pixels Specifies an integer value that represents the number of pixels on the screen.
percent Specifies a value in %.
3
Height Specifies the desired height of the entire table in pixels.
Alignment Specifies the position of the table with respect to the document.
Background color Sets the background color for the table.
Background Image Sets the background image for the table.
Border color Sets the color of the surrounding frame of the table.
Border size Specifies the width (in pixels only) of the table frame.
814
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Testing Wizards
Highlight color Specifies the color used to draw the light portion of the table frame.
Cell spacing Specifies how much space you should leave between the left side of the table and the left-hand side
of the leftmost column, the top of the table and the top side of the topmost row, and so on for the right
and bottom of the table. The attribute also specifies the amount of space to leave between cells.
Shadow color Specifies the color used to draw the shaded portion of the table frame.
Cell padding Specifies the amount of space between the border of the cell and its contents.
Summary Provides a summary of the table's purpose and structure to render non-visual media.
Background Color for Sets the background color for the individual cells within a table.
Cell Attributes
Border color for Cell Sets the color of the surrounding frame of individual cells within a table.
Attributes
Text Alignment Specifies the alignment of data and the justification of text in a cell.
Wrap text Check this box to specify the text to be wrapped in the same width as the table.
Item Description
Web palette Use this tab to select from a variety of web colors available.
Use color name Select to use either a web color string, i.e., #FF00FF, or a web color name like "snow." If checked,
the dialog will use the web color name when available.
Customize Selected Lets you specify and modify the values of the color scheme to increase or decrease the composition
Color of the selected color.
Named Web Colors Use this tab to easily select a named web color.
Other Colors Use this tab to select from a list of system or standard colors.
System Colors Lists available colors from the Windows system palette.
Standard Colors Lists of available colors from the Windows standard 16 color palette.
815
Testing Wizards RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this wizard to create a test case for your current project.
Item Description
Source File Specifies the path and file name of the code file to which you want to add tests. By default, this
textbox is prefilled with the name of the primary code file of the active project. You can change the
location and the name of the file to a file other than the default. If the file does not exist, you will be
unable to select classes and methods to test and will be unable to complete the wizard. For example,
if you add a unit to your project and you want to add test cases to the unit, you must add at least one
class to the unit to be able to use this wizard successfully.
Available Classes and Displays a treeview of the available classes and methods for the current file. You can deselect items
Methods in the tree. By default, all classes and methods are selected. If you deselect individual methods within
a class, the wizard ignores those methods when building test cases. If you deselect the class, the
wizard ignores the entire class and all of its methods, even if you do not deselect the methods. If you
select a class but do not select any methods in that class, the wizard generates a test case for the
class, but does not generate any test methods for that class.
See Also
Unit Testing Overview ( see page 70)
Use this wizard page to supply the details for the test case you want to create.
Item Description
Test Project Specifies the name of the project. Prefilled with the default, which is the current project.
File Name Specifies the name of the code file containing the classes and methods you want to test. Prefilled
with the default, which is the current code file.
Test Framework Specifies the testing framework you want to use. RAD Studio auto-detects the type of project you are
testing and sets this to the correct framework that is currently supported for that code personality.
Base Class Specifies the base class to be inherited by the test. By default, the test case is built using the base
class of the active code file. Optional.
See Also
Unit Testing Overview ( see page 70)
3
3.2.9.3 Unit Test Project Wizard
File New Other Unit Tests Test Project
Use this wizard to create a test suite that includes a number of tests.
Item Description
Project Name Specify the name of the project or accept the default, which is the name of the active project.
816
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) NET_VS
See Also
Unit Testing Overview ( see page 70)
Use this wizard to specify the framework and test runner for your test project.
Item Description
Test Framework Specify the framework you want to use to build the test project. By default, this is set to NUnit for the
Delphi for .NET and C# personalities; for Delphi for Win32 and C++ this can only be DUnit. For the
C# personality, only NUnit is supported.
Test Runner Specify the test runner you want to use for running the test project. The GUI Test Runner is selected
by default. You can also choose the Console Test Runner, which causes the test project assembly to
contain a command to execute the console test runner from the framework directory.
See Also
Unit Testing Overview ( see page 70)
3.2.10 NET_VS
Topics
Name Description
Advanced Data Binding ( see page 818) This dialog is a component of the Microsoft .NET Framework.
Use this dialog to bind a property to a value from a valid data provider to a
Windows Form.
For more information, refer to the documentation resources on the Microsoft
Developer Network (MSDN).
AutoFormat ( see page 818) This dialog is a component of the Microsoft .NET Framework.
Use this dialog to apply a predefined format, including borders, colors, and fill
patterns, to a tabular control.
For more information, refer to the documentation resources on the Microsoft
Developer Network (MSDN).
Collection Editor ( see page 818) This dialog is a component of the Microsoft .NET Framework.
Use this dialog to create and edit individual members of a collection.
3
For more information, refer to the documentation resources on the Microsoft
Developer Network (MSDN).
Databindings ( see page 818) This dialog is a component of the Microsoft .NET Framework.
Use this dialog to bind to a data item and set formatting.
For more information, refer to the documentation resources on the Microsoft
Developer Network (MSDN).
Dynamic Properties ( see page 818) Use this dialog to set dynamic properties that can be changed in a configuration
file, without recompiling the application.
817
NET_VS RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Properties ( see page 819) This dialog is a component of the Microsoft .NET Framework.
Use this dialog to set properties for the currently selected object.
For more information, refer to the documentation resources on the Microsoft
Developer Network (MSDN).
Use this dialog to bind a property to a value from a valid data provider to a Windows Form.
For more information, refer to the documentation resources on the Microsoft Developer Network (MSDN).
3.2.10.2 AutoFormat
This dialog is a component of the Microsoft .NET Framework.
Use this dialog to apply a predefined format, including borders, colors, and fill patterns, to a tabular control.
For more information, refer to the documentation resources on the Microsoft Developer Network (MSDN).
For more information, refer to the documentation resources on the Microsoft Developer Network (MSDN).
3.2.10.4 Databindings
This dialog is a component of the Microsoft .NET Framework.
For more information, refer to the documentation resources on the Microsoft Developer Network (MSDN).
Item Description
3 Properties Check the properties that you want to add to the configuration file.
Key mapping Optionally, override the default key for the property that appears in the configuration file. This is
useful if you want to provide a more descriptive key for the property.
Note: Property values stored in a configuration file are not secure. Confidential information, such as passwords, should not be
stored as dynamic properties.
See Also
Introduction to Dynamic Properties
818
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
3.2.10.6 Properties
This dialog is a component of the Microsoft .NET Framework.
Use this dialog to set properties for the currently selected object.
For more information, refer to the documentation resources on the Microsoft Developer Network (MSDN).
3.2.11 Project
Topics
Name Description
ASP.NET Deployment Manager ( see page 821) To open the Deployment Manager, right-click the Deployment node in the
Project Manager, and then choose the New ASP.NET Deployment option. Use
this dialog box to automatically collect all of the .aspx, .asax, web.config, and
related assembly files that are needed to deploy your ASP.NET or IntraWeb
project.
Project Options ( see page 822)
COM Imports ( see page 846) Project Add Reference
Adds a COM type library to the current project.
The Add Reference dialog box is also available in the Project Manager by
right-clicking a References folder and choosing Add Reference.
C++ Project Options ( see page 847)
.NET Assemblies ( see page 900) Project Add Reference
Adds a .NET assembly reference to the current project.
The Add Reference dialog box is also available in the Project Manager by
right-clicking a References folder and choosing Add Reference.
Project References ( see page 901) Project Add Reference
Adds a reference to a project that produces an assembly (.dll), such as a Class
Library or Control Library. The reference will be added to the current project.
The Add Reference dialog box is also available in the Project Manager by
right-clicking a References folder and choosing Add Reference.
Add to Repository ( see page 901) Project Add to Repository
Saves a customized form or project template in the Object Repository for reuse
in other projects. The saved forms and templates are then available in the New
Items dialog box when you choose File New Other.
UDDI Browser ( see page 902) Project Add Web Reference
Searches for services and providers in the UDDI services sites with WSDL
described services. Search by name or browse through available categorization
schemas.
Change Package ( see page 902) Adds required units to your package. This dialog box appears when the Package
Editor tries to compile a package and detects that the package cannot be built,
or is incompatible with another package currently loaded by the IDE. This occurs
because the package uses one or more units that are found in another package.
Project Dependencies ( see page 903) Project Dependencies
Creates project dependencies within a project group. From the list, choose the
projects to build before building the selected project.
3
Add Languages ( see page 903) Project Languages Add Language
Adds one or more language resource DLLs to a project. Follow the instructions
on each wizard page.
Remove Language ( see page 903) Project Languages Remove Language
Removes one or more languages from the project. Follow the instructions on
each wizard page.
819
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Set Active Language ( see page 903) Project Languages Set Active Language
Determines which language module loads when you run your application in the
IDE. Before changing the active language, make sure you have recompiled the
satellite assembly for the language you want to use.
Select the desired language and click Finish.
New Category Name ( see page 904) Tools Repository Edit button New Category button
Use this dialog box to assign a name to a new category in the Object
Repository.
Information ( see page 904) Project Information
Views the program compilation information and compilation status for your
project.
Project Page Options ( see page 904) Project Project Page Options
Specifies an HTML file in your project as the Project Page for recording a
description of the project, and various other notes and information. This page is
automatically displayed in the IDE when you open the project.
Remove from Project ( see page 904) Project Remove from Project
Removes one or more files from the current project.
Options ( see page 905) Project Manager Right-click a satellite assembly Options command
Sets the assembly linker (al.exe) options for the satellite assembly selected in
the Project Manager.
Select Icon ( see page 906) Selects a bitmap to represent your template in the New Items dialog box.
You can use a bitmap of any size, but it will be cropped to 60 x 40 pixels.
Web Deploy Options ( see page 906) Project Web Deploy Options
Configures a finished ActiveX control or ActiveForm for deployment to a Windows
Web server.
Tip: Set these options before you compile the ActiveX project and deploy it by
choosing Project->Web Deploy.
Build All Projects ( see page 907) Project Build All Projects
Compiles all of the source code in the current project group, regardless of
whether any source code has changed. Building is useful when you are unsure
which files have changed, or if you have changed project or compiler options.
Build Project ( see page 908) Project Build Project
Rebuilds all files in your current project regardless of whether they have
changed. Building is useful when you are unsure which files have changed, or if
you have changed project or compiler options.
Compile and Make All Projects ( see page 908) Project Compile
Project Make All Projects
Compile (for Delphi) and Make (for C++ ) compiles only those files that have
changed since the last build, as well as any files that depend on them. Compiling
or making does not execute the application (see Run Run).
Add to Project ( see page 908) Project Add to Project
Adds another source file to an already open project.
Add New Project ( see page 909) Project Add New Project
Adds new projects via the New Items dialog box .
Clean Package ( see page 909) Project Clean Package
Removes previously compiled files and leaves behind only the source files
needed to build the project. Specifically , it cleans out any .dcu's, .bpl's, etc., that
were generated.
Default Options ( see page 909) Project Default Options
Opens the default Project Options dialog box for the specified project type: C++
Builder, Delphi for Win32, Delphi for .NET, C# Builder, and Basic Builder. This
option is only available when there is not an open project.
After the Project Options dialog opens help is available from each page of the
dialog. Click Help or press F1.
3 Options ( see page 909) Project Options
Opens the Project Options dialog that manages application and compiler
options for your project. Making changes to your project only affects the current
project. However, you can also save your selections as the default settings for
new projects.
Syntax Check for Project ( see page 910) Project Syntax Check for Project
Checks the active project for incorrect symbols. This is an efficient way to check
and see if a large project will build correctly prior to compiling. Errors are reported
in the Compiling dialog with details shown in the Messages pane.
820
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Update Localized Projects ( see page 910) Project Languages Update Localized Projects
Updates resource modules. When you add an additional resource, such as a
button on a form, you must update your resource modules to reflect your
changes. Build and save your project before you update the resources.
View Source ( see page 910) Project View Source
Shows the source of the project file that manages the running of the application.
Dephi and Delphi .NET show a .dpr file. C++ shows .cpp file.
Deployment Page
Specifies file locations and status of Source and Destination files for your ASP.NET deployment.
Item Description
Source Directory Displays the directory where your project is located.
Destination Choose a target for your deployment, either a folder location or an FTP location. The target is the
directory where your executable, .dlls, mark-up files, configuration, and other files that are necessary
to run your application will be located.
• If you choose Folder Location, the Browse for Folder dialog box is displayed. To change a
folder location you have chosen, click the button with the ellipsis label (...) to browse again.
• If you choose FTP Location, the FTP Connection Options dialog box is displayed.
Source Files Lists most of the files that you need to include in your deployment directory (such as mark-up files,
executables, and config files).
Note: You may need to open the References node for your project (in the Project Manager) and set
the Copy Local option to True for some of the .dll files, before you can add them to your project.. (For
instance, if you're using BDP, you will have to do this with the Borland.Data.Common.dll and
Borland.Data.Provider.dll files.) After you have set the Copy Local option, recompile your project.
Now these additional files will show up in the Source list.
To add database-specific drivers, right-click the References node for your project, and then select the
Add References option. Choose the driver that corresponds to the database you are using.
Status Displays the status of the files that you are going to deploy. Before you deploy the files, their satus is
Not Connected. After you select a target destination, the status of these files will change to New.
Destination Files Specifies the target destination for your application deployment and displays files that are already
present at that destination.
To move files from the Source Files list to the Destination Files list, right-click the file name, and
choose either Copy Selected File(s) to Destination, or Copy All New and Modified Files to the Source
Destination. You can also use the icons in the center gutter to copy files to and delete files from the
destination list.
Status Displays the status of the files that you are deploying. After you deploy your application, the files are
listed with a status of Current. 3
Item Description
Refresh Re-display the lists, after changes have been made.
821
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Copy Selected File(s) Copy all of the specified Source files to the Destination directory.
to Destination
Delete Selected Delete the selected files from the Destination list.
Destination File(s)
Change Destination Change the name of a Destination file.
Filename
Copy All New and Copy all of the specified Source files to the Destination directory.
Modified Files to
Destination
Delete All Destination Delete all files from the destination list, that are not included in the project.
Files Not in Project
Show Assembly When selected, the Deployment Manager shows all of the assemblies referenced by the project. The
References system assemblies are shown, but disabled (grayed). These disabled assemblies can't be deployed.
External Files... Allows you to pick the external files that you want to deploy. The External Files dialog box appears,
with a list of check boxes. This list includes the BDP database libraries and the database-specific
libraries, since these often need to be deployed with your ASP.NET application. You can add more
files to the list using a File Open dialog. The list has a column that indicates the destination
subdirectory for each external file. You can edit this destination. Check the boxes next to the libraries
that you want to add to your application deployment, and then click the Add button.
Show Ignored Groups Display group and files that you have previously chosen to ignore.
and Files
Ignore Groups Choose groups to filter out of the reference list.
Ignore Files Choose files to filter out of the reference list.
Enable Logging Create a log of your application deployment.
View Log View the log created during the deployment of your project.
See Also
Deploying ASP.NET Applications
822
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Add Symbol Table Search Path ( see page 826) Project Options Symbol Table New
Use this dialog box to specify a new module name and path to be added to the
list of symbols tables to be used during debugging. The module name and path
are added to the list on the Symbol Tables page of the Project Options dialog
box.
Application ( see page 826) Project Options Application
Use this dialog box to change the name and type of the current Delphi for .NET
application.
Application ( see page 827) Project Options Application
Use this dialog box to change the name and type of the current application.
Note: Not all of the options described below are available for all types of
projects. For instance, the LIB attribute options are not available for all projects.
823
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Debugger Symbol Tables ( see page 845) Project Options Debugger Symbol Tables
Use this dialog box to specify the location of the symbols tables to be used
during debugging. This dialog is also available from Run Parameters.
Version Info ( see page 845) Project Options Version Info
Use this dialog box to specify version information for a Delphi Win32 project.
When version information is included, a user can right-click the program icon and
select properties to display the version information.
Use this dialog box to specify and configure your server and its virtual root directory for your ASP.NET application.
Item Description
Location Specify the root directory of your ASP.NET application.
Alias Specify the name used to gain access to the virtual directory.
Read Allows the Web Server to execute scripts.
Run scripts Allows application execution for ISAPI or CGI type applications.
Execute Allows you to upload files to the directory.
3 Write Check this box to enable Write permissions.
Browse Allows you to access list of files and directories.
824
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Use this dialog box to specify a path and port number to the Cassini Web Server. The dialog appears only when you have not
configured Cassini using Tools Options ASP NET Options.
Item Description
Path Indicate the path to the Cassini Web Server executable. To search for the executable file, click the
elipse (...).
Port Indicate the TCP/IP port used by the Cassini Web server.
Note: If you do not have access to the Cassini Web Server, you can download the server from
http://www.asp.net/Projects/Cassini/Download.
Use this dialog box to setup debugger options for your ASP.NET applications.
Item Description
Launch Browser Select the check box to automatically launch a web browser when the Run or Run without
Debugging command is executed.
Start Page Display the .asp file to be launched from a web browser.
HTTP Address Specify the web location of the specified .asp file.
Host with Web Server Select the check box to run the application under a web server when the Run or Run without
Debugging command is executed.
Server Indicate the default Web Server for new Web applications.
Virtual Directory Specify the application root directory.
Server Options Display the Configure Virtual Directory dialog box.
Default Saves the current project settings as the default settings for new projects.
Use this dialog box to navigate to a design time package and add it to the Design packages list.
Use this dialog box to add a runtime package to the Design packages list.
3
Item Description
Package Name Type the name of the package to add to the Runtime Packages list, or click the Browse button to
search for the package using the Package File Name dialog. If the package is in the Search Path, a
full path name is not required. (If the package directory is not in the Search Path, it is added at the
end.)
825
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Search Path If you haven't included a full directory path in the Package Name edit box, make sure the directory
where your package resides is in this list. If you add a directory in the Search Path edit box, you are
changing the global Library Search Path. Click [...] to get an ordered list of search paths that you can
edit. You can also change the path list in this field.
Use this dialog box to specify a new module name and path to be added to the list of symbols tables to be used during
debugging. The module name and path are added to the list on the Symbol Tables page of the Project Options dialog box.
Item Description
Module Name The name of the module to be added to the list of symbol tables. If the Load all symbols option is
checked, all symbols are loaded and the list of modules is ignored. If the Load all symbols option is
not checked, you can add the names of modules that the debugger will look for when loading symbol
tables. Note that if you specify Load unspecified options, then only those in that list are not loaded.
The string is interpreted as a module file name (such as foo.dll). This string can contain wildcards to
specify multiple modules. For example, you can specify *core*.bpl to indicate modules such as
oldcore1.bpl, newcore2.bpl, and so on.
Symbol Table Path One or more directories containing the module to be added to the list of symbol tables. If you specify
multiple directories for a module, use a semicolon to separate them. Click the ... button to display the
Directory List dialog, where you can choose a directory.
See Also
Overview of Debugging ( see page 10)
Setting the Search Order for Debug Symbol Tables ( see page 129)
3.2.11.2.7 Application
Project Options Application
Use this dialog box to change the name and type of the current Delphi for .NET application.
Item Description
Debug/Release Indicates the current set of project options. By default, the distributed Debug and Release option sets
have settings appropriate for debugging and deploying an application, respectively. The option sets
provide an easy way to change project options based on your development activity. To create a
user-defined option set, use the Save as button.
Save as Displays a dialog box for naming and saving a user-defined set of project options.
3 Delete Deletes the current option set. Only user-defined option sets can be deleted. The distributed Debug
and Release option sets can not be deleted.
Windows executable Creates a Windows executable next time you run the application. This option does not alter your
code.
Console executable Creates a console executable next time you run the application. This option does not alter your code.
Assembly Creates an assembly next time you run the application. This option does not alter your code.
826
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Application Name Indicates the current name of the executable. By default, the project name is used as the executable
name. To change the name, enter a new name in this field.
Startup object Specify the class that contains the Main method to be used as the entry point for the program. This is
useful is if your program contains more than one class with a Main method.
Default namespace Specify the default namespace to be used for items that you add to the project by using the New
Items dialog box. By default, the project name (without the extension) is used as the default
namespace.
Application icon Specify an icon (.ico) file to be inserted into the output file. The icon will be displayed next to the
output file in Windows Explorer.
3.2.11.2.8 Application
Project Options Application
Use this dialog box to change the name and type of the current application.
Note: Not all of the options described below are available for all types of projects. For instance, the LIB attribute options are not
available for all projects.
827
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Option Set File Navigates to the named option set. file. Click [...] to display a file selection dialog.
Action You have three choices for how you apply values: Overwrite, Replace, or Preserve.
Overwrite replaces the current configuration with the values from the option set entirely. That is, the
values from the option set overwrite the current configuration and all other option values are set to
their defaults. You get exactly the same configuration as when the option set was originally saved.
Replace writes all the values from the option set to the current configuration, but no other values are
changed. The values in the option set replace the current values, giving priority to the option set.
Preserve writes only the values from the option set that are not already set in the active
configuration. If the active configuration changed any of the values from their default values, they are
not changed. This gives priority to the configuration.
See Also
Working with Named Option Sets ( see page 113)
Item Description
Configuration Name Displays the names of the named build configurations. The two default configurations (Debug and
Release) are listed, along with the build configurations you have created and named on the
Project Options dialog box.
Available Projects Lists the names of your projects, the active configuration associated with each project, and the path
to the project. To apply the named build configuration listed in Configuration Name, select a project
or projects and click Apply.
dialog box. You can save options on several pages of this dialog box to a named configuration. The Compiler, Compiler
Messages, Linker, and Directories/Conditionals pages each contain a Configuration field.
See Also
MSBuild Overview ( see page 4)
828
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Use the Build Events dialog box to add events for the pre-build, pre-link and post-build stages. Results of the commands you
specify in this dialog box are displayed in the Output pane. To control the level of output, choose
Tools Options Environment Options and adjust the Verbosity level.
Note: Some of the build options are not available for some project types.
Item Description
Pre-Build Enter the commands in the Commands: window that are to be performed before the rest of the build.
To display the Events List dialog box for creating a command list, click Edit.
Pre-Link For C++ only. Enter the commands in the Commands: window that are to be performed before
linking. To display the Events List dialog box for creating a command list, click Edit.
Post-Build Enter the commands in the Commands: window that are to be performed after the build has
completed. To display the Events Listdialog box for creating the command list, click Edit.
See Also
Pre-Build Event or Post-Build Event Dialog Box ( see page 844)
3.2.11.2.12 Compiler
Project Options Compiler
Use this dialog box to set the C# compiler options for the current project.
Item Description
Debug/Release Indicates the current set of project options. By default, the distributed Debug and Release option sets
have settings appropriate for debugging and deploying an application, respectively. The option sets
provide an easy way to change project options based on your development activity. To create a
user-defined option set, use the Save as button.
Save as Displays a dialog box for naming and saving a user-defined set of project options.
Delete Deletes the current option set. Only user-defined option sets can be deleted. The distributed Debug
and Release option sets can not be deleted.
Optimization Enables optimizations performed by the compiler to make your output file smaller, faster, and more
efficient. This option also tells the common language runtime to optimize code at runtime.
Corresponds to /optimize.
Allow unsafe code Allows code that uses the unsafe keyword to compile.
Corresponds to /unsafe.
3
Treat warnings as Reports all warnings as errors. Any messages that would ordinarily be reported as warnings are
errors instead reported as errors, and the build process is halted (no output files are built).
Corresponds to /warnaserror.
829
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Warning level Specifies the warning level for the compiler to display.
0 Suppresses all warning messages.
1 Displays severe warning messages.
2 Displays level 1 warnings plus certain less severe warnings, such as warnings about hiding class
members.
3 Displays level 2 warnings plus certain less severe warnings, such as warnings about expressions
that always evaluate to true or false.
4 Displays all level 3 warnings plus informational warnings.
Corresponds to /warn. The default is 4.
Debug information Causes the compiler to generate debugging information and place it in a program database file
(.pdb) the next time you compile the application.
• None — No debugging information will be available.
• Full — Enables attaching a debugger to the running program.
• PDB only — Allows source code debugging when the program is started in the debugger but will
only display assembler when the running program is attached to the debugger.
Corresponds to /debug. The default is Full for the Debug configuration, or PDB Only for the Release
configuration.
Target platform Specifies which version of the common language runtime (CLR) can run the assembly.
• Any CPU — Compiles your assembly to run on any platform.
• x86 — Compiles your assembly to be run by the 32-bit, x86-compatible common language
runtime.
• x64 — Compiles your assembly to be run by the 64-bit common language runtime on a computer
that supports the AMD64 or EM64T instruction set.
Corresponds to /platform. The default is x86 for the Debug configuration, or Any CPU for the
Release configuration..
Base address Specifies the preferred base address at which to load the DLL. The default base address for a DLL is
set by the .NET Framework common language runtime. This address can be specified as a decimal
or hexadecimal number.
Corresponds to /baseaddress.
File alignment Specifies the alignment used for output file sections. Choose a value (in bytes) that specifies the size
of sections in the output file. Choices are 512, 1024, 2048, 4096, and 8192 bytes.
Corresponds to /filealign. There is no fixed default. If /filealign is not specified, the CLR picks a default
at compile time.
Generate XML Processes documentation comments in the code and creates an XML file named ProjectDoc.xml
documentation in the same directory as the project file (.csproj for MSBuild format).
Lines beginning with /// and preceding a user-defined type such as a class, delegate, or interface; a
member such as a field, event, property, or method; or a namespace declaration can be processed
as comments and placed in the file.
Corresponds to /doc.
3 Do not reference Prevents the import of mscorlib.dll, which defines the entire System namespace. Use this option if
mscorlib.dll you want to define or create your own System namespace and objects.
Corresponds to /nostdlib.
Generate overflow Specifies whether an integer arithmetic statement that is not in the scope of the checked or
checks unchecked keywords and that results in a value outside the range of the data type shall cause a
run-time exception.
Corresponds to /checked.
830
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Codepage Specifies the codepage to use during compilation if the required page is not the current default
codepage for the system.
If you compile one or more source code files that were not created to use the default code page on
your computer, you can use this option to specify which code page should be used. This option
applies to all source code files in your compilation.
If the source code files were created with the same codepage that is in effect on your computer or if
the source code files were created with UNICODE or UTF-8, you need not use this option.
Corresponds to /codepage.
Language version Specifies whether the compiler will only accept syntax that is included in the ISO/IEC 23270:2003 C#
language specification.
Corresponds to /langversion. The default is to accept all valid language syntax
window when you compile a project, choose Tools Options Environment Options and select the Show command line
option. The next time you compile a project, the command used to compile the project will be displayed in the Messages
window.
3.2.11.2.13 Compiler
Project Options Compiler
Use this page to set the compiler options for the current project.
Note: Not all of the options described below are available for all types of projects.
831
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Pentium-save FDIV Delphi for Win32 only. Controls generation of floating-point code that guards against the flawed FDIV
instruction exhibited by certain early Pentium processors. Windows 95, Windows NT 3.51, and later
Windows OS versions contain code that corrects the Pentium FDIV bug system-wide. When enabled
(equivalent to {$U+}), all floating-point divisions are performed using a runtime library routine. The
first time the floating-point division routine is invoked, it checks whether the processor's FDIV
instruction works correctly, and updates the TestFDIV variable (declared in the System unit)
accordingly. For subsequent floating-point divide operations, the value stored in TestFDIV is used to
determine what action to take.
-1 means that FDIV instruction has been tested and found to be flawed.
0 means that FDIV instruction has not yet been tested.
1 means that FDIV instruction has been tested and found to be correct.
For processors that do not exhibit the FDIV flaw, enabling this option results in only a slight
performance degradation. For a flawed Pentium processor, floating-point divide operations may take
up to three times longer in the enabled state but always produce correct results. In the disabled
(equivalent to {$U-}) state, floating-point divide operations are performed using in-line FDIV
instructions. This results in optimum speed and code size, but may produce incorrect results on
flawed Pentium processors. You should use the disabled state only in cases where you are certain
that the code is not running on a flawed Pentium processor.
Record field alignment Controls alignment of fields in Delphi record types and class structures.
If you select option 1 (equivalent to {$A1}) or disable the option (equivalent to {$A-}), fields are never
aligned. All record and class structures are packed.
If you select 2 (equivalent to {$A2}), fields in record types that are declared without the packed
modifier and fields in class structures are aligned on word boundaries.
If you select option 4 (equivalent to {$A4}), fields in record types that are declared without the packed
modifier and fields in class structures are aligned on double-word boundaries.
If you select 8 (equivalent to {$A8} or {$A+}), fields in record types that are declared without the
packed modifier and fields in class structures are aligned on quad word boundaries. Regardless of
the state of the $A directive, variables and typed constants are always aligned for optimal access. By
setting the option to 8, execution is faster.
Codepage Enter the codepage for your application's language. Codepage is a decimal number representing a
specific character encoding table, and there are standard values for various languages.
832
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Extended syntax Provided for backward compatibility. You should not use this option (equivalent to {$X-} mode) when
writing Delphi applications. This option enables or disables Delphi's extended syntax:
Function statements. In the {$X+} mode, function calls can be used as procedure calls; that is, the
result of a function call can be discarded, rather than passed to another function or used in an
operation or assignment. Generally, the computations performed by a function are represented
through its result, so discarding the result makes little sense. Sometimes, however, a function is
called because it performs a task such as setting the value of a global variable, without producing a
useful result.
The Result variable. When enabled (equivalent to {$X+}, the predefined variable Result can be used
within a function body to hold the function's return value.
Null-terminated strings. When enabled, Delphi strings can be assigned to zero-based character
arrays (array[0..X] of Char), which are compatible with PChar types.
Typed @ operator Controls the types of pointer values generated by the @ operator and the compatibility of pointer
types. When disabled (equivalent to {$T-}), the result of the @ operator is always an untyped pointer
(Pointer) that is compatible with all other pointer types. When @ is applied to a variable reference in
the enabled (equivalent to {$T+}), the result is a typed pointer that is compatible only with Pointer and
with other pointers to the type of the variable. When disabled, distinct pointer types other than Pointer
are incompatible (even if they are pointers to the same type). When enabled, pointers to the same
type are compatible.
Open parameters Meaningful only for code compiled supporting huge strings, and is provided for backwards
compatibility with early versions of Delphi and CodeGear Pascal. This option, (equivalent to $P)
controls the meaning of variable parameters declared using the string keyword in the huge strings
disabled (equivalent to {$H-}) state. When disabled (equivalent to {$P-}), variable parameters
declared using the string keyword are normal variable parameters, but when enabled (equivalent to
{$P+}), they are open string parameters. Regardless of the setting of this option, the openstring
identifier can always be used to declare open string parameters.
Huge strings Delphi for Win32 only. This option (equivalent to the $H directive) controls the meaning of the
reserved word string when used alone in a type declaration. The generic type string can represent
either a long, dynamically-allocated string (the fundamental type AnsiString) or a short, statically
allocated string (the fundamental type ShortString). By default, Delphi defines the generic string type
to be the long AnsiString.
All components in the component libraries are compiled in this state. If you write components, they
should also use long strings, as should any code that receives data from component library
string-type properties. The disabled (equivalent to {$H-}) state is mostly useful for using code from
versions of Delphi that used short strings by default. You can locally override the meaning of
string-type definitions to ensure generation of short strings. You can also change declarations of short
string types to string[255] or ShortString, which are unambiguous and independent of the enabled
option.
Assignable typed Controls whether typed constants can be modified or not. When enabled (equivalent to {$J+}), typed
constants constants can be modified, and are in essence initialized variables. When disabled (equivalent to
{$J-}), typed constants are truly constant, and any attempt to modify a typed constant causes the
compiler to report an error. Writable consts refers to the use of a typed const as a variable modifiable
at runtime.
Old source code that uses writable typed constants must be compiled with this option enabled, but for
new applications it is recommended that you use initialized variables and compile your code with the
option disabled.
3
833
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
834
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Assertions Enables or disables the generation of code for assertions in a Delphi source file. The option is
enabled (equivalent to {$C+}) by default. Since assertions are not usually used at runtime in shipping
versions of a product, compiler directives that disable the generation of code for assertions are
provided. Uncheck this option to disable assertions.
Use Debug The debug DCUILs (.NET) or DCUs (Win32) contain debug information and are built with stack
DCUIL/DCUs frames. When this option is checked, the compiler prepends the debug DCUIL/DCU path to the unit
search path specified in Debug Source Path on the Directories/Conditionals page.
window when you compile a project, choose Tools Options Environment Options and select \ Show command line. The
next time you compile a project, both the command used to compile the project and the response file are displayed in the
Messages window. The response file lists the compiler options and the files to be compiled.
See Also
Compiling ( see page 2)
Use this page to control the information that the compiler provides at compile time.
Item Description
Build Configuration Displays the current named build configuration associated with the options on this page. There are
two default build configurations: Debug and Release. To create additional build configurations, enter
a name in this field and click Save As. To delete the named build configuration displayed in this field,
click Delete.
Show hints Enables hints during compile time.
Show warnings Enables warnings during compile time. 3
Warnings Allows you to select which warnings are displayed during compile time.
Default Saves the current settings as the default for each new project.
See Also
Compiler Errors ( see page 311)
835
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this dialog box to set the Visual Basic compiler options for the current project. For additional information about the Visual
Basic compiler options, see the .NET Framework SDK online Help.
Item Description
Debug/Release Indicates the current set of project options. By default, the distributed Debug and Release option sets
have settings appropriate for debugging and deploying an application, respectively. The option sets
provide an easy way to change project options based on your development activity. To create a
user-defined option set, use the Save as button.
Save as Displays a dialog box for naming and saving a user-defined set of project options.
Delete Deletes the current option set. Only user-defined option sets can be deleted. The distributed Debug
and Release option sets can not be deleted.
Debug information Causes the compiler to generate debugging information and place it in a program database file (.pdb)
the next time you run the application.
Corresponds to /debug.
Optimization Enables optimizations performed by the compiler to make your output file smaller, faster, and more
efficient. This option also tells the common language runtime to optimize code at runtime.
Corresponds to /optimize.
Treat warnings as Treats all warnings as errors. Any messages that would ordinarily be reported as warnings are
errors instead reported as errors, and the build process is halted (no output files are built).
Corresponds to /warnaserror.
Show warnings Generates compiler warnings.
Corresponds to /nowarn.
Conditional Defines Enter symbols referenced in conditional compiler directives. Separate multiple symbols with
semicolons.
Output Directory Specifies where the compiler will put the executable file.
Corresponds to /out.
window when you compile a project, choose Tools Options Environment Options and select the Show command line
option. The next time you compile a project, the command used to compile the project and the response file will be displayed in
the Messages window. The response file lists the compiler options and the files to be compiled.
3.2.11.2.16 Components
Project Options Packages Components button
3 Use this dialog box to display the components in the selected package, along with the icons that represent the components in
the Tool Palette if the package is installed.
3.2.11.2.17 Debugger
Project Options Debugger
Use this dialog to pass command-line parameters to your application, specify a host executable for testing a DLL, or load an
836
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
executable into the debugger. This dialog is also available from Run Parameters.
Item Description
Host Application Specifies the path to an executable file. (Click Browse to bring up a file-selection dialog.) If the
current project is a DLL or package, use this edit box to specify a host application that calls it. You
can also enter the name of any executable that you want to run in the debugger. If you want to run
the project that you have open, there is no need to enter anything in Host Application.
Parameters Specifies the command-line parameters to pass to your application. Enter the command-line
arguments you want to pass to your application (or the host application) when it starts. You can use
the drop-down button to choose from a history of previously specified parameters.
Working Directory Specifies name of the directory to use for the debugging process. By default, this is the same
directory as the one containing the executable of your application.
Source Path Specifies the directories containing the source files. By default, the debugger searches paths defined
by the compiler. If the directory structure has changed since the last compile or if the debugger
cannot find a source file, a path can be entered here to include the file in the debugging session.
Click the ellipsis button to display a dialog box that allows you to edit an ordered list of directory
source paths Additional directories are searched in the following order:
1. Debug Source path (this option).
2. The Browsing path, as specified for Delphi for Win32 or .NET or for C++:
— For Delphi for Win32, the Tools Options Environment Options Delphi Options Library
— Win32 page.
— For Delphi.NET, the Tools Options Environment Options Delphi Options Library —
NET page.
— For C++,Tools Options Debugger Options Borland Debuggers page.
3. Debug Source path, specified on the Tools Options Debugger Options Borland
Debuggers page.
Note: The Browsing path is not used for C# or Visual Basic.
Default Saves the current settings as the default for each new project.
3.2.11.2.18 Description
Project Options Description
Use the Description page to specify a description for the package, the uses of the package, and how the package is built.
837
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
3.2.11.2.19 Directories/Conditionals
Project Options Directories/Conditionals
Use this page to set your directory and conditional defines paths for C# and VB.
Item Description
Debug/Release Indicates the current set of project options. By default, the distributed Debug and Release option sets
have settings appropriate for debugging and deploying an application, respectively. The option sets
provide an easy way to change project options based on your development activity. To create a
user-defined option set, use the Save as button.
Save as Displays a dialog box for naming and saving a user-defined set of project options.
Delete Deletes the current option set. Only user-defined option sets can be deleted. The distributed Debug
and Release option sets cannot be deleted.
Conditional Defines Enter symbols referenced in conditional compiler directives. Separate multiple symbols with
semicolons.
Corresponds to the /define compiler switch for both C# and VB.
Output directory Specifies where the compiler should put the executable file. Corresponds to the /out compiler switch
for both C# and VB.
3 Default Saves the current settings as the default for each new project.
3.2.11.2.20 Directories/Conditionals
Project Options Directories/Conditionals
Use this page to set your directory and conditional defines paths. You can also set the namespace prefix, to simplify your uses
clause.
838
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Item Description
Build Configuration Displays the current named build configuration associated with the options on this page. There are
two default build configurations: Debug and Release. To create additional build configurations, enter
a name in this field and click Save As. To delete the named build configuration displayed in this field,
click Delete.
Output directory Specifies where the compiler should put the executable file.
Unit output directory Specifies a separate directory to contain the .dcu (Win32) or .dcuil (.NET) files.
Search path Specifies the location of your source files. Only those files on the compiler's search path or the library
search path are included in the build. If you try to build your project with a file not on the search path,
you will receive a compiler error. You must include the entire search path.
Separate multiple directory path names with a semicolons. Whitespace before or after the semicolon
is allowed but not required. Relative and absolute path names are allowed, including path names
relative to the current position.
If you check the Use Debug DCUILs option on the Project Options Compiler page, the Debug
DCUIL path from Tools Debugger Options CodeGear .NET Debugger is prepended to this
search path.
Package output Specifies where the compiler puts generated package files.
directory
DCP/DCPIL output Specifies where the .dcp (Win32) or .dcpil (.NET) file is placed at compilation time. If left blank,
directory the global DCP/DCPIL output directory specified in the Tools Options Environment
Options Delphi Options Library page is used instead.
Conditional defines Specify the symbols referenced in conditional compiler directives. Separate multiple defines with
semicolons.
Unit aliases Useful for backwards compatibility. Specify alias names for units that may have changed names or
were merged into a single unit. The format is <oldunit>=<newunit> (for example,
Forms=Xforms). Separate multiple aliases with semicolons.
The default value for Delphi is WinTypes=Windows;WinProcs=Windows.Default.
Namespace prefixes Specifies the prefixes for namespaces, to allow you to create a shorthand version of the namespace
in the uses clause in your code file. For example, instead of writing Borland.Vcl.DB, you could
specify Borland.Vcl as your namespace prefix. In the uses clause, you could then specify uses
DB;.
Default Namespace Indicates the default namespace used for all units in the project.
Default Saves the current settings as the default for each new project.
Use this page to indicate which environment variables are passed to your application while you are debugging it. This page is
also available by choosing Run Parameters.
Item Description 3
System variables Lists all environment variables and their values defined at a system level. You cannot delete an
existing system variable, but you can override it.
Add Override... Displays the Override System Variable dialog box, allowing you to modify an existing system
variable to create a new user override. This button is disabled until you select a variable in the
System variables list.
User overrides Lists all defined user overrides and their values. A user override takes precedence over an existing
system variable until you delete the user override.
839
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
New Displays the New User Variable dialog box allowing you to create new user override to a system
variable.
Edit Displays the Edit User Variable dialog box allowing you to change the user override currently
selected in the User overrides list.
Delete Deletes the user override currently selected in the User overrides list.
Include System Passes the system environment variables to the application you are debugging. If unchecked, only
Variables the user overrides are passed to your application.
Default Saves the current settings as the default for each new project.
3.2.11.2.22 Forms
Project Options Forms
Use this page to select the main form for the current VCL Forms project and to choose which of the available forms are
automatically created when your application begins.
Item Description
Main form: Indicates which form users see when they start your application. Use the drop-down list to select the
main form for the project. The main form is the first form listed in the Auto-create forms list box.
Auto-create forms: Lists the forms that are automatically added to the startup code of the project file and created at
runtime. These forms are automatically created and displayed when you first run your application.
You can rearrange the create order of forms by dragging and dropping forms to a new location. To
select multiple forms, hold down the SHIFT key while selecting the form names.
Available forms: Lists those forms that are used by your application but are not automatically created. If you want to
create an instance of one of these forms, you must call its Create method.
Arrow buttons Use the arrow buttons to move files from one list box to the other.
Default Saves the current settings as the default for each new project.
3.2.11.2.23 Linker
Project Options Linker
Note: Not all of the options described below are available for all types of projects.
840
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
3
Memory sizes items Description
Min stack size Indicates the initial committed size of the stack (only applicable to executable projects; disabled for
DLLs). Memory-size settings can also be specified in your source code with the $M compiler
directive.
841
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Max stack size Indicates the total reserved size of the stack (only applicable to executable projects; disabled for
DLLs). Memory-size settings can also be specified in your source code with the $M compiler
directive.
Image base Specifies the preferred load address of the compiled image. This value is typically only changed
when compiling DLLs.
In the left pane, click an item in a category to display its option page. If you leave the cursor over text describing an option, a tool
tip gives you an option description, its default value, and a switch for the option if one exists.
Each configuration, except the Base, is based on another configuration. In the Project Manager pane, the Build
Configurations node under the project represents the Base configuration. All configurations are listed under the Build
Configurations node in a hierarchical list that shows the parent-child relationship for each configuration.
If an option's value differs from its parent's configuration, its associated text is boldface. To revert to the parent configuration
value, right-click the option text and click Revert on the context menu. If you change option values, you can save your set of
changes in a new configuration or a named option set. You can switch to this configuration or load this option set into the active
configuration.
3
842
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
See Also
Apply Option Set dialog ( see page 828)
3.2.11.2.25 Packages
Project Options Packages 3
Use this page to specify the design time packages installed in the IDE and the runtime packages required by your project.
Item Description
Design packages Lists the design time packages available to the IDE and all projects. Check the design packages you
want to make available for your current project.
Add Installs a design time package. The package will be available to your current project.
843
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Remove Deletes the selected package. The package becomes unavailable for your current project.
Edit Opens the selected package in the Package Editor if the source code or .dcp file is available.
Components Displays a list of the components included in the selected package.
Runtime packages Determines which runtime packages to use when the executable file is created. Separate package
names with semicolons.
As packages are installed and uninstalled, the runtime package list is updated. The product
automatically adds runtime packages that are required by installed design time packages.
Build with runtime Dynamically links the runtime packages in your project and enables the runtime packages edit box.
packages
Ellipsis Displays Runtime Package dialog box, allowing you to specify the name of a runtime package to add
to the Runtime packages list.
Default Saves the current settings as the default for each new project.
Item Description
Execute when Executes the specified events always or only if the target is out of date. This option applies only to
Post-Build events.
Cancel build on error Cancels the project build if a command returns a nonzero error code.
Commands Specifies the commands to execute. Separate each command by a newline character.
Macros Lists macros available to use as command arguments. Clicking a macro places its text in the
Commands window at the cursor position.
3.2.11.2.27 Signing
Project Options Signing
Use the Signing dialog to sign the assembly produced by the project using the Microsoft Strong Name (SN) utility.
3
Item Description
Sign the assembly Use the Microsoft Strong Name utility to sign the assembly (executable, DLL, etc.) produced by the
project. Refer to the Microsoft .NET SDK for more information about signing.
Strong name key file Specifies the file with the signature. Click [...] to display a dialog to browse for the file.
Delay sign only Delay signing the assembly produced by the project. You would use this only if there is some post
build step you need to perform on the assembly. This is typically not checked, since failing to sign
prevents you from running or debugging the assembly.
844
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Warning: If you sign the assembly, delaying signing prevents you from running or debugging the assembly produced by the
project.
Use this dialog box to specify the location of the symbols tables to be used during debugging. This dialog is also available from
Run Parameters.
Item Description
Debug symbols search Specifies the directory containing the symbol tables used for debugging. This path is used if you
path: check the Load all symbols check box.
Load all symbols Sets the state of the Mappings from Module Name to Symbol Table Path list. If checked, the list is
disabled and all symbol tables are loaded by the debugger. The debugger uses the Debug symbols
search path to search for the symbol table file associated with each module loaded by the process
being debugged. If unchecked, the Mappings from Module Name to Symbol Table Pathlist is
enabled and its settings are used.
Mappings from Module Displays the current mapping of each module name to a symbol table search path that is defined for
Name to Symbol Table the project. Use the up and down arrows (to the right of the dialog) to move the selected item up or
Path down in the list. The debugger searches this list, in order, to find a match for the name of the module
being loaded. When the debugger finds a matching module name, it uses the corresponding path to
locate that module's symbol table.
For example, if module foo123.dll is loaded, and the list shows foo*.dll as the first item and *123.dll
as a later item, the debugger only uses the symbol table path for foo*.dll, even though both items
match the module being loaded.
Load symbols for Specifies whether symbol tables for modules not in the Mappings from Module Name to Symbol
unspecified modules Table Path list (either explicitly or via a file mask) are loaded during debugging. If checked, the
symbol tables for modules not specified are loaded using the Debug symbols search path. If
unchecked, symbol tables are loaded only for modules in the list.
New Displays the Add Symbol Table Search Path dialog, where you can specify a module name and an
associated search table path. The module and path are added to the Mappings from Module Name
to Symbol Table Path list. Note that you can add a blank path to prevent a symbol table for a
module from being loaded.
Edit Displays the selected module and path in the Add Symbol Table Search Path dialog, enabling you
to edit the module name or path that displays in the Mappings from Module Name to Symbol Table
Path list.
Delete Removes the selected module from the Mappings from Module Name to Symbol Table Path list.
Default Saves the current settings as the default for each new project.
See Also
Debugging Applications ( see page 10)
Use this dialog box to specify version information for a Delphi Win32 project. When version information is included, a user can
right-click the program icon and select properties to display the version information.
845
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Include version Determines whether the user can view product identification information.
information in project For this option to be available in console applications, you must add {$R *.res} to your project source.
Module version number Sets hierarchical nested version, release, and build identification.
Major, Minor, Release, and Build each specify an unsigned integer between 0 and 65,535. The
combined string defines a version number for the application, for example 2.1.3.5.
Check Auto-increment build number to increment the build number each time the Project Build
<Project> menu is selected. Other compilations do not change the build number.
Module attributes Indicates the intent of this version: whether for debugging, pre-release, or other purposes. Module
attributes can be included in the version information and are for informational use only. If a project is
compiled in debug mode, the debug flag is included in the version information. You can select each of
the remaining flags as needed.
Debug build Indicates that the project was compiled in debug mode.
Pre-release Indicates the version is not the commercially released product.
DLL Indicates that the project includes a dynamic-link library.
Special build Indicates that the version is a variation of the standard release.
Private build Indicates that the version was not built using standard release procedures.
Language Indicates which Code Page the user's system requires to run the application.
You can only choose a language that is listed in the Control Panel Regional Settings dialog of your
computer. Some versions of the Windows operating system do not include support for all languages
(such as Far Eastern languages), and you may need to install the appropriate Language Pack before
you can use those languages.
Key/Value list box Sets typical product identification properties.
Key entries can be edited by selecting the key and reentering the name. Key entries can be added by
right-clicking within the Key/Value table and selecting Add Key.
Default Saves the current settings as the default for each new project.
Tip: To obtain version information programmatically from your compiled Win32 application, use the Windows GetFileVersionInfo
and VerQueryValue API functions.
The Add Reference dialog box is also available in the Project Manager by right-clicking a References folder and choosing Add
Reference.
Item Description
TypeLib Name The name of the type library.
3
TypeLib Version The version of the type library.
TypeLib Path The location of the type library.
Add Reference Adds the selected (highlighted) reference to the New References list.
Browse Displays a dialog box allowing you to navigate to a type library.
Remove Removes the reference currently selected in the New References list from the list.
OK If the New References list contains any references, they are added to the project when you click OK.
846
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
3.2.11.4.1 ATL
Project Options ATL
Use this dialog box to specify ATL options. These options apply to every COM server in the project.
Item Description
3
Single Use An instance of the COM server object is created for each client.
Multiple Use All clients operate on a single instance of the COM server object.
APARTMENTTHREADED An object is referenced only by the thread in which it was constructed.
Use this option for projects that contain only single-threaded and apartment-threaded objects.
MULTITHREADED Objects can be referenced by any thread.
Use this option for projects that contain free-threaded, both-threaded, or neutral-threaded objects.
847
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Single All COM server objects are implemented using a single thread.
Apartment The project may be multi-threaded, but each instance of the COM server object must has its own
dedicated thread for OLE calls.
Free The project may be multithreaded and each instance of the COM server object can receive
simultaneous requests from multiple threads.
Your code must provide thread concurrency support.
Both Same as Free except that outgoing calls such as callbacks are guaranteed to execute in the same
thread.
Neutral Multiple clients can call the object on different threads at the same time, but COM ensures that no
two calls conflict.
Trace Query Interface Sends a message to the event log whenever a client makes a QueryInterface call. The event
log also shows the status of the call.
Check Ref Counts message is sent to the event log whenever the reference count of a COM server object is increased
or decreased. When Check Ref Counts is enabled, an assertion occurs if the project attempts to
release the object from memory with a nonzero reference count.
General Tracing Sends a messages to the event log when an ATL function is called.
options are provided only for backward compatibility. You now specify threading models on a per-object basis.
See Also
ATL Overview (MSDN)
C++ Compiler Optimizations ( see page 862) Project Options C++ Compiler Optimizations
Use this dialog box to set C++ Compiler Optimization options.
848
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
C++ Compiler Output ( see page 863) Project Options C++ Compiler Output
Use this dialog box to set C++ Compiler Output options.
C++ Compiler Paths And Defines ( see page 864) Project Options C++ Compiler Paths and Defines
Use this dialog box to set C++ Compiler Paths and Defines options.
C++ Compiler Precompiled Headers ( see page 865) Project Options C++ Compiler Precompiled headers
Use this dialog box to set C++ Compiler Precompiled headers options.
C++ Compiler Warnings ( see page 866) Project Options C++ Compiler Warnings
Use this dialog box to set C++ Compiler Warning options.
Use this dialog box to set C++ Compiler General Compilation options.
849
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Quiet floating point Use the quiet floating point instruction (FUCOMP). (Default = true)
compares (-fq)
850
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Use this dialog box to set specifically C++ Compiler Compatibility options.
These options provide backward compatibility with previous versions of the compiler. In general, these options should not be set
to true unless such compatibility is required. Their default value is false.
Note: There are several compatibility options that have switches beginning with -Vb
Switch Meaning
-Vb Turn on all -Vb switches. 3
-Vb+ Turn on all -Vb switches.
-Vb- Turn off all -Vb switches.
-Vb. Reset all -Vb switches.
-Vbe Allow old-style explicit template specialization.
-Vbn Allow calling a non-const member function for a const object.
851
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
852
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Old Borland class This is a backward compatibility switch that causes the C++ compiler to lay out derived classes the
layout (-VI) same way it did in older versions of C++Builder. Enable this option if you need to compile source files
that you intend to use with older versions of C++Builder (for example, if you need to work with a DLL
that you cannot recompile, or if you have older data files that contain hardwired class layouts).
Default = false
Push 'this' first (-Vp) Like Pascal, pushes 'this' first. The compiler typically pushes parameters on the stack from right to
left. Default = false
VTable in front (-Vt) Puts virtual table pointer at front of object layout. Default = false
'Slow' virtual base Uses 'slow' virtual base pointers. Default = false
pointers (-Vv)
Zero-length empty Usually the size of a data member in a class definition is at least one byte. When this option is
class member functions enabled, the compiler allows an empty structure of zero length. Default = false
(-Vx)
Zero-length empty Usually the size of a class is at least one byte, even if the class does not define any data members.
base class (-Ve) When you set this option, the compiler ignores this unused byte for the memory layout and the total
size of any derived classes; empty base classes do not consume space in derived classes. Default =
false
853
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
854
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
855
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this dialog box to set C++ compiler debugging and CodeGuard options.
Build Configuration Displays the active build configuration. Use the drop-down menu to select another build configuration.
Save As... Displays the Save As dialog box to save the current configuration's options to a file that can be
loaded as a named option set.
Load... Displays the Apply Option Set dialog box to apply the options in a named option set to the current
configuration.
CodeGuard(tm) Description
options
Enable all CodeGuard Enables all CodeGuard options, independent of CodeGuard level. Default = false
options (-vG)
856
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Monitor inline pointer This CodeGuard option generates calls to verify all accesses in your code. This option identifies
access (-vGc) almost all pointer errors. Program execution is typically five to ten times slower.
Selecting any of these CodeGuard options can have a noticeable effect on runtime performance.
Default = false
Monitor global and Creates data and stack layout descriptors for fast lookup by CodeGuard. These descriptors allow
stack data accesses CodeGuard to report overruns and invalid pointers to locals, globals, and statics. You should always
(-vGd) use this option. Default = false
Monitor 'this' pointer on Creates special epilogs for member functions, constructors, and destructors. CodeGuard verifies the
member function entry this pointer on entry to every method in C++ code. This option is useful because it reports calls to
(-vGt) methods of deleted or invalid objects even if the methods themselves do not access this. Default =
false
Note: If you want to turn both debugging and inline expansion on, use the -v and -vi options.
Use this dialog box to set C++ Compiler General Compatibility options.
Some of these options provide backward compatibility with previous versions of the compiler, and their default value is false. In
general, such options should not be set to true unless such compatibility is required.
Note: There are several compatibility options that have switches beginning with -Vb
Switch Meaning
-Vb Turn on all -Vb switches.
-Vb+ Turn on all -Vb switches.
-Vb- Turn off all -Vb switches. 3
-Vb. Reset all -Vb switches.
-Vbe Allow old-style explicit template specialization.
-Vbn Allow calling a non-const member function for a const object.
-Vbo Use old overload resolution rules.
-Vbr Allow non-const reference binding.
857
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this dialog box to set C++ Compiler General Compilation options.
858
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
859
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
860
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
This is the top-level node of the C++ Compiler command line options.
861
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Note: Options marked with an asterisk (*) on the options pages are the default values.
See Also
General Compilation ( see page 858)
862
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
863
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Generate underscores The compiler automatically adds an underscore character (_) in front of every global identifier
on symbol names (-u)* (functions and global variables) before saving them in the object module. Pascal identifiers (those
modified by the __pascal keyword) are converted to uppercase and are not prefixed with an
underscore.
Underscores for C and C++ are optional, but you should turn this option on to avoid errors if you are
linking with the CodeGear C++ libraries.
Default = true
Don't prefix underbars Do not prefix underscore characters to exported symbol names. Default = false
to exported symbols
(-vu)
Include browser Includes browser information in generated .OBJ files. Default = false
information .obj files
(-R)
Use this dialog box to set C++ Compiler Paths and Defines options.
864
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
.obj output directory (-n) Sets output directory to specified path. Click [...] to browse for a folder.
Windows version target Conditional defines targeting the highest version of Windows API header files to use. Choose an OS
version from the drop down list. See http://msdn2.microsoft.com/en-us/library/aa383745.aspx for
more information.
The default is “Not specified”.
Use this dialog box to set C++ Compiler Precompiled headers options.
Warning: If you import a project from BDS2006, it does not import the project's PCH file location due to Windows Vista
compatibility, since Vista restricts where users may place files.
865
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
3
Warnings options Description
Enable all (-w) Display all warning and error messages.
Disable all (-w-) Disable all warning and error messages
866
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Item Description
Location Specifies the path of the new folder node. The location can be an absolute path or a relative path.
You can click [...] to browse to a folder.
File Types Specifies the filter that you can use to hide unwanted files. By default, the File Types filter is *.*,
which displays all files.
Show Subdirectories Displays subdirectories in the folder node. If this option is disabled, only files are shown.
Resource Compiler Options ( see page 868) Project Options Resource Compiler Options
Use this dialog box to set Resource Compiler options.
Resource Compiler Paths And Defines ( see page 869) Project Options Resource Compiler Paths and Defines
Use this dialog box to set Resource Compiler Paths and Defines options.
This is the top-level node of the Resource Compiler command line options.
Note: Options marked with an asterisk (*) on the options pages are the default values. 3
867
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Load... Displays the Apply Option Set dialog box to apply the options in a named option set to the current
configuration.
See Also
Paths and Defines ( see page 869)
Options Description
Resource type Windows 3.1 (-31
Builds Windows 3.1-compatible .RES files.
16 bit (-16)
Builds a 16-bit resource.
32 bit (-32)*
Builds a 32-bit resource. This is the default.
Default language (-l) Specifies the default language. For example, —l409 represents English. See
http://msdn2.microsoft.com/en-us/library/ms776324.aspx for more information about specifying
language identifiers.
Code page (-c) Uses the specified code page for resource translation. If -c is not used, the default ANSI code page is
used.
Additional options Enter additional options for the resource compiler.
3 Ignore INCLUDE (-x) Ignore INCLUDE environment variable. Default = false
Verbose messages (-v) The linker emits detailed information messages. Default = false
Multi-byte character Multi-byte character support. Default = false
support (-m)
868
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Use this dialog box to set Resource Compiler Paths and Defines options.
3.2.11.4.5 DCC32
Topics
Name Description
Delphi Compiler Compiling ( see page 870) Project Options Delphi Compiler Compiling 3
Use this dialog box to set Delphi Compiler Compiling options.
Delphi Compiler ( see page 874) Project Options Delphi Compiler
This is the top-level node of the C++ Compiler command line options.
Note: Options marked with an asterisk (*) on the options pages are the default
values.
Delphi Compiler Other Options ( see page 875) Project Options Delphi Compiler Other Options
Use this dialog box to set Delphi Compiler Other options.
869
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Delphi Compiler Paths and Defines ( see page 876) Project Options Delphi Compiler Paths and Defines
Use this dialog box to set CodeGear Pascal Compiler Path and Define options.
Delphi Compiler Warnings ( see page 877) Project Options Delphi Compiler Warnings
Use this dialog box to set Delphi Compiler Warning options.
870
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Typed '@' operator Controls the types of pointer values generated by the @ operator and the compatibility of pointer
(-$T+) types. When disabled (equivalent to {$T-}), the result of the @ operator is always an untyped pointer
(Pointer) that is compatible with all other pointer types. When @ is applied to a variable reference in
the enabled (equivalent to {$T+}), the result is a typed pointer that is compatible only with Pointer and
with other pointers to the type of the variable. When disabled, distinct pointer types other than Pointer
are incompatible (even if they are pointers to the same type). When enabled, pointers to the same
type are compatible.
Default = false
Open string parameters Meaningful only for code compiled supporting huge strings, and is provided for backwards
(-$P+)* compatibility with early versions of Delphi and Borland Pascal. This option, (equivalent to $P) controls
the meaning of variable parameters declared using the string keyword in the huge strings disabled
(equivalent to {$H-}) state. When disabled (equivalent to {$P-}), variable parameters declared using
the string keyword are normal variable parameters, but when enabled (equivalent to {$P+}), they are
open string parameters. Regardless of the setting of this option, the openstring identifier can always
be used to declare open string parameters.
Default = true
Long strings by default Delphi for Win32 only. This option (equivalent to the $H directive) controls the meaning of the
(-$H+)* reserved word string when used alone in a type declaration. The generic type string can represent
either a long, dynamically-allocated string (the fundamental type AnsiString) or a short, statically
allocated string (the fundamental type ShortString). By default, Delphi defines the generic string type
to be the long AnsiString.
All components in the component libraries are compiled in this state. If you write components, they
should also use long strings, as should any code that receives data from component library
string-type properties. The disabled (equivalent to {$H-}) state is mostly useful for using code from
versions of Delphi that used short strings by default. You can locally override the meaning of
string-type definitions to ensure generation of short strings. You can also change declarations of short
string types to string[255] or ShortString, which are unambiguous and independent of the enabled
option.
Default = true
Writeable structured Controls whether typed constants can be modified or not. When enabled (equivalent to {$J+}), typed
constants (-$J+) constants can be modified, and are in essence initialized variables. When disabled (equivalent to
{$J-}), typed constants are truly constant, and any attempt to modify a typed constant causes the
compiler to report an error. Writeable consts refers to the use of a typed const as a variable
modifiable at runtime.
Old source code that uses writeable typed constants must be compiled with this option enabled, but
for new applications it is recommended that you use initialized variables and compile your code with
the option disabled.
Default = false
871
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Local debug symbols Enables or disables the generation of local symbol information. Local symbol information consists of
(-$L+)* the names and types of all local variables and constants in a module, that is, the symbols in the
module's implementation part and the symbols within the module's procedures and functions. For
units, the local symbol information is recorded in the unit file along with the unit's object code. Local
symbol information increases the size of unit files and takes up additional memory when compiling
programs that use the unit, but it does not affect the size or speed of the executable program. When
a program or unit is compiled with this option enabled (equivalent to {$L+}), the integrated debugger
lets you examine and modify the module's local variables. Furthermore, calls to the module's
procedures and functions can be examined by way of the View|Call Stack. The Include TD32 debug
info and Map file options (on the Linker page of the Project Options dialog) produce local symbol
information for a given module only if that module was compiled with this option set on. This option is
usually used in conjunction with the Debug information option, which enables and disables the
generation of line-number tables for debugging. This option is ignored if the compiler has the Debug
information option disabled.
Default = true
Assertions (-$C+)* Enables or disables the generation of code for assertions in a Delphi source file. The option is
enabled (equivalent to {$C+}) by default. Since assertions are not usually used at runtime in shipping
versions of a product, compiler directives that disable the generation of code for assertions are
provided. Uncheck this option to disable assertions. Default = true
Reference info None
Use no reference info.
Definitions only -$DEFINITIONINFO ON*
This is the default.
Reference info -$REFERENCEINFO ON
872
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
873
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Note: Options marked with an asterisk (*) on the options pages are the default values.
Options marked with an asterisk (*) on the options pages are the default values.
874
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
See Also
Paths and Defines ( see page 876)
875
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this dialog box to set CodeGear Pascal Compiler Path and Define options.
876
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
877
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this dialog box to find a specific option for the selected build tool.
Item Description
Search for Specifies the search criteria. You can search for an option by typing its description, such as data
alignment, or its command-line switch, such as -a.
Options list Lists all command-line options that match the search text. When you select an option and click OK,
the Project Options page with the selected option is displayed.
3.2.11.4.7 iLink 32
Topics
Name Description
Linker Linking ( see page 878) Project Options Linker Linking
Use this dialog box to set Linker Linking options.
Linker ( see page 880) Project Options Linker
This is the top-level node of the Linker command line options.
Note: Options marked with an asterisk (*) on the options pages are the default
values.
Linker Output Options ( see page 881) Project Options Linker Output options
Use this dialog box to set Linker Output Setting options.
Linker Warnings ( see page 884) Project Options Linker Warnings
Use this dialog box to set Linker Warning options.
3 Load... Displays the Apply Option Set dialog box to apply the options in a named option set to the current
configuration.
878
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Full debug information Includes information in the output file needed to debug your application with the C++Builder
(-v) integrated debugger or Turbo Debugger.
On the command line this option causes the linker to include debugging information in the executable
file for all object modules that contain debugging information. You can use the -v+ and -v- options to
selectively enable or disable debugging information on a module-by-module basis (but not on the
same command line where you use -v). For example, the following command includes debugging
information for modules mod2 and mod3, but not for mod1 and mod4:
ILINK32 mod1 —v+ mod2 mod3 -v- mod4
Default = false
Keep output files (-Gk) Tells the linker to keep output files that would otherwise be deleted on errors. The linker has been
changed to delete its output file (EXE/DLL) if there are errors in the link. The old behavior was to
leave these files and not delete them. Default = false
Maximum errors (-Enn) Sets the specified number of errors encountered (nn) before the link is aborted. Default = 0
Generate package Generates a static package library containing code from all the .OBJs in the package so that it can be
library (-Gl) linked to. Default = false
Generate .drc file (-GD) ILink32 generates Delphi compatible .RC files (drc files). The drc file has the same name as the
executable file and is emitted to the same directory as the executable file. Default = false
Generate import library Generates import library (DLL and package projects only). Default = false
(-Gi)
Disable incremental Suppresses the generation of linker state files, disabling incremental linking. If you use -Gn,
link (-Gn) subsequent links take just as long as the first one. Default = false
879
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Object alignment (-Ao) The linker uses the object alignment value to determine the virtual addresses of the various objects
and sections (such as code and data) in your application. For example, if you specify an object
alignment value of 8192, the linker aligns the virtual addresses of the sections in the image on
8192-byte (0x2000) boundaries.
When using this option, you must specify an object alignment value that is a power of 2, with the
smallest value being 4096 (0x1000) , the default.
The command-line version of this option (/Ao) accepts either decimal or hexadecimal numbers as the
object alignment value.
Default = 0x1000
Delay load .DLLs (-d) Delayed loading of DLLs is useful for DLLs that are used very infrequently by an application, but
might have high startup costs. DLLs that have been delay loaded are not loaded and initialized until
an entry point in the DLL is actually called. There is accompanying RTL support for delayed load
DLLs that the user can hook into to handle errors on loading and to supplant the delayed load
system, if so desired.
Click [...] to display a dialog to manage of list of DLLs. Check the Merge box to act as if the
immediate ancestor's DLLs are merged into this list, though this list is not actually changed.
Additional options Enter any additional linker options.
3.2.11.4.7.2 Linker
Project Options Linker
Note: Options marked with an asterisk (*) on the options pages are the default values.
Note: Many linker options and their switches are described in the other linker option pages for which links are provided below.
You can also get information about Linker options by entering ilink32
in a command window:
-C Clear state before linking
-wxxx Warning control
880
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
881
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
882
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Mangle names (-M) Prints the mangled C++ identifiers in the map file, not the full name. This can help you identify how
names are mangled (mangled names are needed as input by some utilities).
883
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Minimum heap size Specifies the size of the committed heap in hexadecimal or decimal. The minimum allowable value
(-Hc) for this field is 0 and any value specified must be equal to or less than the Reserved Heap Size
setting (-H).
Specifying the committed heap size here overrides any HEAPSIZE setting in a module definition file.
Default value = 0x00001000
Maximum heap size Specifies the size of the reserved heap in hexadecimal or decimal. The minimum allowable value for
(-H) this field is 0.
Specifying the reserved heap size here overrides any HEAPSIZE setting in a module definition file.
Default value = 0x00100000
Section flags (-GS) The -GS switch lets you add flags to a named image section.
This switch adds the flags to the existing flags for a given section. There is no way to remove default
flags from a section.
Allowable flags are:
E - Executable
C - Contains Code
I - Contains initialized data
R - Section is readable
W - Section is writable
S - Section is shared
D - Section is discardable
K - Section must not be cached
P - Section must not be paged
Default value = No flags
Image flags (-GF) The GF switch allows you to set several flags on the image. The following flags are supported:
-GF:SWAPNET
-GF:SWAPCD
-GF:UNIPROCESSOR
-GF:LARGEADDRESSAWARE
-GF:AGGRESSIVE
SWAPNET tells the OS to copy the image to a local swap file and run it from there if the image
resides on a network drive.
SWAPCD tells the OS to copy the image to a local swap file and run it from there if the image resides
on removable media (for example, CD, floppy, USB memory stick).
UNIPROCESSOR tells the OS that this application cannot run on a multiprocessor system.
LARGEADDRESSAWARE tells the OS that the application understands addresses bigger than 4G.
AGGRESSIVE permits the OS to aggressively trim the working set of an application when the
application is idle. This is ideal for screen savers and other processes that wish to stay out of the way
of main line processes as much as possible.
Default value = None
3
General option Description
Default Saves the current settings as the default for each new project.
884
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Note: Not all of the options described below are available for all types of projects.
Item Description
String list Lists the strings currently set in the active build configuration.
Text field Specifies a string to add or replace in the String list. Shows the currently selected string.
[Up Arrow] Moves the selected string up in the list.
[Down Arrow] Moves the selected string down in the list.
Ellipsis Displays the Browse for Folder dialog box. Use this dialog box to specify a path.
Replace Replaces the selected string with the text field content.
3
Add Adds the string in the text field to the list.
Delete Deletes the selected string.
Delete Invalid Paths Deletes all invalid paths from the string list.
Inherited values Lists the strings inherited from All Configurations. You cannot modify this list.
885
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Inherit values from Causes the active build configuration to inherit the strings specified in All Configurations.
lower level settings
3.2.11.4.9 Implib
Topics
Name Description
Librarian ( see page 886) Projects Options TLib
Use this dialog box to set Librarian (TLib) options.
Note: Options marked with an asterisk (*) on the options pages are the default
values.
3.2.11.4.9.1 Librarian
Projects Options TLib
Note: Options marked with an asterisk (*) on the options pages are the default values.
886
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
887
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this dialog box to set Project Properties that control certain aspects of how the project is managed in the IDE.
Note that this dialog can be displayed from either Project Options or Tools Options. If options are set in the dialog from
Project Options, they apply only to that project. If options are set in the dialog from Tools Options, they apply to new projects.
888
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
3.2.11.4.12 tasm32
Topics
Name Description
Turbo Assembler ( see page 889) Project Options Tasm
This is the top-level node of the Turbo Assembler command line options.
Note: Options marked with an asterisk (*) on the options pages are the default
values.
Turbo Assembler Options ( see page 889) Project Options Tasm Options
Use this dialog box to set Assembler Options.
Turbo Assembler Paths and Defines ( see page 891) Project Options Tasm Paths and Defines
Use this dialog box to set Assembler Path and Define options.
Turbo Assembler Warnings ( see page 892) Project Options Tasm Warnings
Use this dialog box to set Assembler Warnings options.
This is the top-level node of the Turbo Assembler command line options.
Note: Options marked with an asterisk (*) on the options pages are the default values.
See Also
Paths and Defines ( see page 891) 3
Options ( see page 889)
889
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
890
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Use this dialog box to set Assembler Path and Define options.
891
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
892
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Some project options are no longer available in C++ Builder 2007. They may be available by using the tool switches.
For reference, they are listed here by major topics: C++ Compiler, Resource Compiler. Pascal Compiler, IDL to C++ Compiler,
Linker, Librarian, and Turbo Assembler.
3
C++ Compiler: Other Description
Options
Ignore system header Ignores system header files while generating dependency information
files while generating
dependency info (-mm)
Console application
(-tC)
893
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
894
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
895
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Look for 8.3 names also Looks for 8.3 names also
(-P)
Quiet compile (-Q) Performs a quiet compile
Compiler directives (-$) Sets compiler directives to the specified directives.
Imported data (-$G+)* Enables imported data.
Runtime type info (-$M+) Enables runtime type info.
896
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
897
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Windows device driver The application type is set to NATIVE, and the image checksum is calculated and set.
(-ad)
Console application Generates a 32-bit protected-mode executable file that runs in console mode.
(-ap)
Resource files A list of .RES files (compiled resource files) to bind to the executable. (The linker appends an .RES
extension if no extension is present.)
Def file The module definition file for a Windows executable. If you don't specify a module definition (.DEF)
file and you have used the /Twe or /Twd option, the linker creates an application based on default
settings. (The linker appends a .DEF extension if no extension is present.)
3 Design time only Generates a design-time-only package. (If neither /Gpr nor /Gpd is used, the resulting package works
package (-Gpd) at both design time and runtime.)
Runtime only package Generates a runtime-only package. (If neither /Gpr nor /Gpd is used, the resulting package works at
(-Gpr) both design time and runtime.)
898
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
899
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
The Add Reference dialog box is also available in the Project Manager by right-clicking a References folder and choosing Add
900
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
Reference.
Item Description
Assembly Name The name of the assembly.
Version The version of the assembly.
Path The location of the assembly.
Add Reference Adds the selected (highlighted) reference to the New References list.
Browse Displays a dialog box allowing you to navigate to an assembly.
Remove Removes the reference currently selected in the New References list from the list.
OK If the New References list contains any references, they are added to the project when you click OK.
Adds a reference to a project that produces an assembly (.dll), such as a Class Library or Control Library. The reference will be
added to the current project.
The Add Reference dialog box is also available in the Project Manager by right-clicking a References folder and choosing Add
Reference.
Item Description
Project Name The name of the project that produces an assembly. Only projects within the current project group are
listed.
Project Directory The location of the project.
Add Reference Adds the selected (highlighted) reference to the New References list.
Browse Displays a dialog box allowing you to navigate to an assembly.
Remove Removes the reference currently selected in the New References list from the list.
OK If the New References list contains any references, they are added to the project when you click OK.
Saves a customized form or project template in the Object Repository for reuse in other projects. The saved forms and
3
templates are then available in the New Items dialog box when you choose File New Other.
Item Description
Category Lists the current category names.
New Category Adds a folder with a new category to the Object Repository.
Title Gives the template a name.
901
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Description Gives a description of the template. The description appears when you choose File New Other,
select the template in the Object Repository, right-click, and choose View Details from the context
menu.
Author Identifies the author of the application. Author information appears only when you choose
File New Other, select the template, right-click, and choose View Details from the context menu.
Browse Opens the Select icon dialog box where you can select an icon to represent the item in the Object
Repository. You can use a bitmap of any size, but it will be cropped to 60 x 40 pixels.
Tip: You can specify the path where you want the product to look for the file (BorlandStudioRepository.xml) that describes
where the Object Repository
templates are located. If you want to change the path, choose Tools Options Environment Options and enter the path in
the Directory text box.
After you save a form or project as a template, you can edit its description, delete the template, or change its icon by choosing
Tools Repository and clicking the Edit button.
Searches for services and providers in the UDDI services sites with WSDL described services. Search by name or browse
through available categorization schemas.
Item Description
Microsoft production Launches Microsoft's Production site for existing Web Services.
Microsoft Test Launches Microsoft's Test site for existing Web Services.
XMethods Most recent Launches www.xmethods.com/ home page and provides the most recent listings of Web Services.
XMethods full Launches a full service list of all available Web Services.
IBM Secure Launches IBMs UDDI Browser and lets you search for UDDI Business registeries.
Web reference folder Displays the name of the web reference as defined in the active WSDL document.
name
Add Reference Adds the reference displayed in the Web reference folder name text box to your project and
generates a proxy unit for the web reference.
Item Description
View Details Displays a list of the units that are required to build the package.
OK Adds the missing package(s) to the requires clause of the package you are editing.
Cancel Leaves the package you are editing as is.
902
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
and do not apply the changes, errors may occur when the package is loaded.
Creates project dependencies within a project group. From the list, choose the projects to build before building the selected
project.
Item Description
Project Name Displays the projects in the project group except for the selected project.
Path Displays the location of the project file.
Adds one or more language resource DLLs to a project. Follow the instructions on each wizard page.
See Also
Localizing Applications ( see page 18)
Removes one or more languages from the project. Follow the instructions on each wizard page.
See Also
Localizing Applications ( see page 18)
Determines which language module loads when you run your application in the IDE. Before changing the active language, make
sure you have recompiled the satellite assembly for the language you want to use.
3
Select the desired language and click Finish.
See Also
Localizing Applications ( see page 18)
903
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this dialog box to assign a name to a new category in the Object Repository.
Item Description
New Category Name Specifies the name for the new category being added to the Object Repository.
3.2.11.15 Information
Project Information
Views the program compilation information and compilation status for your project.
Item Description
Source compiled Displays total number of lines compiled.
Code size Displays total size of the executable or assembly without debug information.
Data size Displays memory needed to store the global variables.
Initial stack size Displays memory needed to store the local variables.
File size Displays size of final output file.
Status Displays whether your last compile succeeded or failed.
Specifies an HTML file in your project as the Project Page for recording a description of the project, and various other notes and
information. This page is automatically displayed in the IDE when you open the project.
Item Description
Name Specifies the name of the Project Page. The drop down list shows all HTML files in your project.
Resource Folder Specifies the folder for additional HTML files or images files referenced by the Project Page.
Item Description
File list Select the file that you want to remove. To select multiple files, press the CTRL key while selecting
the files.
Note: If you attempt to remove a file that has been modified during the current edit session, you will be prompted to save your
904
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
changes. If you have not modified the file, it is removed without a confirmation prompt.
Warning: Remove the file from your project before deleting the file from disk so that the product can update the project file
accordingly.
3.2.11.18 Options
Project Manager Right-click a satellite assembly Options command
Sets the assembly linker (al.exe) options for the satellite assembly selected in the Project Manager.
Item Description
Culture Specifies the culture string to associate with the assembly. Select a culture from the drop-down list.
Corresponds to the /culture option.
Company Specifies a string for the Company field in the assembly.
Corresponds to the /company option.
Configuration Specifies a string for the Configuration field in the assembly.
Corresponds to the /configuration option.
Copyright Specifies a string for the Copyright field in the assembly.
Description Specifies a string for the Description field in the assembly.
Corresponds to the /description option.
Trademark Specifies a string for the Trademark field in the assembly.
Corresponds to the /trademark option.
Product Specifies a string for the Product field in the assembly.
Corresponds to the /product option.
Product Version Specifies a string for the Product Version field in the assembly.
Corresponds to the /productversion option.
Title Specifies a string for the Title field in the assembly.
Corresponds to the /title option.
File Version Specifies a string for the File Version field in the assembly.
Corresponds to the /fileversion option.
Evidence Specifies the file to embed in the assembly with the resource name of Security.Evidence.
Corresponds to the /evidence option.
Keyfile Specifies the file that contains a key pair or public key to sign an assembly. The compiler inserts the
public key in the assembly manifest and then signs the final assembly with the private key.
Corresponds to the /keyfile option.
Keyname Specifies a container for a key pair. This will sign the assembly with a strong name by inserting a
public key into the assembly manifest. 3
Corresponds to the /keyname option.
box will be available for viewing with reflection. For more information about the assembly linker, satellite assemblies, and
reflection, refer to the .NET Framework SDK online Help.
905
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
You can use a bitmap of any size, but it will be cropped to 60 x 40 pixels.
Configures a finished ActiveX control or ActiveForm for deployment to a Windows Web server.
Tip: Set these options before you compile the ActiveX project and deploy it by choosing Project->Web Deploy.
Project Page
Use this page to specify file locations, a URL, and CAB file compression and version information.
Item Description
Target Dir Specifies the location of the ActiveX library file as a path on the Web server. This can be a standard
path name or a UNC path. Click the Browse button to navigate to a desired directory, for example,
C:\INETPUB\wwwroot.
Target URL Specifies the URL for the ActiveX library file. See your Web server documentation for information on
how it specifies URLs, for example, http://mymachine.borland.com/.
HTML Dir Specifies the location where the HTML file that contains a reference to the ActiveX control should be
generated. This can be a standard path name or a UNC path. Click the Browse button to navigate to
the desired directory, for example, C:\INETPUB\wwwroot.
Use CAB file Compresses the ActiveX library and all required packages and additional files that do not specify
compression otherwise. Cabinet compression stores files in a file library, which can decrease download time by up
to 70 percent.
Include file version Includes the version information specified on the VersionInfo page of the Project Options dialog
number box.
Auto increment release Automatically increments the project’s release number every time you choose Project Web Deploy.
number This updates the value on the VersionInfo page of the Project Options dialog box.
Deploy required Deploys all packages listed on the Packages page along with the project.
packages
Deploy additional files Deploys all files listed on the Additional Files page along with the project.
Packages Page
Use this page to indicate which packages must be deployed with your project and how they should be deployed. Each package
can specify its own options, overriding the defaults on the Project page. Packages that ship with this product are code signed
with the CodeGear signature.
3
Note: You must check Deploy required packages
on the Project page to include these files. Otherwise, these packages are not deployed and you will not be able to select
packages in the packages list.
Item Description
Packages used by this Lists the packages that are required by your ActiveX library project. Select a package in this list to
project modify its options.
906
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
on the Project page to include these files. Otherwise, these files are not deployed, and you will not be able to add or select files
in the files list.
Item Description
Files associated with Lists the files (other than packages) that are required by your ActiveX library project. You can add
project files to the list by clicking the Add button. You can remove the selected file by clicking the Remove
button. Select a file to modify its options.
Compress in a Creates a separate .cab file for the package.
separate CAB
Compress in project Includes the package in the project .cab file.
CAB
Use file VersionInfo If the package includes a VersionInfo resource, the version information in that resource is added to
the .inf file for the project.
Target URL Specifies the URL for the package file. If this is blank, the Web browser assumes the file already
exists on the client machine. If the client does not have the package, the download of the ActiveX
library fails.
Target directory Specifies the directory where the package should be written on the server. This can be a standard
path name or a UNC path. If this is blank, it indicates that the file already exists and should not be
overwritten.
See Also
Project Manager ( see page 1038)
907
Project RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Rebuilds all files in your current project regardless of whether they have changed. Building is useful when you are unsure which
files have changed, or if you have changed project or compiler options.
See Also
Project Manager ( see page 1038)
Compile (for Delphi) and Make (for C++ ) compiles only those files that have changed since the last build, as well as any files
that depend on them. Compiling or making does not execute the application (see Run Run).
See Also
Project Manager ( see page 1038)
Item Description
Look in Specifies the location where you want to locate a file or folder.
Files Displays the files in the current directory that match the wildcards in File name or the file type in Files
Of Type. You can display a list of files (default) or you can show details for each file.
File name Displays a default name for the file you want to add.
File of type Displays the files of the specified type. Only those files in the current directory that are of the
specified type appear in the Files list box.
Open Click Open to add the file or open a folder.
3 Tip: Press F1
See Also
Project Manager ( see page 1038)
908
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Project
See Also
Project Manager ( see page 1038)
Removes previously compiled files and leaves behind only the source files needed to build the project. Specifically , it cleans out
any .dcu's, .bpl's, etc., that were generated.
Opens the default Project Options dialog box for the specified project type: C++ Builder, Delphi for Win32, Delphi for .NET, C#
Builder, and Basic Builder. This option is only available when there is not an open project.
After the Project Options dialog opens help is available from each page of the dialog. Click Help or press F1.
See Also
Setting Project Options ( see page 162)
Setting IDE
3.2.11.28 Options
Project Options
Opens the Project Options dialog that manages application and compiler options for your project. Making changes to your
project only affects the current project. However, you can also save your selections as the default settings for new projects.
See Also
Setting Project Options ( see page 162)
3
Build Configurations Overview (Delphi) ( see page 5)
909
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Checks the active project for incorrect symbols. This is an efficient way to check and see if a large project will build correctly prior
to compiling. Errors are reported in the Compiling dialog with details shown in the Messages pane.
Updates resource modules. When you add an additional resource, such as a button on a form, you must update your resource
modules to reflect your changes. Build and save your project before you update the resources.
Shows the source of the project file that manages the running of the application. Dephi and Delphi .NET show a .dpr file. C++
shows .cpp file.
3.2.12 Propeditors
Topics
Name Description
Delete Templates ( see page 914) Menu Designer context menu Delete Templates
Use this dialog box to remove predefined templates from the list in the Insert
Template dialog.
Insert Template ( see page 915) Menu Designer context menu Insert From Template
Use this dialog box to add a menu using a predefined template.
Select Menu ( see page 915) Menu Designer context menu Select Menu
Use this dialog box to select from a list of menus associated with the form whose
menu is currently open in the Menu Designer.
Browse dialog box ( see page 915)
• Insert Object dialog box Browse (when Create From
File is selected)
• Change Icon dialog box Browse
The Browse dialog box has multiple uses, depending on
where you opened it:
3 • To load an existing file into an OLE container. The file you
select must be associated with an application that can be
used as an OLE server.
• To select an icon to represent an OLE object on the form.
910
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
Change Icon dialog box ( see page 916) Use the Change Icon dialog box to specify an icon and a label for the object you
are placing on the form.
To open the Change Icon dialog box:
911
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
IconView Items editor ( see page 924) Use the IconView Items editor at design time to add or delete the items displayed
in an iconview component. You can add or delete new items, and you can set the
caption and image index for each item using the IconView Items editor.
Image List Editor ( see page 925) Use the ImageList Editor at design time to add bitmaps and icons to a TImageList
component.
While working in the image list editor, you can click Apply to save your current
work without exiting the editor, or click OK to save your changes and exit the
dialog. Using the Apply button is especially useful because once you exit the
dialog, you can't make any more changes to the existing images.
To display the ImageList editor select the TImageList object and double-click the
component or right-click and select ImageList Editor.
ListView Items Editor ( see page 926) Use the ListView Items editor at design time to add or delete the items displayed
in a listview component. You can add or delete new items and sub-items, and
you can set the caption and image index for each item in the ListView Items
editor.
To display the ListView Items editor, select the TListView object and double-click
the Items property value in the Object Inspector.
New Standard Action Classes dialog box ( see page 927) Use the New Standard Action Classes dialog box to add a predefined action to
your action list. Standard actions perform common tasks such as navigating
datasets, managing the windows in an MDI application, or working with the
Windows clipboard. Each standard action performs a specific function when
invoked, and enables or disables any linked controls as appropriate.
Choose the action you want to add from the list and click OK. For a description of
each predefined action class, see Predefined Action Classes.
String List editor ( see page 927) Use the String List editor at design time to add, edit, load, and save strings into
any property that has been declared as TStrings.
To open the String List editor:
912
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
Input Mask editor ( see page 929) Use the Input Mask editor to define an edit box that limits the user to a specific
format and accepts only valid characters. For example, in a data entry field for
telephone numbers you might define an edit box that accepts only numeric input.
If a user then tries to enter a letter in this edit box, your application will not accept
it.
Use the Input Mask editor to edit the EditMask property of the MaskEdit
component.
Insert Object dialog box ( see page 930) Use the Insert Object dialog box at design time to insert an OLE object into an
OleContainer component. The OleContainer component enables you to create
applications that can share data with an OLE server application. After you insert
an OLE server object in your application, you can double-click the OleContainer
component to start the server application.
Select whether or not you want to create a new file using the associated OLE
server or use an existing file. If you use an existing file, it must be associated with
an application that can act as an OLE server.
Loading an image at design time ( see page 931) Use the Picture Editor to load images onto any of several graphic-compatible
components and to specify an image to represent a form when it is minimized at
runtime.
Each graphic-compatible component has a property that uses the Picture Editor.
To load an image at design time:
913
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Notebook editor ( see page 933) Use the Notebook editor to add, edit, remove, or rearrange pages in either a
TabbedNotebook component or Notebook component. You can also use the
Notebook editor to add or edit Help context numbers for each notebook page.
The Notebook editor displays the current pages of the notebook in their current
order, and it also displays the Help context associated with that page.
To open the Notebook editor:
Use this dialog box to remove predefined templates from the list in the Insert Template dialog.
914
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
Edit Menu Removes the standard Edit menu with items that include Undo, Repeat, Cut, Copy, Paste, Paste
Special, Find, Replace, Go To, Links, and Objects.
File Menu Removes the standard File menu with items that include New, Open, Save, Save As, Print, Print
Setup, and Exit.
File Menu (for TextEdit Removes the File menu with the standard items, and also includes the Close item.
Example)
Help Menu Removes the Help menu with items that include Contents, Search for Help On, How to Use Help, and
About.
Help Menu (Expanded) Removes the Help menu with the standard items, along with additional items that include Index,
Commands, Procedures, Keyboard, and Tutorial.
MDI Frame Menu Removes the set of menus that contain the same items as the File, Edit, Window, and Help
(Expanded) menus.
Window Removes the Window menu with items that include New Window, Tile, Cascade, Arrange All, Hide,
and Show.
Edit Menu Adds a standard Edit menu with items that include Undo, Repeat, Cut, Copy, Paste, Paste Special,
Find, Replace, Go To, Links, and Objects.
File Menu Adds a standard File menu with items that include New, Open, Save, Save As, Print, Print Setup, and
Exit.
File Menu (for TextEdit Adds a File menu with the standard items, and also includes the Close item.
Example)
Help Menu Adds a Help menu with items that include Contents, Search for Help On, How to Use Help, and
About.
Help Menu (Expanded) Adds a Help menu with the standard items, along with additional items that include Index,
Commands, Procedures, Keyboard, and Tutorial.
MDI Frame Menu Adds a set of menus that contain the same items as the File, Edit, Window, and Help (Expanded)
menus.
Window Adds a Window menu with items that include New Window, Tile, Cascade, Arrange All, Hide, and
Show.
915
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
The Browse dialog box has multiple uses, depending on where you opened it:
• To load an existing file into an OLE container. The file you select must be associated with an application that can be used as
an OLE server.
• To select an icon to represent an OLE object on the form.
Item Description
Source Enter the name of the file you want to load or wildcards to use as filters in the Files list box.
Files Displays the files in the current directory that match the wildcards in the Source edit box or the file
type in the Files of Type combo box.
Files of Type Choose the type of file you want to use as the OLE server. By default all files in the current directory
are displayed in the Files list box.
Directories Select the directory whose contents you want to view. In the current directory, files that match the
wildcards in the Source edit box or the file type in the Files of Type combo box appear in the Files list
box.
Drives Select the current drive. The directory structure for the current drive appears in the Directories list
box.
Item Description
Icon Radio Select the icon to use:
Current uses the current icon.
Default uses the default icon.
From File enables you to specify an icon using a fully qualified path name. If you do not know the
icon name or the path, click Browse to open the Browse dialog box. The display box below the edit
box shows all the available icons in the specified file. To choose an icon, select it.
Label Enter the label that is to appear below the icon on the form.
Browse Click Browse to open the Browse dialog box, where you can select an icon to represent the inserted
object on the form.
3
Sample Icon Display Displays how the icon and label will appear on the form.
See Also
Browse ( see page 915)
916
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
Color field
Displays the spectrum of available colors. The crosshairs indicate the current color.
Click anywhere or drag in the color field to select a color. When you select a color here and then click Add To Custom Colors,
the selected color is added to one of the Custom Color boxes so you can use it again.
Color|Solid
Displays the currently selected color and its closest solid color. Double-click the solid color to make it the current color.
Hue
Enter a value for the hue. Hue is the "actual" color, for example, red, yellow-green, or purple. Hue refers to the color without
regard to saturation or brightness (luminosity).
Sat(uration)
Enter a value for the saturation. Saturation refers to how much gray is in the color. The Sat(uration) field shows the saturation
from 0 (medium gray) to 240 (pure color).
Note: Saturation affects how clear the color is. Luminosity affects how bright the color is.
Red/Green/Blue
Enter values for the proportion of red, green, and blue you want in your color. The values in these fields show the balance of red, 3
green, and blue in the current color. This is sometimes called the RGB color. The range of available values for an RGB color is 0
to 255.
917
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Dde Service
Specify the server application for the DDE conversation. The application you specify is entered into the Value column for the
DdeService property.
If the directory containing the application is not on your path, you need to specify a fully qualified path.
Dde Topic
Enter the topic for a DDE conversation. The topic is a unit of data, identifiable to the server, containing the linked text. For
example, the topic could be the file name of a spreadsheet.
When the server is a VCL-based application, the topic is the name of the form containing the data you want to link.
If the directory containing the topic is not on your path, you need to specify a fully qualified path.
Paste Link
Click Paste Link to paste the application name and file name from the contents of the Clipboard into the App and File edit boxes.
This button is active only when the clipboard contains data from an application that can be a DDE server.
918
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
Filter column
Enter wildcards and extensions that will define your filter. For example, *.txt would display only files with the .txt extension.
To apply multiple file extensions to your filter, separate them using a semicolon.
Font style
Select a style for the font. This combo box displays only those styles that are available for the selected font. For most of the
available fonts, there are four possible styles:
• Regular
• Italic
• Bold
• Bold Italic
Size
Select a size for the font (in points). This combo box displays only those font sizes that are available for the selected font.
Effects
Check these options to make the text strike-through or underlined.
Color
Select a color for the font. This combo box lists all the available colors for the selected font.
Sample area
Displays a sample of the selected font before you apply it to the components. The font within this area is updated with every
change you make to the font settings.
Script 3
Lists the available language scripts for the selected font.
919
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
To display the Action Manager editor, select the TActionManager object and double-click the component or right-click and select
Customize.
Toolbars tab
The toolbars tab allows you to quickly add toolbars (of type TActionToolBar) to your application by pressing the New button. Use
the Delete button to remove unwanted toolbars. All of the ActionBands toolbars in the application are listed in the Toolbars box.
Check or uncheck them to make them visible or invisible. You can change the caption options for the toolbars by changing the
Caption Options in the Toolbar Options box.
Actions tab
At the top right corner of the actions tab is a toolbar containing four buttons. These are as follows:
New Action Inserts a new action into the list. By clicking the drop-down arrow next to the button, you can choose whether to add
a new action that you define, or a standard (predefined) action. If you choose Standard Action, you will be presented with a
dialog where you can choose the predefined action.
Arrow buttons Moves the currently selected action up or down to change its position in the list.
The lower portion of the actions tab contains two list boxes that represent the current list of actions. The first list indicates the
value of the Category property of the action. You can change this value by selecting the action and changing the value of the
Category property in the Object Inspector.
The second list indicates the name of the action. You can change this value by selecting the action and changing the value of the
Name property in the Object Inspector.
Right click in the lower portion of the Action Manager editor to display the ActionManager context menu. This contains the
following items:
New Action Adds a new (not predefined) action to the Action Manager editor. You can then use the Object Inspector to edit its
properties.
New Standard Action Displays the Standard Actions dialog box, where you can select a predefined action.
Move Up Moves the currently selected action toward the beginning of the list.
Move Down Moves the currently selected action toward the end of the list.
Cut Cuts the currently selected action to the clipboard, removing it from the list.
Copy Copies the currently selected action to the clipboard without removing it from the list.
Paste Pastes an action from the clipboard above the currently selected action.
The Other section of the Options tab contains a check box which causes large icons to appear on action bands. Another check
box causes tips to appear on toolbars. A third check box will (if tips are selected) show shortcut keys in the tips. Finally, there is a
field that allows you choose what type of animation will be used when menus open.
920
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
Toolbar
At the top of the Action List editor is a toolbar containing four buttons. These are as follows:
Button
When clicked
New Action Inserts a new action into the list. By clicking the drop-down arrow next to the button, you can choose whether to add
a new action that you define, or a standard (predefined) action. If you choose Standard Action, you will be presented with a
dialog where you can choose the predefined action.
Arrow buttons Moves the currently selected action up or down to change its position in the list.
Right click the Toolbar to display the ActionList toolbar context menu. This contains one item:
Text labels Displays or hides the labels on the buttons in the toolbar.
List boxes
The lower portion of the Action List editor contains two list boxes that represent the current list of actions. The first list indicates
the value of the Category property of the action. You can change this value by selecting the action and changing the value of the
Category property in the Object Inspector.
The second list indicates the name of the action. You can change this value by selecting the action and changing the value of the
Name property in the Object Inspector.
Right click in the lower portion of the Action List editor to display the ActionList context menu. This contains the following items:
CommandWhen clicked
New Action Adds a new (not predefined) action to the Action List editor. You can then use the object Inspector to edit its
properties.
New Standard Action Displays the Standard Actions dialog box, where you can select a predefined action.
Move Up Moves the currently selected action toward the beginning of the list.
Move Down Moves the currently selected action toward the end of the list.
Cut Cuts the currently selected action to the clipboard, removing it from the list. 3
Copy Copies the currently selected action to the clipboard without removing it from the list.
Paste Pastes an action from the clipboard above the currently selected action.
Panel Descriptions Displays or hides labels over the listbox indicating their purpose.
921
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
The following options are available in the Add Page dialog box:
Page Name
Enter the name of the notebook page. There is a 255-character limit on page names.
Help Context
Enter the context ID number for the notebook page. This number is significant if you want to have context-sensitive Help for the
individual pages of the notebook. The Help context is optional.
The items displayed in the list window of the Collection Editor can be selected using the mouse. Once an item is selected, its
properties and events can be set using the Object Inspector.
Item list
The Item list displays the properties listed in the third column of the preceding table for each item in the collection. The properties
for a selected item are displayed in the Object Inspector and are edited there.
Add button
Adds a new item to the collection. You can select the item and edit its parameters in the Object Inspector.
Delete button
922
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
3
3.2.12.14 Edit Page dialog box
Use the Edit Page dialog box to edit existing notebook pages from either the Notebook component or the TabbedNotebook
component.
923
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Page Name
Enter the name of the notebook page. There is a 255-character limit on page names.
Help Context
Enter the context ID number for the notebook page. This number is significant if you want to have context-sensitive help for the
individual pages of the notebook. The Help context is optional.
• Select a TIconView object on a form and click the ellipsis next to the Items property value in the Object Inspector, or
• Double-click a TIconView object on a form, or
• Right-click a TIconView object on a form and choose Items Editor on the context menu.
Using the IconView Items editor
The IconView Items editor contains an Items group box with an Items list box, a New Item button and a Delete button. When you
first add an iconview control to a form, the Items list box is empty and the Delete button as well as the Item properties on the
right are disabled. When you enter or change item properties for a selected item, the Apply button is enabled so that you can
activate changes immediately.
The IconView Items editor also contains an Item Properties group box for setting the properties of the iconview item currently
selected in the Items list box. The Item Properties group box contains a Caption edit box and an Image Index edit box.
Delete button Lets you delete a selected item in the Items list box.
Create and delete iconview items and subitems in the Items group box. To create a new item, click New Item. A default item
caption appears in the Items list box. Specify an item's properties, including its caption, in the Items Properties group box. When
you create a new item, or select an existing item, the New SubItem button is enabled so that you can nest items within other
items in the iconview. If the Items list box contains items, the Delete button is also enabled. To delete an item, select it in the
Items list box and click Delete.
Image Index Lets you specify the number of an image to be used next to the selected iconview item. These are contained in the
3 Images property of the iconview control.
Set the properties for a selected item in the Item Properties group box. Enter a name for the item in the Caption edit box. As you
enter the name, it changes in the Items list box.
To display an image to the left of an item that is not currently selected, specify the index number of the image in the Image Index
edit box. To suppress image display, set Image Index to 0 (the default).
924
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
While working in the image list editor, you can click Apply to save your current work without exiting the editor, or click OK to save
your changes and exit the dialog. Using the Apply button is especially useful because once you exit the dialog, you can't make
any more changes to the existing images.
To display the ImageList editor select the TImageList object and double-click the component or right-click and select ImageList
Editor.
Selected Image
The selected image control displays the currently selected image. This image can be changed by clicking on another image in
the Images list view below. When an image is selected, you can delete it from the list of images. If the image was not added to
the image list before the current invocation of the editor, you can use the other controls to alter its properties. However, once the
image list editor is closed, these properties are fixed and the selected image controls are grayed if the ImageList Editor is again
displayed and that image is selected.
Transparent color
Use the Transparent color drop-down to specify which color is used to create a mask for drawing the image transparently. The
default transparent color is the color of the bitmap's left-most pixel in the bottom line. You can also change the transparent color
by clicking directly on a pixel in the selected image.
When an image has a transparent color, any pixels in the image of that color are not rendered in that color, but instead appear
transparent, allowing whatever is behind the image to show through.
If the image is an icon, Transparent color appears grayed and the transparent color is set to clNone. This is because icons are
already masked.
Fill color
Use the Fill color drop-down to specify a color that is added around the edges of the selected image when it is smaller than the
dimensions indicated by the Height and Width properties of the image list control.
This control is grayed if the selected image completely fills the dimensions specified by the image list (that is, if it is at least as
big as the Height and Width properties). This control is also grayed for icon images, because icons act like masks with any outer
boundaries transparent.
Options
Use the Options radio buttons to indicate how the image list should render the selected image if it does not fit exactly in the
dimensions specified by the image list's Height and Width properties. (These buttons are disabled for icons.)
SettingDescription
Crop Displays the section of the image beginning at the top-left, extending the image list width and height towards the
bottom-right.
Stretch Causes the entire image to stretch so that it fits the image list width and height. 3
Center Centers the image within the image list width and height. If the image width or height is larger than the image list width or
height, the image may be clipped.
Images
Contains a preview list view of all the images in the image list, and controls for adding or deleting images from the list. Each
image is displayed within a 24x24 area for easier viewing of multiple images. Beneath each image is a caption that indicates the
zero-based position of the image within the image list. You can edit the caption to change an image's position in the list or drag
925
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Add
Displays the Add Images dialog box, which lets you select one or more bitmaps or icons to add to the image list. The images
then appear highlighted in the preview list view and their captions are assigned sequential values in the image list.
If a bitmap is larger than the image list width or height by even increments, a prompt appears asking whether the ImageList
editor should divide the bitmap into several images. This is useful for toolbar bitmaps, which are usually composed of several
small images in a sequence and stored as one larger bitmap.
Delete
Removes the selected images from the image list. All images left after clicking Delete are repositioned so they are a contiguous
zero-based list.
Clear
Removes all images from the image list.
Export
Allows you to save the selected image to a file. This file contains the bitmap in its currently altered state, including any cropping
or stretching.
To display the ListView Items editor, select the TListView object and double-click the Items property value in the Object Inspector.
The ListView Items editor also contains an Item Properties group box for setting the properties of the listview item currently
selected in the Items list box. The Item Properties group box contains a Caption edit box and an Image Index edit box.
To display an image to the left of an item that is not currently selected, specify the index number of the image in the Image Index
edit box. To suppress image display, set Image Index to -1 (the default).
926
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
Choose the action you want to add from the list and click OK. For a description of each predefined action class, see Predefined
Action Classes.
Load
Click Load to display the Load String List dialog box, where you can select an existing file to read into the String List editor.
Save
Click Save to write the current string list to a file. The product opens the Save String List dialog box, where you can specify a
directory and file name.
See Also
Value List Editor ( see page 928)
927
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
To display the TreeView Items editor, select the TTreeView object and double-click the Items property value in the Object
Inspector.
The TreeView Items editor contains a SubItems group box with a SubItems list box, an Add SubItem button and a Delete button.
The TreeView Items editor also contains an Item Properties group box for setting the properties of the tree view item currently
selected in the Items list box. The Item Properties group box contains a Text edit box, and Image Index edit box, a Selected
Index edit box, and a State Index edit box.
When you create a new item, or select an existing item, the New SubItem button is enabled so that you can nest items within
other items in the tree view. If the Items list box contains items, the Delete button is also enabled. To delete an item, select it in
the Items list box and click Delete.
To display an image to the left of an item that is not currently selected, specify the index number of the image in the Image Index
edit box. To suppress image display, set Image Index to -1 (the default).
To display an image to left of a selected item, specify the index number of the image in the Selected Index edit box. The index is
zero-based. To suppress image display, set Selected Index to -1 (the default).
To display an additional image to the left of an item, specify the index number of the image in the State Index edit box. The index
number represents an index into the StateImages property of the listview component. The index is zero-based. To suppress
image display, set State Index to -1 (the default).
928
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
Load
Click Load to display the Load String List dialog box, where you can select an existing file to read into the Value List editor.
Save
Click Save to write the current string list to a file. The product opens the Save String List dialog box, where you can specify a
directory and file name.
See Also
Load String List ( see page 932)
Use the Input Mask editor to edit the EditMask property of the MaskEdit component.
The mask consists of three fields separated by semicolons. The three fields are:
• The mask itself; you can use predefined masks or create your own.
• The character that determines whether or not the literal characters of the mask are saved as part of the data.
• The character used to represent a blank in the mask.
Character for Blanks
Specify a character to use as a blank in the mask. Blanks in a mask are areas that require user input.
This edit box changes the third field of your edit mask. 3
Save Literal Characters
Check to store the literal characters from the edit mask as part of the data. This option affects only the Text property of the
MaskEdit component. If you save data using the EditText property, literal characters are always saved.
This check box toggles the second field in your edit mask.
929
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Test Input
Use Test Input to verify your mask. This edit box displays the edit mask as it will appear on the form.
Sample Masks
Select a predefined mask to use in the MaskEdit component. When you select a mask from this list, the product places the
predefined mask in the Input Mask edit box and displays a sample in the Test Input edit box. To display masks appropriate to
your country, choose the Masks button.
Masks button
Choose Masks to display the Open Mask File dialog box, where you choose a file containing the sample masks shown in the
Sample Masks list box.
Select whether or not you want to create a new file using the associated OLE server or use an existing file. If you use an existing
file, it must be associated with an application that can act as an OLE server.
Create New
Choose Create New to specify that you want to launch a server application to create a new OLE object. After choosing Create
New, the ObjectType list box is displayed.
Object Type
Select an application that you want to use as the OLE server. This list box displays all available applications that can be used as
an OLE server. After you select an application, the product launches that application.
File
Enter the fully qualified path for the file you want to insert into your application. The file you choose must be associated with an
application that can be used as an OLE server.
Note: This option is available only when you have selected the Create From File radio button.
Browse
Click Browse to display the Browse dialog box, where you can select a file to use as the OLE server.
Note: This option is available only when you have selected the Create From File radio button.
3 Link
Check Link to link the object on the form to a file. When an object is linked, it is automatically updated whenever the source file is
modified. When Link is unchecked, you are embedding the object, and changes made to the original are not reflected in your
container.
Display As Icon
Check to display the inserted object as an icon on the form. When this option is checked, the Change Icon button is displayed.
930
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
Change Icon
Click Change Icon to open the Change Icon dialog box, where you can specify an icon and label for the object you inserted onto
the form.
Note: This option is available only when you have selected the Create From File radio button.
See Also
Browse ( see page 915)
Each graphic-compatible component has a property that uses the Picture Editor.
File name
Enter the name of the file you want to load or wildcards to use as filters in the Files list box.
931
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Files of Type
Choose a filter to display the different types of image files. By default, the icon files (*.ICO) for the current directory are displayed
in the Files list box.
Directories
Select the directory whose contents you want to view. In the current directory, files that match the wildcards in the File name edit
box or the file type in the Files of Type combo box appear in the Files list box.
Drives
Select the current drive. The directory structure for the current drive appears in the Directories list box.
File name
Enter the name of the file you want to load or wildcards to use as filters in the Files list box.
Files Of Type
Choose a filter to display the different types of files. By default, the text files (*.txt) for the current directory are displayed in the
Files list box.
Directories
Select the directory whose contents you want to view. In the current directory, files that match the wildcards in the File name edit
box or the file type in the Files of Type combo box appear in the Files list box.
Drives
Select the current drive. The directory structure for the current drive appears in the Directories list box.
3
See Also
String List Editor ( see page 927)
932
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
Use the Masked Text editor to edit the Text property of the MaskEdit component.
The Notebook editor displays the current pages of the notebook in their current order, and it also displays the Help context
associated with that page.
1. Place a Notebook component or TabbedNotebook component from the Win 3.1 Component palette page on the form.
2. With that component selected, do one of the following:
• Click the ellipsis button in the Value column for the Pages property.
• Double-click the Value column for the Pages property.
Edit
Click Edit to open the Edit Page dialog box, where you can modify the page name and Help context number for the selected
notebook page.
Add
Click Add to open the Add Page dialog box, where you can create a new notebook page.
Delete
Click Delete to remove the selected page from the notebook.
See Also
Edit Page ( see page 923) 3
Add Page ( see page 922)
933
Propeditors RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
File name
Enter the name of the file you want to load or wildcards to use as filters in the Files list box.
Files
Displays the files in the current directory that match the wildcards in the File Name edit box or the file type in the Files Of Type
combo box.
Files Of Type
Choose the type of file you want to load. By default, all files in the current directory are displayed. However, you can limit the
display to wave files, midi files, or Windows video files.
Directories
Select the directory whose contents you want to view. In the current directory, files that match the wildcards in the File Name edit
box or the file type in the Files Of Type combo box appear in the Files list box.
Drives
Select the current drive. The directory structure for the current drive appears in the Directories list box.
Source label
Displays the path of the file you are going to paste.
Select Paste Link to link the object to the form. When you link an object to a form, the main source is stored in a file so that when
you update the object, the source file is also updated.
As
Lists the type of application object you are pasting. The application listed is the source application from which you received the
3 object that you are pasting.
934
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Propeditors
Load
Display the Load Picture dialog box, where you can select an existing file to read into the Picture editor. For more information
about loading images into the Picture editor, see the information on loading an image at design time.
Save
Display the Save Picture As dialog box, where you can specify a directory and file name in which to store the image.
Clear
Remove the association between the current image and the selected component.
See Also
Load Picture ( see page 931)
To open the Save Picture As dialog box, in the Picture Editor, click Save As.
File name
Enter the name of the file you want to load or wildcards to use as filters in the Files list box.
Directories
Select the directory whose contents you want to view. In the current directory, files that match the wildcards in the File name edit
box or the file type in the Files of Type combo box appear in the Files list box.
935
Run RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Drives
Select the current drive. The directory structure for the current drive appears in the Directories list box.
See Also
Picture Editor ( see page 934)
File name
Enter the name of the file you want to save or wildcards to use as filters in the Files list box.
Files of Type
Choose a filter to display the different types of files. By default, the text files (*.txt) in the current directory are displayed in the
Files list box.
Directories
Select the directory whose contents you want to view. In the current directory, files that match the wildcards in the File name edit
box or the file type in the Files of Type combo box appear in the Files list box.
Drives
Select the current drive. The directory structure for the current drive appears in the Directories list box.
See Also
String List Editor ( see page 927)
3.2.13 Run
3 Topics
Name Description
Add Address Breakpoint or Add Data Breakpoint ( see page 938) Run Add Breakpoint Address Breakpoint
Run Add Breakpoint Data Breakpoint
Sets a breakpoint on either an address or a data item, and to change the
properties of an existing breakpoint. The title might also be Address Breakpoint
Properties or Data Breakpoint Properties, if you accessed the dialog box
through the context menu Properties command.
936
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Run
Add Source Breakpoint ( see page 940) Run Add Breakpoint Source Breakpoint
Sets a breakpoint on a line in your source code or to change the properties of an
existing breakpoint. The dialog box title can also be Source Breakpoint
Properties or Address Breakpoint Properties, depending on how it is
accessed.
Attach to Process ( see page 941) Run Attach to Process
Debugs a process that is currently running on the local or remote computer.
Change ( see page 941) Assigns a new value to the data item currently selected on the Data tab in the
Debug Inspector.
Debug Inspector ( see page 942) Run Inspect
Inspects the following types of data: arrays, classes, constants, functions,
pointers, scalar variables, and interfaces.
The Debug Inspector contains three areas:
Debugger Exception Notification ( see page 943) This dialog box appears when the program you are debugging raises a language
exception or operating system exception, and you have set options that instruct
the debugger to handle exceptions on the Language Exceptions and Native OS
Exceptions pages of Tools Options Debugger Options.
The message format is:
Project <project-name> raised exception class <yyyy> with
message <message-text>.
If yyyy is a class name, the exception is a language exception. If yyyy is a
hexadecimal value, the exception is an operating system exception.
Evaluate/Modify ( see page 944) Run Evaluate/Modify
Evaluates or changes the value of an existing expression or property. This is
useful if you want to test a code correction without having to exit the debugger,
change the source code, and recompile the program.
Find Package Import ( see page 944) Run Run (F9)
The Find Package Import dialog appears when your application cannot locate
one of the runtime packages specified in Project Options Packages dialog.
Inspect ( see page 945) Run Inspect
Used to enter the expression that you want to inspect in the Debug Inspector.
Load Process Environment Block ( see page 945) Run Load Process Environment Block
Indicates which environment variables are passed to your application while you
are debugging it.
Load Process Local ( see page 946) Run Load Process Local
Passes command-line parameters to your application, specify a host executable
for testing a DLL, or load an executable into the debugger.
Load Process Remote ( see page 946) Run Load Process Remote
Connects to a remote computer running the remote debug server and start a
remote debugging session.
Load Process Symbol Tables ( see page 947) Run Load Process Symbol Tables
Specifies the location of the symbols tables to be used during debugging.
New Expression ( see page 948) Inspects a new expression. Enter the expression or select a previously entered
expression from the drop-down list.
Debug session in progress. Terminate? ( see page 948) Your application is running during a debugging session and will be terminated if
you click OK. When possible, click Cancel and terminate your application
normally.
Type Cast ( see page 948) Specifies a different data type for an item you want to inspect. Type casting is
useful if the Debug Inspector contains a symbol for which there is no type
information, and when you want to explicitly set the type for untyped pointers.
Watch Properties ( see page 948) Run Add Watch
Adds a watch or to change the properties of an existing watch. The watch
appears in the Watch List.
Note: The format specifiers listed in the Watch Properties
dialog box will depend on the format specifiers supported by the current
evaluator. Not all of the format specifiers listed below will be available for every
3
evaluator. In most cases the evaluator is specified by the Personality.
Detach From Program ( see page 949) Run Detach From Program
Disconnects the debugger from the current (running) program and refocuses on
the IDE.
Load Process ( see page 949) Run Load Process
Opens the Load Process dialog box. This command provides a separate UI for
loading an arbitrary process into the debugger.
Tip: Press F1
in any item in the list to bring up a help page on the selected topic.
937
Run RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Sets a breakpoint on either an address or a data item, and to change the properties of an existing breakpoint. The title might also
be Address Breakpoint Properties or Data Breakpoint Properties, if you accessed the dialog box through the context menu
Properties command.
Item Description
Address Specifies the address for the address breakpoint. When the address is executed, the program
execution will halt if the condition (optional) evaluates to true and the pass count (optional) has been
3 completed. If the address can be correlated to a source line number, the address breakpoint is
created as a source breakpoint.
Length (for data Specifies the length of the data breakpoint, beginning at “Address.” The length is automatically
breakpoint only) calculated for standard data types.
938
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Run
Condition Specifies a conditional expression that is evaluated each time the breakpoint is encountered.
Program execution stops when the expression evaluates to true. Enter a conditional expression to
stop program execution.
Enter any valid language expression. All symbols in the expression must be accessible from the
breakpoint's location. Functions are valid if they return a Boolean type. For data breakpoints, if no
condition is set, the breakpoint is hit when any change is made to the data in the range specified in
the Length field.
Pass count Stops program execution at a certain line number after a specified number of passes.
Enter the number of passes. The debugger increments the pass count each time the line containing
the breakpoint is encountered. When the pass count equals the specified number, the debugger
pauses program execution. For example, if the pass count is set to 3, you will see 0 of 3, 1 of 3, 2 of
3, then 3 of 3 in the pass count. Program execution stops at 3 of 3.
Because the debugger increments the count with each pass, you can use the count to determine the
iteration of a loop that fails. Set the pass count to the maximum loop count and run your program.
When the program fails, you can calculate the number of loop iterations by examining the number of
passes that occurred.
When you use pass counts with conditions, program execution pauses the nth time that the
conditional expression is true. the debugger decrements the pass count only when the conditional
expression is true.
Group Creates a breakpoint group, and makes this breakpoint a member of the group. Using breakpoint
groups is useful for performing a similar set of actions on all breakpoints within a group.
To create a group, enter a name in this field. To use an existing group, select a group from the
drop-down list.
Advanced Expands the dialog box to include fields for associating actions with breakpoints.
Break Halts execution; the traditional and default action of a breakpoint.
Ignore subsequent Ignores all subsequent exceptions raised by the current process during the current debug session
exceptions (the debugger will not stop on any exception). Use this with Handle subsequent exceptions as a
pair. You can surround specific blocks of code with the Ignore/Handle pair to skip any exceptions
which occur in that block of code.
Handle subsequent Handles all subsequent exceptions raised by the current process during the current debug session
exceptions (the debugger will stop on exceptions based on the current exception settings in
Tools Options Debugger Options Language Exceptions. This option does stop on all
exceptions. Use it to turn on normal exception behavior after another breakpoint disabled normal
behavior using the Ignore subsequent exceptions option.
Log message Writes the specified message to the event log. Enter the message that you want to log.
Eval expression Evaluates the specified expression and, because Log result is checked by default, writes the result
of the evaluation to the event log. Uncheck Log result to evaluate without logging.
Log result If text is entered in Eval expression, writes the result of the evaluation in the to the event log. If
unchecked, the evaluation is not logged.
Enable group Enables all breakpoints in the specified group. Select the group name.
Disable group Disables all breakpoints in the specified group. Select the group name.
Log Call Stack Displays all or part of the call stack in the Event Log window when a breakpoint is encountered.
Entire Stack displays all of the call stack.
3
Partial Stack displays only the number of frames specified in Number of frames.
See Also
Setting and Modifying Breakpoints ( see page 118)
939
Run RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Sets a breakpoint on a line in your source code or to change the properties of an existing breakpoint. The dialog box title can
also be Source Breakpoint Properties or Address Breakpoint Properties, depending on how it is accessed.
Item Description
Filename Specifies the source file for the source breakpoint. Enter the name of the source file for the
breakpoint.
Line number Sets or changes the line number for the breakpoint. Enter or change the line number for the
breakpoint.
Condition Specifies a conditional expression that is evaluated each time the breakpoint is encountered.
Program execution stops when the expression evaluates to true. Enter a conditional expression to
stop program execution.
Enter any valid language expression. All symbols in the expression must be accessible from the
breakpoint's location. Functions are valid if they return a Boolean type.
Pass count Stops program execution at a certain line number after a specified number of passes.
Enter the number of passes. The debugger increments the pass count each time the line containing
the breakpoint is encountered. When the pass count equals the specified number, the debugger
pauses program execution. For example, if the pass count is set to 3, you will see 0 of 3, 1 of 3, 2 of
3, then 3 of 3 in the pass count. Program execution stops at 3 of 3.
Because the debugger increments the count with each pass, you can use them to determine which
iteration of a loop fails. Set the pass count to the maximum loop count and run your program. When
the program fails, you can calculate the number of loop iterations by examining the number of passes
that occurred.
When you use pass counts with conditions, program execution pauses the nth time that the
conditional expression is true. the debugger decrements the pass count only when the conditional
expression is true.
Group Creates a breakpoint group, of which this breakpoint becomes a member. To use an existing group,
select a group from the drop-down list. Using breakpoint groups is useful for performing a similar set
of actions on all breakpoints within a group.
Keep existing When checked, the breakpoint will not be modified, and a new breakpoint will be created with the
Breakpoint changes made to the existing breakpoint.
Advanced Expands the dialog box to include fields for associating actions with breakpoints.
Break Halts execution; the traditional and default action of a breakpoint.
Ignore subsequent Ignores all subsequent exceptions raised by the current process during the current debug session
exceptions (the debugger will not stop on any exception). Use this with Handle subsequent exceptions as a
pair. You can surround specific blocks of code with the Ignore/Handle pair to skip any exceptions
which occur in that block of code.
3 Handle subsequent Handles all subsequent exceptions raised by the current process during the current debug session
exceptions (the debugger will stop on exceptions based on the current exception settings in
Tools Options Debugger Options Language Exceptions. This option does stop on all
exceptions. Use it to turn on normal exception behavior after another breakpoint disabled normal
behavior using the Ignore subsequent exceptions option.
Log message Writes the specified message to the event log. Enter the message that you want to log.
Eval expression Evaluates the specified expression and, because Log result is checked by default, writes the result
of the evaluation to the event log. Uncheck Log result to evaluate without logging.
940
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Run
Log result If text is entered in Eval expression, writes the result of the evaluation in the to the event log. If
unchecked, the evaluation is not logged.
Enable group Enables all breakpoints in the specified group. Select the group name.
Disable group Disables all breakpoints in the specified group. Select the group name.
Log Call Stack Displays all or part of the call stack in the Event Log window when a breakpoint is encountered.
Entire Stack displays all of the call stack.
Partial Stack displays only the number of frames specified in Number of frames.
See Also
Setting and Modifying Breakpoints ( see page 118)
Add Address Breakpoint or Add Data Breakpoint dialog box ( see page 938)
Item Description
Debugger Select the appropriate debugger from the list of registered debuggers. If you choose the CodeGear
.NET debugger, only managed processes are displayed Running Processes list. If you choose the
CodeGear Win32 debugger, both managed and unmanaged processes are displayed.
Remote Machine The name of the remote machine that is running the application that you want to debug.
Running Processes Lists the processes currently running on the local or if specified, the remote computer. Note that the
Remote Server must be running.
PID Lists the process identifier of the process.
Path Lists the location of the process.
Show System Displayed if the Debugger option indicates the CodeGear Win32 debugger. Includes system
Processes processes in the Running Processes list.
Pause After Attach Pauses the process after the debugger attaches to it and displays the CPU View. You will need to
run, step, or trace to resume execution.
Refresh Refreshes and redisplays the list of running processes.
Attach Attaches the debugger to the selected process and, if Pause After Attach is enabled, displays the
CPU window.
The Attach button is disabled for the IDE itself or for any process that you have already attached to
with the debugger.
3.2.13.4 Change
Assigns a new value to the data item currently selected on the Data tab in the Debug Inspector.
941
Run RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Inspects the following types of data: arrays, classes, constants, functions, pointers, scalar variables, and interfaces.
Area Description
Top pane Displays the name, type, and address or memory location of the inspected element, if available.
When inspecting a function call that returns an object, record, set, or array, the debugger displays “In
debugger” in place of the temporarily allocated address.
Middle pane Displays one or more of the following tabs, depending on the type of data you inspect:
Data - Shows data names (or class data members) and current values.
Methods - Displayed only when you inspect a class, or interface and shows the class methods
(member functions) and current address locations.
Properties - Displayed only when you inspect an object class with properties and shows the property
names and current values.
Bottom pane Displays the data type of the item currently selected in the middle pane.
Status bar Displays the data type of the element being inspected.
Context Menu
Right-click the Debug Inspector to display the following commands.
Item Description
Change Lets you assign a new value to a data item. An ellipsis (…) appears next to an item that can be
changed. You can click the ellipsis as an alternative to choosing the change command.
This command is only enabled when you can modify the data item being inspected.
Show Inherited Switches the view in the Data, Methods, and Properties panes between two modes: one that shows
all intrinsic and inherited data members or properties of a class, or one that shows only those
declared in the class.
Show Fully Qualified Shows inherited members using their fully qualified names.
Names
Sort By Sorts the data elements displayed in the Debug Inspector by their name or by the order in which
they were declared in the code.
Bind to Object (For Delphi.NET and managed code only) Attaches the Inspector to the data item currently displayed.
When the Debug Inspector is bound to an object, “(Bound)” is appended to the name of the
inspected element displayed at the top of the dialog box.
Once an Inspector is bound, the displayed value cannot be subinspected. The Debug Inspector
remains bound until you close it or until you open another Debug Inspector by selecting the Inspect,
Descend, New Expression, or Typecast command from the context menu.
3 Inspect Opens a new Debug Inspector on the data element you have selected. This is useful for seeing the
details of data structures, classes, and arrays.
Descend Same as the Inspect command, except the current Debug Inspector is replaced with the details that
you are inspecting (a new Debug Inspector is not opened). To return to a higher level, use the
history list.
New Expression Lets you inspect a new expression.
942
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Run
Type Cast Lets you specify a different data type for an item you want to inspect. Type casting is useful if the
Debug Inspector contains a symbol for which there is no type information, and when you want to
explicitly set the type for untyped pointers.
Dockable Toggles whether the Debug Inspector window is dockable.
Stay On Top Keeps the window visible when out of focus.
See Also
Inspecting and Changing the Value of Data Elements ( see page 122)
If yyyy is a class name, the exception is a language exception. If yyyy is a hexadecimal value, the exception is an operating
system exception.
Item Description
Ignore this exception Causes the debugger to ignore this type of language exception or OS exception and sets the
type corresponding check box in the Exception Types to Ignore list on the Tools Options Debugger
Options Language Exceptions page.
If you choose to ignore the OS exception, the Handled by option is set to Debugger on the Native
OS Exceptions page for all exception ranges that include the exception that was raised.
Inspect exception object Displayed only on exceptions when using the CodeGear .NET Debugger. Displays the Debug
Inspector dialog box for the exception object if you click Break to halt execution.
This option has no effect if you click Continue.
Show CPU view This option is displayed only if the location of the exception does not correspond to a source location.
Displays the CPU View if you click Break to halt execution.
If Show CPU view is displayed and you do not check it, the IDE traverses the call stack looking for a
call in the stack that contains source and will show you the first call found that has source.
This option has no effect if you click Continue.
Break Halts program execution where the exception occurred and positions the Code Editor to that line of
code.
Continue Continues program execution.
. 3
Note: In some cases, the state of the program will prevent you from continuing, and you will repeatedly see the Debugger
Exception Notification
dialog box. If this occurs, click Break and then choose Run Program Reset to end the current program run and release it
from memory.
943
Run RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
3.2.13.7 Evaluate/Modify
Run Evaluate/Modify
Evaluates or changes the value of an existing expression or property. This is useful if you want to test a code correction without
having to exit the debugger, change the source code, and recompile the program.
Item Description
Evaluate Evaluates the expression in the Expression edit box and displays its value in the Result edit box.
Modify Changes the value of the expression in the Expression edit box using the value in the New Value
edit box.
Watch Creates a watch for the expression you have selected.
Inspect Opens a new Debug Inspector on the data element you have selected. This is useful for seeing the
details of data structures, classes, and arrays.
Expression Enter the variable, field, array, or object to evaluate or modify. By default, the word at the cursor
position in the Code Editor is placed in the Expression edit box. You can accept this expression,
enter another one, or choose an expression from the history list of previously evaluated expressions.
To evaluate a function call, enter the function name, parentheses, and arguments as you would type
it in your program, but leave out the statement-ending semicolon (;).
Result Displays the value of the item specified in the Expression text box after you choose Evaluate or
Modify.
New value Assigns a new value to the item specified in the Expression edit box. Enter a new value for the item
if you want to change its value.
Note: You can evaluate any valid language expression or static variables that are accessible from the current execution point.
3 ,Fn Floating Floating point. Shows n significant digits where n can be from 2 to 18. For example, to display the
point first four digits of a floating-point value, type ,F4. If n is not specified, the default is 11.
The Find Package Import dialog appears when your application cannot locate one of the runtime packages specified in
944
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Run
Item Description
Package Import Lists the name of the package that cannot be located.
Browse Displays a file browser so that you can locate the correct package name.
Remove this reference Deletes the name of the package import from the list of runtime packages for the project.
Don't ask me this again Specifies that RAD Studio is to proceed with loading runtime packages without displaying this dialog
again.
See Also
Packages Overview ( see page 640)
Runtime Packages
3.2.13.9 Inspect
Run Inspect
Used to enter the expression that you want to inspect in the Debug Inspector.
Item Description
Expression Enter a valid expression.
See Also
Inspecting and Changing the Value of Data Elements ( see page 122)
Indicates which environment variables are passed to your application while you are debugging it.
Item Description
Debugger The name of the debugger to be used. You can select CodeGear Win32 Debugger or CodeGear
.NET Debugger, depending on the type of application you are debugging.
System variables Lists all environment variables and their values defined at a system level. You cannot delete an
existing system variable, but you can override it.
Add Override Displays the Override System Variable dialog box, allowing you to modify an existing system
variable to create a new user override. This button is dimmed until you select a variable in the
System variables list. 3
User overrides Lists all defined user overrides and their values. A user override takes precedence over an existing
system variable until you delete the user override.
New Displays the New User Variable dialog box allowing you to create new user override to a system
variable.
Edit Displays the Edit User Variable dialog box allowing you to change the user override currently
selected in the User overrides list.
945
Run RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Delete Deletes the user override currently selected in the User overrides list.
Include System Passes the system environment variables to the application you are debugging. If unchecked, only
Variables the user overrides are passed to your application.
Passes command-line parameters to your application, specify a host executable for testing a DLL, or load an executable into the
debugger.
Item Description
Debugger The name of the debugger to be used. You can select either the Borland Win32 Debugger or the
CodeGear .NET Debugger from the pull-down menu.
Process Enter the path to an executable file that you want to run in the debugger. Then click Load to load the
executable. The executable will be paused at its entry point. If there is no debug information at the
entry point, the CPU window will be opened. Select Run Run to run the executable.
Parameters Enter the command-line arguments you want to pass to your application when it starts.
Working Directory Enter the name of the directory to use for the debugging process. By default, this is the same
directory as the one containing the executable of your application.
Execute Startup Code Executes the startup code that was automatically generated when you created the project. The
on Load startup code is executed before reaching the program's main entry point.
Load Loads the application (the process is loaded and stopped).
Connects to a remote computer running the remote debug server and start a remote debugging session.
Item Description
Debugger The name of the debugger to be used. You can select CodeGear Win32 Debugger or CodeGear
.NET Debugger, depending on the type of application you are debugging.
Remote Path Enter the path of the .exe file on the remote computer, relative to the directory that contains the
remote debug server (rmtdbg105.exe).
Remote Host Enter the name or TCP/IP address of the remote computer on which you want to run the application.
The remote debug server (rmtdbg100.exe) must be running on the remote computer.
If a port was specified when starting rmtdbg100.exe, enter a colon after the host name, followed by
the port. For example, if you specified port 8000, specify the remote host assomehost:8000 or
3 127.0.0.1:8000. Otherwise, the default port 64447 will be used.
Parameters Enter the command-line arguments you want to pass to your application (or the host application)
when it starts.
Working Directory Enter the name of the directory to use for the debugging process. By default, this is the same
directory as the one containing the executable of your application.
Execute startup code Executes the startup code that was automatically generated when you created the project. The
on Load startup code is executed before reaching the program's main entry point.
946
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Run
See Also
Debugging Remote Applications ( see page 125)
Item Description
Debugger The name of the debugger to be used. You can select CodeGear Win32 Debugger or CodeGear
.NET Debugger, depending on the type of application you are debugging.
Debug symbols search Specifies the directory containing the symbol tables used for debugging. This path is used if you
path check the Load all symbols check box.
Load all symbols Sets the state of the Mappings from Module Name to Symbol Table Path list. If checked, the list is
disabled and all symbol tables are loaded by the debugger. The debugger uses the Debug symbols
search path to search for the symbol table file associated with each module loaded by the process
being debugged. If unchecked, the Mappings from Module Name to Symbol Table Pathlist is
enabled and its settings are used.
Mappings from Module Displays the current mapping of each module name to a symbol table search path that is defined for
Name to Symbol Table the project. Use the up and down arrows (to the right of the dialog) to move the selected item up or
Path down in the list. The debugger searches this list, in order, to find a match for the name of the module
being loaded. When the debugger finds a matching module name, it uses the corresponding path to
locate that module's symbol table.
For example, if module foo123.dll is loaded, and the list shows foo*.dll as the first item and *123.dll
as a later item, the debugger only uses the symbol table path for foo*.dll, even though both items
match the module being loaded.
Load symbols for Specifies whether symbol tables for modules not in the Mappings from Module Name to Symbol
unspecified modules Table Path list (either explicitly or via a file mask) are loaded during debugging. If checked, the
symbol tables for modules not specified will be loaded using the Debug symbols search path. If
unchecked, symbol tables are loaded only for modules in the list.
New Displays the Add Symbol Table Search Path dialog, where you can specify a module name and an
associated search table path. The module and path are added to the Mappings from Module Name
to Symbol Table Path list. Note that you can add a blank path to prevent a symbol table for a
module from being loaded.
Edit Displays the selected module and path in the Add Symbol Table Search Path dialog, enabling you
to edit the module name or path that displays in the Mappings from Module Name to Symbol Table
Path list.
Delete Removes the selected module from the Mappings from Module Name to Symbol Table Path list.
See Also
Debugging Applications ( see page 10)
3
Preparing Files for Remote Debugging ( see page 128)
947
Run RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Adds a watch or to change the properties of an existing watch. The watch appears in the Watch List.
dialog box will depend on the format specifiers supported by the current evaluator. Not all of the format specifiers listed below
will be available for every evaluator. In most cases the evaluator is specified by the Personality.
Item Description
Expression Specifies the expression to watch. Enter or edit the expression you want to watch. Use the drop-down
list to choose from previously entered expressions.
Group name Specifies the group in which the selected watch resides. If you specify a new group, the new group is
added and the watch is moved to the new group. Use the drop-down list to choose the name from a
list of the existing watch groups.
Repeat count Specifies the repeat count when the watch expression represents a data element, or specifies the
number of elements in an array when the watch expression represents an array. When you watch an
array and specify the number of elements as a repeat count, the Watch List displays the value of
every element in the array.
Digits Specifies the number of significant digits in a watch value that is a floating-point expression. Enter the
number of digits. This option takes affect only when you select Floating Point as the Display format.
Enabled Enables or disables the watch. Disabling a watch hides the watch from the current program run.
When you disable a watch, its settings remain defined, but the debugger does not evaluate the
watch. Disabling watches improves performance of the debugger because it does not monitor the
3 watch as you step through or run your program. When you set a watch, it is enabled by default.
Allow Function Calls Evaluates the watch even if doing so causes function calls. This option is off by default for all
watches. When off, watches that would make function calls are not evaluated but instead generate
the error message ”Inaccessible value.”
Character Shows special display characters for ASCII 0 to 31 (displayed as #$0, #$1F, and so on). This format
type affects characters and strings.
948
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Run
String Shows characters for ASCII 0 to 31 in the Pascal #nn notation (#$0, and so on.) This format type
affects characters and strings.
Decimal Shows integer values in decimal form, including those in data structures. This format type affects
integers.
Hexadecimal Shows integer values in hexadecimal with the 0x (for C++, C#) or $ (for Delphi) prefix, including those
in data structures. This format type affects integers.
Floating point Shows integer values in floating-point notation (real numbers or numbers that can contain fractional
parts).
Pointer Used for Win32 applications only.
Record/Structure Shows both field names and values such as (X:1;Y:10;Z:5) instead of (1,10,5).
Default Shows the result in the display format that matches the data type of the expression. This format type
affects all.
Memory Dump Used for Win32 applications only.
Tip: By default, the debugger displays the result of a watch in the format that matches the data type of the expression. For
example, integer values are displayed in decimal form. However, if you select the Hexadecimal
for an integer type expression, the display format changes from decimal to hexadecimal.
When setting up a watch on an element in a data structure (such as an array), you can display the values of consecutive data
elements. For example, suppose you have an array of five integers named xarray. Type the number 5 in Repeat Count to see
all five values of the array. To use a repeat count, however, the watch expression must represent a single data element.
To change the value of a watch expression, use the Evaluate/Modify dialog box.
and enter a number for Digits to indicate the number of significant digits you want displayed in the Watch List.
Disconnects the debugger from the current (running) program and refocuses on the IDE.
Opens the Load Process dialog box. This command provides a separate UI for loading an arbitrary process into the debugger.
Tip: Press F1
in any item in the list to bring up a help page on the selected topic. 3
See Also
Load Process Environmental Block
949
Run RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
3.2.13.20 Parameters
Run Parameters
Specifies the command-line parameters to pass to your application. Opens Project Options Debugger dialog.
See Also
Parameters ( see page 672)
Terminates the application or process that is currently under the debugger's control.
See Also
Attach Process ( see page 117)
Registers an "in-process" automation server into the registry. An In-Process Automation Server is a set of COM Automation
Objects for connecting to databases, executing SQL statements and PL/SQL blocks, and accessing the results. In-process
automation objects are inside of .dlls; out-of-process automation servers are applications (.exes). ActiveX is used when you
create a new application and then select File New Other Active X Automation Server Object.
3.2.13.23 Run
Run Run
Compiles any changed source code and, if the compile is successful, executes your application, allowing you to use and test it in
the IDE .
See Also
Compiling ( see page 2)
Executes the current program you are working on and stops either at the cursor location or when the function returns.
950
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Run
Item Description
Run To Cursor Executes the current active program to the line containing the cursor. The cursor must be on a line of
source code.
Run Until Return Executes the current active program until the current procedure or function returns to its caller.
Opens the Code Editor window and bring the line of code that contains the current execution point to the front. Use this
command if you closed or minimized the Code Editor window because the debugger automatically displays the execution point
in the Code Editor.
Tells the debugger to execute the next line of code. If the line contains a function, Step Over executes the function and then
stops at the first line after the function.
See Also
Overview of Debugging ( see page 10)
Tells the debugger to execute the next line of code. If the line contains a function, Trace Intro executes the function and then
stops at the first line of code inside the function.
See Also
Overview of Debugging ( see page 10)
951
Search RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
See Also
Register ActiveX Server ( see page 950)
3.2.14 Search
Topics
Name Description
Find ( see page 952) Search Find
Specifies the text you want to locate and sets options that affect the search. Find
locates the line of code containing the first occurrence of the string and highlights
it.
Find in Files ( see page 953) Search Find in Files
Specifies the text you want to locate and sets options that affect the search. The
Find In Files command works with the Repeat Search command available on the
context menu of the Messages pane.
Find References ( see page 954) Search Find References
Locates references to a selected identifier.
Enter Address to Position ( see page 954) Search Goto Address
Positions to an address in the CPU window.
Go to Line Number ( see page 954) Search Go to Line Number
Jumps to a line number in the Code Editor.
Replace Text ( see page 955) Search Replace
Searches for specified text and then replaces with other text or with nothing.
Search Again ( see page 955) Search Search Again
Continues to search for a specified string that was entered in Find.
Find Class ( see page 955) Search Find Class
Opens the Find Class dialog box. The Find Class dialog box searches for all or
part of a class name and lists the all classes currently in scope (from the uses
and references list) that match the entered name. Select a class name from the
list to open the file containing the class declaration.
Find Local References ( see page 956) Search Find Local References
Locates references in the active code file.
Find Original Symbol ( see page 956) Search Find Original Symbol
Searches through the list of files in the Project Manager and then displays the
original declaration of the symbol in question.
Select a symbol (e.g., TForm) that you are using, in another file or another
section fo the project, before selecting Search for Original Symbol.
Find References ( see page 956) Search Find References
Locates references to a selected identifier.
Incremental Search ( see page 956) Search Incremental Search
Allows you to interactively search for text. As you type, the first matching result is
highlighted in the editor. The status bar of the editor shows "Searching for:" with
the text you looking for.
To begin a new search, press Backspace to clear the status bar, or select
Incremental Search again.
3 3.2.14.1 Find
Search Find
Specifies the text you want to locate and sets options that affect the search. Find locates the line of code containing the first
occurrence of the string and highlights it.
952
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Search
Item Description
Text to find Enter a search string or use the down arrow to select a previously entered search string.
Case sensitive Differentiates uppercase from lowercase when performing a search.
Whole words only Searches for words only. (With this option off, the search string might be found within longer words.)
Regular expressions Recognizes regular expressions in the search string. A list of regular expressions is given (as “special
characters”) in GREP.
Forward Searches from the current position to the end of the file. Forward is the default.
Backward Searches from the current position to the beginning of the file.
Global Searches the entire file in the direction specified by the Direction setting. Global is the default scope.
Selected text Searches only the selected text in the direction specified by the Direction setting. You can use the
mouse or block commands to select a block of text.
From Cursor The search starts at the cursor's current position, and then proceeds either forward to the end of the
scope, or backward to the beginning of the scope depending on the Direction setting. From cursor
is the default Origin setting.
Entire scope Searches the entire block of selected text or the entire file (no matter where the cursor is in the file),
depending upon the Scope options.
Specifies the text you want to locate and sets options that affect the search. The Find In Files command works with the Repeat
Search command available on the context menu of the Messages pane.
Item Description
Case sensitive Differentiates uppercase from lowercase when performing a search.
Whole words only Searches for words only. If unchecked, the search string might be found within longer words.
Regular expressions Recognizes regular expressions in the search string.
Search all files in Searches all files in the open project.
project
Search all open files Searches files that are currently open.
Search in directories When selected, the Search Directory Options are available. The search proceeds through all files
indicated.
File mask Specify the path of the files to be searched.
To search other files, use a wildcard entry (such as *.* or *.txt) at the end of the path.
To enter multiple masks, separate the masks with semicolons.
To search for files in the product root directory, specify the root directory using the appropriate
environment variable. 3
Include subdirectories Searches subdirectories of the directory path specified.
Display results in Causes the results of the search to be displayed in a new search tab in the Messages view. The tab
separate tab in is labeled Search for <string>, where string is the text you searched for.
message view If not checked, a new search tab is created unless one already exists. If a search tab exists, the
search results are placed in the existing search tab and the label is changed. If no results are found,
that search tab is deleted.
953
Search RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
view at the bottom of the Code Editor. Double-click a list entry to move to that line in the code.
command changes to Cancel Find in Files. To stop a search in progress, either right-click the search result tab for that search
and choose Close Tab, or choose Search Cancel Find in Files.
Item Description
Remove Red X button deletes the selected reference.
Remove All Documents with small x icon is a button that removes all references from the Find References
window. Successive find operations display a cumulative list of references unless you explicitly delete
them.
+/- Expands and collapses the nodes in the references tree. Each node denotes a separate file.
See Also
Finding References ( see page 141)
Item Description
Edit Box Enter the symbol, such as main, to which you want to position the CPU window.
Alternatively, for managed code, you can enter an address in the just in time (JIT) compiler format:
@(module token,function token,offset)
For example:
@($3,$60005C4,$62)
For unmanaged code, you can enter any flat 32-bit address value, for example, $401018.
3
954
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Search
Item Description
Enter New Line Enter the line number in the code that you want to go to, or select a number from a list of previously
Number entered line numbers.
Searches for specified text and then replaces with other text or with nothing.
Item Description
Text to find Enter a search string or use the down arrow to select a previously entered search string.
Replace with Enter the replacement string. To select from a list of previously entered search strings, click the down
arrow next to the input box. To replace the text with nothing, leave this input box blank.
Case sensitive Differentiates uppercase from lowercase when performing a search.
Whole words only Searches for words only. If unchecked, the search string might be found within longer words.
Regular expressions Recognizes regular expressions in the search string.
Prompt on replace Displays a confirmation prompt before replacing each occurrence of the search string. If unchecked,
the Code Editor automatically replaces the search string.
Forward Searches from the current position to the end of the file. Forward is the default.
Backward Searches from the current position to the beginning of the file.
Global Searches the entire file in the direction specified by the Direction setting. Global is the default scope.
Selected text Searches only the selected text in the direction specified by the Direction setting. You can use the
mouse or block commands to select a block of text.
From Cursor Starts the search at the current cursor position, and then proceeds either forward to the end of the
scope, or backward to the beginning of the scope depending on the Direction setting.
Entire scope Searches the entire block of selected text or the entire file (no matter where the cursor is in the file),
depending on the Scope options.
Replace All Replaces every occurrence of the search string. If checked, the Confirm dialog box appears on each
occurrence of the search string.
3
3.2.14.8 Find Class
Search Find Class
Opens the Find Class dialog box. The Find Class dialog box searches for all or part of a class name and lists the all classes
currently in scope (from the uses and references list) that match the entered name. Select a class name from the list to open the
file containing the class declaration.
955
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
See Also
Finding References ( see page 141)
Searches through the list of files in the Project Manager and then displays the original declaration of the symbol in question.
Select a symbol (e.g., TForm) that you are using, in another file or another section fo the project, before selecting Search for
Original Symbol.
See Also
Find References Overview (Delphi ( see page 65)
Item Description
Remove Red X button deletes the selected reference.
Remove All Documents with small x icon is a button that removes all references from the Find References
window. Successive find operations display a cumulative list of references unless you explicitly delete
them.
+/- Expands and collapses the nodes in the references tree. Each node denotes a separate file.
See Also
Finding References ( see page 141)
Allows you to interactively search for text. As you type, the first matching result is highlighted in the editor. The status bar of the
editor shows "Searching for:" with the text you looking for.
To begin a new search, press Backspace to clear the status bar, or select Incremental Search again.
956
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Together
3.2.15 Together
Topics
Name Description
Add New Diagram dialog box ( see page 960) Context menu Add Other Diagram
To open this dialog box, right click the project root or a namespace element in the
Diagram View or Model View, and choose Add Other Diagram on the
context menu. Alternatively, with the project root selected or a namespace
element selected, you can use the keyboard shortcut, CTRL+SHIFT+D to open
the dialog box.
This dialog box displays the available diagrams that you can add to your project.
Add/Remove Parameters for Operation dialog box ( see page 961) To open this dialog box, select a function or procedure on a diagram in the
Model View or Diagram View, and click the elipsis at the right of the Params
property in the Object Inspector.
This dialog box is used to specify parameters for functions or procedures. You
can add, edit, and delete entries.
Add/Remove User Properties dialog box ( see page 961) Context menu User Properties
To open this dialog, right-click the diagram or model element in the Model View
or Diagram View, and choose User Properties on the context menu.
This dialog box is used for creating user properties and OCL constraints. The
dialog box displays a list of properties, if any, each entry consisting of a pair
Name-Value.
You can add and delete entries, and edit names and values. For editing names,
use the Name text field. For editing values, you can either use the text field, or
click the button and enter the text in the editor widow.... more ( see page 961)
Change Parameters dialog box ( see page 961) Refactor Change Parameters
You can open the Change Parameters dialog box on the Refactoring main
menu, or by using the Refactoring Change Parameters command on the
context menu for methods.
Note: This feature is available for implementation projects only.
Choose Destination (or: Source) dialog box ( see page 962) Model View context menu Transform to Source (or: Transform Code from
Design Project )
This dialog box is invoked from the context menu of a project in the Model View.
Select the desired target project and click Transform.
Diagram Layout Algorithms ( see page 963) The following diagram layout algorithms are available:
957
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Extract Interface or Superclass dialog box ( see page 964) Refactor Extract Superclass (or: Extract Interface)
You can open the Extract Interface/Superclass dialogs from the Refactoring main
menu, or by using the Refactoring | Extract Superclass (or Extract Interface)
commands on the context menu of applicable class diagram elements. The
Extract Interface command is available for classes, structures, methods,
properties, events, and indexers. The Extract Superclass command is available
for classes, interfaces (Extract Superinterface), methods, properties, events,
fields, and indexers.
Note: This feature is available for implementation projects.
Extract Method dialog box ( see page 965) Refactor Extract Method
You can open the Extract Method dialog box from the Refactoring main menu,
or by using the Refactoring Extract Method command on several complete
statements in the RAD Studio Editor.
Note: This feature is available for implementation projects.
Generate Documentation dialog box ( see page 966) Tools Options Together Generate Documentation
Together features a UML documentation wizard that you can use to generate
HTML documentation for your projects. To open this dialog, choose [Tools |
Generate Documentation...] from the main menu. The Together dialog boxes
have built-in help, in addition to this help.
Generate Sequence Diagram dialog box ( see page 966) Context menu Generate Sequence Diagram
To open this dialog box, right-click a method (or function) and choose Generate
Sequence Diagram from the context menu. The Generate Sequence Diagram
dialog box lists the classes and namespaces involved in the method (function)
and allows you to choose which classes/namespaces to display on the generated
sequence diagram.
Inline Variable dialog box ( see page 967) Refactor Inline Variable
The dialog box reports the number of variable occurrences that the Inline
Variable command will be applied to. Click OK to complete the changes.
You can open the Inline Variable dialog box from the Refactoring main menu, or
by using the Refactoring | Inline Variable command on a local variable in the
Delphi Code EditorVisual Studio Editor.
Note: The variable that you select should not be updated later in the source
code. If it is, the error message "Variable index is accessed for writing." opens.
Note: This feature is available for implementation projects only.
Note:... more ( see page 967)
Introduce Field dialog box ( see page 968) Refactor Introduce Field
You can open the Introduce Field dialog from the Refactoring main menu, or by
using the Refactoring | Introduce Field command on an expression in the Delphi
Code EditorVisual Studio Editor.
Note: This feature is available for implementation projects only.
Note: This command is only available while working in the Delphi Code Editor
Visual Studio Editor.
Introduce Variable dialog box ( see page 968) Refactor Introduce Variable
You can open the Introduce Variable dialog from the Refactoring main menu, or
by using the Refactoring | Introduce Variable command on a variable in the Code
Editor.
Note: This feature is available for implementation projects only.
Note: This command is only available while working in the Code Editor.
958
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Together
Together Options dialog window ( see page 969) Tools Options Together
The Options dialog window displays a tree view of configuration option
categories, each of which displays a set of individual configuration options when
selected. To open this dialog box, choose Tools Options on the main menu.
Select the Together folder from the tree view list on the left of the dialog window.
The Together dialog boxes have built-in help, in addition to this help. The help for
a selected option is displayed at the bottom of the dialog window.
The following option categories exist in the tree view under the configuration
levels:
Print Audit dialog box ( see page 970) Audit results pane Print button
This dialog box enables you to print selected sets of audit report results to the
specified printer. The dialog box is invoked from the audit results report view.
Print Diagram dialog box ( see page 971) File Print
This dialog box enables you to print selected diagrams to the specified printer.
The dialog box is invoked by choosing File | Print from the main menu with a
diagram open in the Diagram View.
Pull Members Up and Push Members Down dialog boxes ( see page 972) Refactor Pull Members Up (or: Push Members Down)
You can open the Pull Members Up/Push Members Down dialog boxes from the
Refactoring main menu, or by using the Refactoring | Pull Members Up (or Push
Members Down) commands on the context menu of applicable class diagram
elements. Both the Pull Members Up/Push Members Down commands are
available for methods, properties, fields, indexers, and events.
Warning: This feature is available for implementation projects only.
Safe Delete dialog box ( see page 975) Refactor Safe Delete
You can open the Safe Delete dialog box from the Refactoring main menu, or by
using the Refactoring | Safe Delete command on the context menu of applicable
class diagram elements. The Safe Delete command is available for all
code-generating class diagram elements. It is not available for namespace
elements.
Warning: This feature is available for implementation projects only.
Save Audit and Metric Results dialog box ( see page 976) QA Audits (or: Metrics) pane Save button
This dialog box is invoked from the audit or metrics results report on pressing the
Save button.
Note: This feature is available in implementation projects only.
3
Search for Usages dialog box ( see page 977) Search Search for Usages
This dialog box provides a flexible tool to track references to, and overrides of,
elements and members in the source-code projects.
959
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Select element dialog box ( see page 977) This dialog box displays a tree view of the available contents within your project
groupsolution. Expand the project nodes to reveal the nested classes, select the
required element, and click OK when ready.
This dialog box belongs to a general group of selection dialogs where you can
choose interactions, operations, ancestor classes, instantiated classes for the
objects, etc. This dialog opens when you press the chooser button in a field of
the Object InspectorProperties Window, or when More is selected from the
Choose Class or Choose Method menu nodes.
Selection Manager ( see page 978) This dialog belongs to a general group of selection dialogs where you can select
elements from the available contents and add them to a certain destination
scope. All Selection Manager dialogs have a similar structure and varying title
strings.
XMI Export dialog box ( see page 978) File Export Project to XMI
Use this dialog box to export a Together model to an XML file with the model
described in XMI.
To open this dialog box, choose File | Export Project to XMI from the main menu
while the project root node is selected in the Model View. You can also right-click
the project root node in the Model View and choose Export Project to XMI from
the context menu.
XMI Import dialog box ( see page 979) File Import Project from XMI
Use this dialog box to import an XML file with the model described in XMI.
To open this dialog box, choose File | Import Project from XMI from the main
menu while the project root node is selected in the Model View. You can also
right-click the project root node in the Model View, and choose Import Project
from XMI from the context menu.
To open this dialog box, right click the project root or a namespace element in the Diagram View or Model View, and choose
Add Other Diagram on the context menu. Alternatively, with the project root selected or a namespace element selected, you
can use the keyboard shortcut, CTRL+SHIFT+D to open the dialog box.
This dialog box displays the available diagrams that you can add to your project.
Item Description
Diagrams tab The Diagrams tab lists the available UML diagram types. You can change the view of the UML
diagram icons by pressing the Small Icons or Large Icons buttons. By default, large icons display in
the Diagrams tab.
Diagram name By default, your selected diagram type is displayed in the Name field. You can edit its name or enter
a new name for the new diagram. This name is displayed in the Model View and in the diagram's tab
in the Diagram View when the diagram is open for editing.
Buttons
Large Icons The default setting. This button controls the appearance of the UML diagram icons. Large UML
diagram icons display in the dialog box when selecting this button.
Small Icons This button controls the appearance of the UML diagram icons. Small UML diagram icons display in
the dialog box when selecting this button.
OK Creates the new diagram of the selected type, opens it in the Diagram View on a new tab, and
3 closes the Add New Diagram dialog box.
Cancel Discards all changes and closes the Add New Diagram dialog box.
Help Displays this help topic.
See Also
Diagram Overview ( see page 90)
960
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Together
This dialog box is used to specify parameters for functions or procedures. You can add, edit, and delete entries.
To open this dialog, right-click the diagram or model element in the Model View or Diagram View, and choose User Properties
on the context menu.
This dialog box is used for creating user properties and OCL constraints. The dialog box displays a list of properties, if any, each
entry consisting of a pair Name-Value.
You can add and delete entries, and edit names and values. For editing names, use the Name text field. For editing values, you
can either use the text field, or click the button and enter the text in the editor widow.
See Also
OCL support overview ( see page 95)
961
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Class A read-only field displaying the name of the class where the method resides.
Method A read-only field displaying the selected member and its current parameters, if applicable.
Select members A table displays all existing parameters and any new parameters that you add to the method. The
order of the parameters in the table is the order of the parameters in the method. Use the Add and
Remove buttons to add and remove parameters from the method. If adding a new parameter, you
can edit its Type, Name, and Default value. If editing an existing parameter, you can edit its Name.
You can rearrange the order of the parameters using the Move Up and Move Down buttons.
Preview Usages By default, Preview Usages is checked. If this option is checked when you click OK, the Refactoring
window opens allowing you to review the refactoring before committing to it. If this option is cleared
when you click OK, the Refactoring window opens with the change parameters operation completed.
Buttons
Add Adds a new parameter to the method.
Remove Removes the currently-selected parameter from the method.
Move Up Moves the currently-selected parameter up one row.
Move Down Moves the currently-selected parameter down one row.
OK Opens the Refactoring window.
Cancel Discards all changes and closes the dialog box.
See Also
Refactoring overview ( see page 98)
This dialog box is invoked from the context menu of a project in the Model View. Select the desired target project and click
Transform.
Item Description
Existing projects Displays the list within the current project groupsolution.
For implementation projects, the design projects are greyed out. For design projects, the
implementation projects are greyed out.
Use name mapping This checkbox enables or disables support of the name mapping feature.
files for code generation
Transform Press this button to start transforming design project to source code. Note that the button is only
enabled when a valid source-code project is selected in the list.
Cancel Press this button to discard selection and close the dialog box.
3 Help Opens this topic.
See Also
Transformation to source code overview ( see page 94)
962
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Together
• Autoselect: several algorithms can be available for each diagram type. This option analyzes internal information of each
algorithm, and selects the one that best suits the current diagram type. If autoselect: Each of the layout algorithms contains
internal information about the types of diagrams it will work with and the numeric characteristics for the final quality of the
produced layout when applied to each applicable diagram type. Several algorithms can be available for the same diagram
type. The autoselect option uses such internal information and picks the best algorithm for the current diagram type.
• Hierarchical: this type of algorithm is most suitable to analyze hierarchical structure (for example study inheritance
relationships). The Hierarchical algorithm originates from the Sugiyama algorithm. The algorithm draws the UML diagram
hierarchically according to the preferences that you select.
• Together: algorithm applicable to all types of diagrams. It includes the layout options used in version 6.1 of Together
ControlCenter and Together Edition for JBuilder.
• Tree: the algorithm draws a tree diagram in a tree layout. The algorithm draws the given graph in a tree layout according to its
maximum spanning tree.
• Orthogonal: simple structural algorithm is used when hierarchy is not important. The Orthogonal algorithm uses heuristics to
distribute diagram nodes among a lattice.
• Spring Embedder: Spring Embedder are force-directed layout algorithms that model the input graph as a system of forces
and try to find a minimum energy configuration of this system. All edges are drawn as straight lines. This type of layout is
especially suitable for projects with numerous diagram elements based on large amount of source code. When you lay out a
graph according to the Spring Embedder layout algorithm, the program will simulate the graph as a physical model (masses
and springs) and subject it to physical forces. The unnecessarily-long edges will be the most tense, and will try to contract the
most. When the nodes and edges have been balanced, you will have a geometric representation of the graph.
See Also
Diagram Layout Overview ( see page 92)
This dialog box is invoked from the context menus in the Diagram Editor or the Model View. This dialog box contains two tabbed
pages that enable you to create hyperlinks to the model elements and external resources.
Dialog title The title of the dialog box varies depending on the way it is invoked. It displays the string that
corresponds to the invoking object.
Model Elements tab The pane on the left of the dialog box displays the content available in your project. You can use the
explorer to navigate to the element and select it for inclusion in the pane of values returned by the
dialog to the invoking object.
External Documents tab The Recently Used Documents pane displays the external contents that you make available for your
project. Such contents may be represented by the file system resources or by URLs. Use the Browse 3
and URL buttons to specify these resources.
Browse Click this button to invoke the Open dialog box. Navigate to the desired file and click OK.
URL Click this button to invoke the Documents URL dialog box. Type a URL in the text field and click OK.
Clear Click this button to remove all entries in the list of the Recently Used Documents.
963
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Selected pane This pane displays two kinds of data: Values already existing and passed from the invoking object, if
any. Values of the selections you have added from the left-hand pane, if any.
Buttons
Add Enabled when an element is selected in the left-hand pane. Adds the selected element to the
right-hand pane.
Remove Enabled when you select an item in the right-hand pane. Removes the selected item from the pane.
All removed values or objects are removed from the invoking property or diagram upon clicking OK.
Remove All Enabled when items are present in the right-hand pane. Removes all items from that pane. All
removed values or objects are removed from the invoking property or diagram upon clicking OK.
See Also
Hyperlinking overview ( see page 92)
This dialog box allows you to save the active diagram in the specified format. To open this dialog box, place the focus on the
diagram to export in the Diagram View and choose [File | Export Diagram to Image...].
Zoom Use this section to specify the zoom factor and dimensions of the image.
Z Enter a zoom factor.
W Enter the image width in pixels.
H Enter the image height in pixels.
Preview Click the down arrow to show the print preview page.
Preview zoom Use the slider to set up the preview zoom. The current value of the zoom factor is displayed to the left
of the slider.
Auto preview zoom Check this option to fit the image to the preview window.
Save Click this button to open the Save dialog box. Specify the target file name, target location, and the
format of the exported image.
See Also
Export and import features ( see page 100)
You can open the Extract Interface/Superclass dialogs from the Refactoring main menu, or by using the Refactoring | Extract
Superclass (or Extract Interface) commands on the context menu of applicable class diagram elements. The Extract Interface
964
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Together
command is available for classes, structures, methods, properties, events, and indexers. The Extract Superclass command is
available for classes, interfaces (Extract Superinterface), methods, properties, events, fields, and indexers.
See Also
Refactoring overview ( see page 98)
You can open the Extract Method dialog box from the Refactoring main menu, or by using the Refactoring Extract Method
command on several complete statements in the RAD Studio Editor.
Note This command is only available while working in the RAD Studio Editor.
Name Enter the name of the method to be created from the selected fragment of code.
Visibility Choose a visibility modifier from the drop-down list. Your choices are: public, protected, private,
internal, internal protected.
Header comment Enter a code comment describing the new method.
3
Static Check the checkbox to set the Static field, if necessary.
See Also
Refactoring Overview ( see page 98)
965
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Together features a UML documentation wizard that you can use to generate HTML documentation for your projects. To open
this dialog, choose [Tools | Generate Documentation...] from the main menu. The Together dialog boxes have built-in help, in
addition to this help.
Scope options You can limit the scope of the documentation to a smaller set by choosing a different Scope option.
The Scope section at the top of the dialog has radio buttons to indicate what parts of the project
should be parsed and included in the generated documentation:
Current namespace Generated output includes only the current namespace selected in the Model View or in the
Diagram View.
Current namespace Generated output includes the current namespace selected in the Model View and any descendent
with descendent namespaces under it.
namespaces
Current diagram Generated output for the current diagram that is in focus in the Diagram View.
All Generated output covers the entire project.
Options settings The Options section of the dialog has options to specify the destination and other optional actions:
Output folder Enter the location for the generated output, or select from the file chooser.
Include diagrams Check to include diagram images in the output.
Include navigation tree Check to include a navigation tree in the output.
Launch HTML browser Check to load the documentation into your external web browser.
Note The navigation frame in the documentation will work only if JDK/JRE 1.4 is installed and enabled in
your browser.
Buttons
OK Accepts the input and starts the generate documentation process.
Cancel Cancels your input and closes the dialog box without generating documentation.
See Also
Generating project documentation overview ( see page 100)
To open this dialog box, right-click a method (or function) and choose Generate Sequence Diagram from the context menu. The
Generate Sequence Diagram dialog box lists the classes and namespaces involved in the method (function) and allows you to
choose which classes/namespaces to display on the generated sequence diagram.
966
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Together
Fields
Name Lists the names of namespaces/classes involved in the method (function).
Show On Diagram Check the namespaces/classes that you want to show on the generated sequence diagram. All
namespaces and classes are selected by default. However, some classes may not be relevant. To
increase the meaningfulness of the generated diagram, clear the checkboxes that are not helpful in
explaining the sequence of operations.
Show Implementation For the elements that you decide to show in the diagram, check whether to show the implementation
details in the generated sequence diagram.
Buttons
OK Generates the new sequence diagram and opens the diagram in a new tab in the Diagram View.
Cancel Closes the dialog box without generating a sequence diagram.
Help Displays this help topic.
See Also
Roundtrip engineering overview
The dialog box reports the number of variable occurrences that the Inline Variable command will be applied to. Click OK to
complete the changes.
You can open the Inline Variable dialog box from the Refactoring main menu, or by using the Refactoring | Inline Variable
command on a local variable in the Delphi Code EditorVisual Studio Editor.
Note: The variable that you select should not be updated later in the source code. If it is, the error message "Variable index is
accessed for writing." opens.
Note: This command is only available while working in the Delphi Code Editor
Buttons
OK Creates the inline variable and closes the dialog box.
Cancel Discards all changes and closes the dialog box.
3
See Also
Refactoring overview ( see page 98)
967
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
You can open the Introduce Field dialog from the Refactoring main menu, or by using the Refactoring | Introduce Field command
on an expression in the Delphi Code EditorVisual Studio Editor.
Note: This command is only available while working in the Delphi Code Editor
See Also
Refactoring overview ( see page 98)
You can open the Introduce Variable dialog from the Refactoring main menu, or by using the Refactoring | Introduce Variable
command on a variable in the Code Editor.
Note: This command is only available while working in the Code Editor.
Name Enter a name for the new variable. The variable created is given the same type as the original
3 variable.
Replace all occurrences If applicable, check this field to replace all occurrences of the expression. The Introduce Variable
dialog indicates the number of occurrences that it will replace with the new variable. Note that the
refactoring does not replace any occurrences of the variable prior to the point in the code at which
you selected to introduce the new variable.
Buttons
OK Creates the new variable and closes the dialog box.
Cancel Discards all changes and closes the dialog box.
968
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Together
See Also
Refactoring overview ( see page 98)
This dialog box lets you enable or disable Together modeling support for the currently opened projects.
Item Description
Project list Displays the project in the current project groupsolution.
See Also
Activating Together Support for Projects ( see page 263)
The Move dialog opens when you choose the Move command from the Refactoring menu, or by using the Refactoring | Move
command on the context menu of static methods, static fields, and static properties (collectively, static members).
Move Members This field displays the list of selected static members. You can move more than one static member at
a time. Deselect/select the static members by clearing/checking the check box next to the name of a
member.
To (namespace fully Use this field to select a class where the static member or members will reside. You must enter a
qualified name) fully-qualified name for the class or click the browse button to select one.
Preview Usages By default, Preview Usages is checked. If this option is checked when you click OK, the Refactoring
window opens allowing you to review the refactoring before committing to it. If this option is cleared
when you click OK, the Refactoring window opens and the move is completed.
Buttons
OK Opens the Refactoring window.
Cancel Discards all changes and closes the dialog box.
See Also
Refactoring overview ( see page 98) 3
Moving code elements ( see page 188)
969
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
The Options dialog window displays a tree view of configuration option categories, each of which displays a set of individual
configuration options when selected. To open this dialog box, choose Tools Options on the main menu. Select the Together
folder from the tree view list on the left of the dialog window.
The Together dialog boxes have built-in help, in addition to this help. The help for a selected option is displayed at the bottom of
the dialog window.
The following option categories exist in the tree view under the configuration levels:
General The General options allow you to customize certain behaviors in the user interface that do not pertain
to any other specific category of options such as Diagram.
Diagram The Diagram options control a number of default behaviors and appearances of diagrams:
Appearance, Layout, Print, and View Management.
Generate The Generate Documentation options control the variety of content (as well as appearance) to
documentation include or exclude from your generated HTML documentation.
Model View The Model View options control how diagram content displays in the Model View.
Sequence diagram The Sequence Diagram Roundtrip options apply to generating sequence diagrams from source code
roundtrip and generating source code from a sequence diagram.
Source code The Source Code options allows you to control several LiveSource parameters.
Buttons
OK Applies changes, and closes the dialog window.
Cancel Closes the dialog window without saving any changes.
Help Displays the RAD Studio online help.
See Also
Configuring Together ( see page 183)
970
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Together
This dialog box enables you to print selected sets of audit report results to the specified printer. The dialog box is invoked from
the audit results report view.
Select View Choose the scope of the results to print using the Select View list box. Audit results display in
tabbed-pages in the audit results report view. You can group and ungroup the results using the Group
by command on the report view context menu.
Unless the results have been grouped using the Group by command, the Active Group option is not
enabled in the dialog. The possible view options are:
All Results: If the results are grouped, choosing All Results prints a report for all groups in the
current tabbed-page. If the results are not grouped, then all results print for the current tabbed-page.
Active Group : If the results are grouped, you can select a group in the current tabbed page to print
a report for the selected group.
Selected Rows: You can select single or multiple rows in the audit results report view. Choosing
Selected Rows prints a report for such selections.
Print zoom Type in a zoom factor for the printout. By default, the zoom factor is set to 1.
Fit to page Check this option if you want to print the results on a single page. If checked, the Print zoom field is
disabled.
Preview Click the down arrow to show the print preview page.
Preview zoom Use the Preview zoom (auto) slider to set the preview zoom. The current value of the zoom factor is
displayed to the left of the slider.
Auto preview zoom Check this option to fit the image to the preview window.
Buttons
Print Click Print to send the selected audits report to the default printer. Use the down arrow to choose the
Print dialog command, which enables you to configure the printer options.
Cancel Click to close the dialog box without printing the audits report.
Help Clicking Help opens this page.
See Also
Viewing audit results ( see page 274)
This dialog box enables you to print selected diagrams to the specified printer. The dialog box is invoked by choosing File | Print
from the main menu with a diagram open in the Diagram View.
Print diagrams From this list box, choose the diagrams to be printed. The possible options are:
Active diagram 3
Active with neighbors (all diagrams within the same namespace)
All opened diagrams
All diagrams in the model
Print zoom Enter a zoom factor for the printout. By default, the zoom factor is set to 1.
Fit to page Check this option if you want to print the diagram on a single page. If checked, the Print zoom field is
disabled.
971
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Preview Click the down arrow to show the print preview page.
Preview zoom Use the slider to set up the preview zoom. The current value of the zoom factor is displayed to the left
of the slider.
Auto preview zoom Check this option to fit the image to the preview window.
Print Press this button to send the selected diagrams to the default printer. Use the down arrow to choose
the Print dialog box command, which enables you to configure the printer options.
See Also
Printing a diagram ( see page 197)
You can open the Pull Members Up/Push Members Down dialog boxes from the Refactoring main menu, or by using the
Refactoring | Pull Members Up (or Push Members Down) commands on the context menu of applicable class diagram elements.
Both the Pull Members Up/Push Members Down commands are available for methods, properties, fields, indexers, and events.
Select members: A table displays the selected members that you have chosen to pull up (or push down). By default, all
members are selected. Use the checkboxes in the first column of the table to indicate which members
to pull up/push down. The third column allows you to indicate whether to make the member abstract.
Select the class to pull At the bottom of the dialog, a hierarchy displays. Select the class where you want to pull up/push
(or push) member to: down your selected members.
View references before By default, View references before refactoring is checked. If this options is checked when you click
refactoring: OK, the Refactoring window opens allowing you to review the refactoring before committing to it. If
this option is cleared when you click OK, the Refactoring window opens with the pull up/push down
operation completed.
Buttons
OK Opens the Refactoring window.
Cancel Discards all changes and closes the dialog box.
See Also
Refactoring overview ( see page 98)
Open the Audits dialog window by choosing Tools | Together | QA Audits from the main menu or by choosing QA Audits from the
Diagram View, Model View, or class/interface context menus.
972
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Together
Toolbar Use the Toolbar on the Audits dialog to load and save custom audit sets and to specify which audits
to run on your projects. The Toolbar buttons are descibed in the table below.
Toolbar button Description
Load Set Opens a file chooser for selecting an .adt file to load a custom set of audits.
Save Set As Opens a Save dialog for specifying the name and location to save the currently selected set of audits
as an .adt file.
Select All Checks the boxes for all audits in the dialog.
Unselect All Unchecks the boxes for all audits in the dialog box.
Set Defaults Resets the selected audits to correspond to the default set (saved in the default.adt file).
Find Audit Navigates to the audit whose name starts with the specified string.
Scope This field indicates the parts of the project that the Audits will be run against. Use the drop down
arrow to set the Scope for either the current Selection or for the entire Model. When choosing
Selection, audits are processed only for the diagram, namespace, or class that you selected before
invoking the Audits dialog. If you choose Model, audits are processed for the entire project.
Tip: If you have not selected any items in the Diagram or Model View, the Scope option defaults to
the entire project. If you want to run audits on specific classes, namespaces, or diagrams, make sure
you correctly select them before you open the Audits dialog.
Selection pane The selection pane provides a list of available audits, organized by category. Check the boxes for the
audits that you want to run. Check or clear the box for a category to select or unselect all of the audits
in the category. As you click on an audit in the selection pane, its corresponding description displays
in the lower pane of the dialog window. The descriptions include brief explanations of what the audit
looks for, examples of violations, and advice on how to correct the code.
Options pane The set of options vary depending on the selected audit. Where necessary, option controls are
explained in the description for the particular audit. Use the toolbar buttons to display properties in the
desired manner.
Other options are displayed when applicable to the selected audit.
Button Description
Categorized Displays the properties of the audit in expandable groups.
Alphabetic Displays the properties of the audit in alphabetical order.
Severity Severity is always present; you can assign an Info, Warning, Error, or Fatal level of severity to each
selected audit. The severity level defines how serious the violations are. The selected severity level is
displayed in the results.
Buttons
Start Runs the selected set of audits.
Cancel Discards all changes and closes the dialog box.
Help Opens this Help topic.
3
See Also
Quality Assurance facilities overview ( see page 98)
973
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Open the Metrics dialog by choosing [Tools | Together | QA Metrics...] from the main menu, or by choosing QA Metrics from the
Diagram View, Model View, or class/interface context menus.
Toolbar Use the Toolbar on the Metrics dialog window to load and save custom metrics sets and to specify
which metrics to run on your projects. The Toolbar buttons are described in the table below.
Button Description
Load Set Opens a file chooser for selecting a .mts file to load a custom set of metrics.
Save Set As Opens a Save dialog for specifying the name and location to save the currently-selected set of
metrics as a .mts file.
Select All Checks the boxes for all metrics in the dialog.
Unselect All Unchecks the boxes for all metrics in the dialog.
Set Defaults Resets the selected metrics to correspond to the default set (saved in the default.mts file).
Find Metrics Navigates to the metric whose name starts with the specified string.
Scope This field indicates the parts of the project that the Metrics will be run against. Use the drop-down
arrow to set the Scope for either the current Selection or for the entire Model. When choosing
Selection, Metrics are processed only for the diagram, namespace, or class that you selected before
invoking the Metrics dialog. If you choose Model, Metrics are processed for the entire project.
Tip: If you have not selected any items in the Diagram or Model View, the Scope option defaults to
the entire project. If you want to run Metrics on specific classes, namespaces, or diagrams, make
sure you correctly select them before you open the Metrics dialog.
Selection pane The selection pane provides a list of available Metrics, organized by category. Check the boxes for
the Metrics that you want to run. Check or clear the box for a category to select or unselect all of the
Metrics in the category. As you click on an metric in the selection pane, its corresponding description
displays in the lower pane of the dialog box. The descriptions include brief explanations of what the
metric looks for, examples of violations, and advice on how to correct the code.
Options pane The set of options vary depending on the selected metric. Where necessary, option controls are
explained in the description for the particular metric. Use the toolbar buttons to display properties in
the desired manner.
Other options are displayed when applicable to the selected metric.
Button Description
Categorized Displays the properties of the metric in expandable groups.
Alphabetic Displays the properies of the metric in alphabetical order.
3
Properties Displays property pages, if any.
Aggregation Aggregation is always present; Aggregation defines how the metric results are handled. You can
select the type of aggregation from the drop-down list (sum, average, maximum, and so on). It is
important to note that results are aggregated on each level separately. For example, if you have
nested namespaces, only the classes that belong to each namespace are aggregated.
Buttons
974
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Together
See Also
Quality Assurance facilities overview ( see page 98)
3.2.15.24 Rename
Refactor Rename
Opens when you choose the Rename command from the Refactoring menu, or by using the Refactoring | Rename command on
the context menu of code-generating class diagram elements. Renaming is applicable to classes, interfaces, enumerators,
structures, delegates, methods, properties, events, and fields.
New name: Use this field to enter a new name for the element.
Refactor Ancestors: If this option is checked, the selected member is renamed in the current node element and in its
parent elements. This option is available for members only.
Rename Overloads: If this option is checked, all methods with the same name are also renamed. This option is available
for members only.
View references before By default, View references before refactoring is checked. If this option checked when you click
refactoring: Rename, the Refactoring window opens allowing you to review the refactoring before committing to it.
If this option is cleared when you click Rename, the Refactoring window opens with the rename
completed.
Buttons
Rename: Opens the Refactoring window.
Cancel: Discards all changes and closes the dialog box.
See Also
Refactoring overview ( see page 98)
You can open the Safe Delete dialog box from the Refactoring main menu, or by using the Refactoring | Safe Delete command
on the context menu of applicable class diagram elements. The Safe Delete command is available for all code-generating class
diagram elements. It is not available for namespace elements.
975
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Going to safely delete A read-only field displaying the name of the element to delete.
the following elements:
Usages: A read-only field reporting if there are any usages of the element.
Buttons
Delete: Deletes the element and opens the Refactoring window. This button is active only if there are not any
usages found for the element.
View usages: The button is active only if usages are found. Clicking View usages opens the Refactoring window
where you can view the usages before you delete the element.
Cancel: Closes the dialog without deleting the element.
See Also
Refactoring overview ( see page 98)
This dialog box is invoked from the audit or metrics results report on pressing the Save button.
Select View Choose the scope of the results to export using the Select View list box. Audit results display in
tabbed pages in the audit results report view. You can group and ungroup the results using the Group
by command on the report view context menu.
Note: Unless the results have been grouped using the Group by command, the Active Group option
is not enabled in the dialog box.
The possible view options are:
All Results: If the results are grouped, choosing All Results prints a report for all groups in the
current tabbed page. If the results are not grouped, then all results export for the current tabbed
page.
Active Group: If the results are grouped, you can select a group in the current tabbed page, and the
generated report contains the results from the selected group.
Selected Rows: You can select single or multiple rows in the audit results report view. Choosing
Selected Rows generates a report for such selections.
Select Format Choose the output type from the list box.
XML: Generates an XML-based report.
HTML: Generates an HTML-based report.
3 Checkboxes Activated when generating an HTML report.
Add Description If this option is checked, the audit descriptions are saved in a separate folder with hyperlinks to the
descriptions from the results file.
Launch Browser If the option is checked, the generated HTML file is opened in the default viewer.
Select the Destination Specify the fully qualified path to the destination file, or click the Browse button.
976
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Together
Buttons
OK Applies specified settings, launches the report generation process, and closes the dialog box.
Cancel Discards all changes and closes the dialog box.
See Also
Quality Assurance Facilities Overview ( see page 98)
This dialog box provides a flexible tool to track references to, and overrides of, elements and members in the source-code
projects.
Option Description
Usages of element Find references to selected element.
itself:
Usages of members: Find references to members of selected element.
Usages of derived Find references to derived classes (or interfaces, in case of interface).
classes:
Usages of Find references to implementing classes (members).
implementations:
Usages of overloads: Find references to members that overload the selected one.
Include Usings\Imports: Find references in using\import statements.
Skip self: Do not show references that are contained inside the selected element.
See Also
Searching source code for usages ( see page 210)
This dialog box belongs to a general group of selection dialogs where you can choose interactions, operations, ancestor classes,
instantiated classes for the objects, etc. This dialog opens when you press the chooser button in a field of the Object 3
InspectorProperties Window, or when More is selected from the Choose Class or Choose Method menu nodes.
See Also
Instantiating a classifier ( see page 211)
977
Together RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Dialog title: The title of the dialog varies depending on the way it is invoked. It displays the string that corresponds
to the invoking object or property.
Model Elements tab or The pane on the left of the dialog displays the content available in your project. You can use the
Diagram elements tab: explorer to navigate to the element and select it for inclusion in the pane of values returned by the
dialog to the invoking object.
Existing and/or ready to This pane displays two kinds of data:
add: Values already existing and passed from the invoking object, if any.
Values of the selections you have added from the left-hand pane, if any.
Add: Enabled when an element is selected in the left-hand pane. Adds the selected element to the
right-hand pane.
Remove: Enabled when you select an item in the right-hand pane. Removes the selected item from the pane.
All removed values or objects are removed from the invoking property or diagram upon clicking OK.
Remove All: Enabled when items are present in the right-hand pane. Removes all items from that pane. All
removed values or objects are removed from the invoking property or diagram upon clicking OK.
See Also
Creating a Shortcut ( see page 208)
Use this dialog box to export a Together model to an XML file with the model described in XMI.
To open this dialog box, choose File | Export Project to XMI from the main menu while the project root node is selected in the
Model View. You can also right-click the project root node in the Model View and choose Export Project to XMI from the context
menu.
Select XMI type Choose the required XMI type from the list of supported types. Some of the elements supported by
Together are not allowed in IBM Rational Rose. The option, UML 1.3 (with Unisys Extension
recommended for Rose), drops all Rose-inconsistent elements. If such messages are encountered,
appropriate messages appear in the Output tab.
XMI Encoding Click the drop-down arrow to choose the required encoding of the output stream.
3
Select the Export Specify the fully-qualified name of the output XML file. Use the Browse button to define the target
Destination: location.
Buttons
Export Accepts the input and exports the model to XMI.
Cancel Cancels your input and closes the dialog box without exporting the model.
978
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
See Also
Import and export features overview ( see page 100)
Use this dialog box to import an XML file with the model described in XMI.
To open this dialog box, choose File | Import Project from XMI from the main menu while the project root node is selected in the
Model View. You can also right-click the project root node in the Model View, and choose Import Project from XMI from the
context menu.
Select the Source File Specify the fully-qualified name of the XML file. Use the Browse button to navigate to the target
location.
Buttons
Import Imports the XML file.
Cancel Cancels your input and closes the dialog without importing the model.
See Also
Import and export features overview ( see page 100)
3.2.16 Tools
Topics
Name Description
CodeGuard Configuration ( see page 980) Tools CodeGuard Configuration
Use the CodeGuard Configuration dialog box to specify how the CodeGuard
runtime debugger behaves.
Note: CodeGuard is available for only C++ projects.
979
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Tools Properties ( see page 1011) Tools Configure Tools Add and Edit button
Use this dialog box to enter or edit the properties for a program listed on the
Tools menu.
XML Mapper ( see page 1011) Tools XML Mapper
At design-time, defines the mappings between generic XML documents and the
data packets that client datasets use. Each mapping describes the
correspondences between the nodes of an XML document and the fields in a
data packet.
You can define mappings from an existing XML schema (or document) to a client
dataset that you define, from an existing data packet to a new XML schema you
define, or between an existing XML schema and an existing data packet.
Web App Debugger ( see page 1013) Tools Web App Debugger
Acts like a Web server on your development machine. If you build your Web
server application as a Web App Debugger executable, deployment happens
automatically during the build process. To debug your application, start it using
Run Run. Next, select Tools Web App Debugger, click the default URL
and select your application in the Web browser that appears. Your application will
launch in the browser window, and you can use the IDE to set breakpoints and
obtain debugging information.
Use the CodeGuard Configuration dialog box to specify how the CodeGuard runtime debugger behaves.
Item Description
Enable (CodeGuard) Enables or disables CodeGuard.
Stack Fill Frequency Specifies how frequently CodeGuard fills the uninitialized portion of the runtime stack with a unique
byte pattern. Values are:
• -1 = Never
• 0 = After every call to a runtime function covered by CodeGuard.
• n [0...15] = After every 2^n calls to a runtime function covered by CodeGuard. For example, if n
is 1, then the stack is filled every other time a runtime function is called.
980
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Source Path If the source code is in a different location from the executable, specify the path (or paths separated
by semicolons). CodeGuard checks its own debug source path first, then (if it is running in the IDE)
checks the IDE debug source path.
Resource Options
Use the Resource Options page to specify how CodeGuard covers various types of resources.
Item Description
Resources Lists the resource types that CodeGuard can cover, as follows:
Memory Block — Memory managed by malloc and free functions.
Object — Memory managed by new and delete operators.
Object Array — Memory managed by new[] and delete[] operators.
File handle — A file managed by the open and close functions.
File stream — A file managed by the fopen and fclose functions.
Pipe stream — A command processor pipe managed by the _popen and _pclose functions.
Directory stream — A directory managed by the opendir and closedir functions.
Enable Tracking Enables tracking on the selected resource. Disabling tracking results in lower memory usage and
faster execution.
Track Resource Leaks Reports resource allocations that have no matching deallocations. For example, a leak can be
caused by failing to free a file handle before the program terminates.
Report Invalid Handle / Reports incorrect usage of resources in function arguments.
Resource Parameters
Delay Free Tracks the selected resource after it has been deallocated. When you enable the Delay Free option,
CodeGuard marks the each resource once it has been freed and prevents Windows and runtime
libraries from attempting to reuse the resource.
Some resources, such as stack memory allocations, cannot be queued for delayed release.
Delay Queue Length Specifies the number of objects that can be queued for delayed release. You can set a maximum
value of 65535 objects.
Maximum Memory Specifies the maximum memory block size that CodeGuard can store in the delay queue. You can
Block Size set a maximum value of 65535 bytes.
Function Options
Use the Function Options page to specify how CodeGuard covers various types of functions.
Item Description
Functions Lists the functions that CodeGuard can track.
Disable Function Disables function tracking for the selected functions.
Tracking
Memory Access Errors Reports a runtime error if a function uses a pointer to reference invalid memory.
Log Each Call Reports each call to the selected functions. 3
Warnings Reports situations where your application may be accessing memory beyond a buffer's maximum
size.
Warnings are reported for only the following runtime library functions: strncmp, strnicmp,
strncmpi, _fstrncmp, _fstrnicmp, memcmp, memicmp, _fmemcmp, _fmemicmp, fnmerge,
fnsplit, getcurdir.
Function Results Errors Reports if the selected functions return a value that indicates failure.
981
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Invalid Handle / If any of the selected functions' parameters is a handle or resource identifier, verify that it has been
Resource Parameters properly allocated and is currently valid.
Set Default Function Displays the Set Default Function Options dialog box, which you can use to view and set the
Options default function options.
Reset To Default Applies the default function options to the selected functions.
Function Options
Ignored Modules
Use the Ignored Modules page to specify modules that you want CodeGuard to skip when it reports errors.
See Also
CodeGuard overview
Using CodeGuard
982
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
983
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Color ( see page 1004) Tools Options Translation Tools Options Color
Use this dialog box to define a color scheme for the Translation Manager.
Font ( see page 1004) Tools Options Translation Tools Options Font
Use this dialog box to set font preferences for the Translation Manager.
Form Designer ( see page 1004) Tools Options Translation Tools Options Form Designer
Use this dialog box to specify preferences for the forms displayed while using the
Translation Manager.
Packages ( see page 1005) Tools Options Packages
Use this dialog box to add or remove designtime packages from the resource
project in the External Translation Manager.
Translation Tools Options ( see page 1005) Tools Options Translation Tools Options
Use this dialog box to configure the Satellite Assembly Wizard, Resource DLL
Wizard, Translation Manager, and Translation Repository.
Repository ( see page 1006) Tools Options Translation Tools Options Repository
Use this dialog box to configure the Translation Repository.
Translation Repository ( see page 1006) View Translation Manager Translation Repository
Use the Translation Repository dialog to find, edit, and delete resource strings.
While in the Translation Manager, you can use the Translation Repository to
store and retrieve translated strings. By default, the Translation Repository stores
data in default.tmx, located in the RAD Studio/bin directory.
Use the toolbar icons to create, open, and save a Translation Repository .tmx
file. After opening a .tmx file, you can use the right-click context menu
commands to perform actions on individual resource strings.
Tip: To configure the Translation Repository, close it and choose
Tools->Options->Translation Tools Options->Repository
.
Type Library (Delphi) ( see page 1007) Tools Options Environment Options Delphi Options Type Library
Use this dialog box to select options for the Type Library editor.
WebSnap ( see page 1007) Tools Options WebSnap
Use this page to examine and set WebSnap options.
3.2.16.2.1 ASP.NET
Tools Options HTML/ASP.NET Options ASP. NET
Use this dialog box to set default information for creating ASP .NET Web applications.
984
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Use this dialog box to specify the range of exceptions on which you want the product to break execution. The numeric value that
you associate with each exception will be displayed at the bottom of the Exceptions list on the Native OS Exceptions page of
the Debugger Options dialog box.
Item Description
Range Low Specify the low value for the range.
Range High Specify the high value for the range.
Tip: To stop on a single value, specify the same value for the low and high range.
Use this dialog box to add a language exception to the list on the Language Exceptions page. To add the Notify on Language
Exception button to a toolbar, use Tools Toolbars Customize.
Item Description
Text Box Enter any intrinsic, framework-defined, or user-defined language type, for example,
System.Windows.Forms.Panel, Project123.WinForm, or MyClass.
Item Description
Select Updates Displays the changes, in order, that will be made to your project. Check or uncheck the box next to 3
each change to include or exclude the changes to that file. If you uncheck a change on which later
changes depend (for example the creation of a file to which later changes add code), the later
changes are automatically unchecked.
985
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Details Displays all the changes that will be added to implement the currently selected change. When you
click OK, the changes in this edit window, including any modifications you make within the dialog, are
added for every update checked in the Select Updates list.
If an update consists of new code that is added to a file, the Details box shows a single edit control
that displays the new code. If the update modifies existing code, the Details page shows two text
windows: the first is the new code that reflects the modifications, and the second shows the original
code that has been changed.
Don’t show this dialog Prevents this dialog box from being displayed each time you modify a type library and attempt to
again refresh, save, or register the type library. Check this box to implement changes without checking with
you.
Checking this box also unchecks the Display updates before refreshing option on the Type
Library page of Tools Options Environment Options Delphi Options.
Use this page to set the debugger options for the IDE.
Item Description
Allow side effects in Causes the watch to be evaluated even if doing so would cause side effects. Can be set for individual
new watches watches using the Watch Properties dialog box. By default, this option is not set.
Multiple evaluators Specifies that the appropriate evaluator (C++ or Delphi) is used for each module that is loaded in the
process you are debugging. For example, if your Delphi program loads a dll build with the C++
personality, the C++ evaluator is used when debugging into the C++ dll. If you uncheck this option,
only the evaluator that is appropriate for the active personality is used. Note that this option is only
available for the CodeGear Win32 Debugger.
Debug spawned Debugs processes that are spawned by the process you are debugging. If not checked, spawned
processes processes are run but are not under control of the debugger.
Ignore non-user Breaks only at breakpoints you have explicitly set using the IDE. When this option is checked, the
breakpoints native debugger ignores hardcoded int 3 breakpoints as well as breakpoints that result from a call
to the Windows API method DebugBreak . Additionally, pressing F12 while a native application is
running does not break into the debugger when this option is checked. The managed debugger also
ignores breakpoints that result from a call to System.Diagnostics.Debugger.Break.
When you change this option, the change takes effect immediately. The default value is Off.
Show inherited Switches the Debug Inspector dialog Data, Methods, and Properties panes between two modes:
one that shows all intrinsic and inherited data members or properties of a class, or one that shows
only those declared in the class. For class objects, this lets you determine whether you see members
that are part of an ancestor class or only members declared in the immediate class whose object you
are inspecting.
Show fully qualified Shows inherited members using their fully qualified names.
names
Sort by name Alphabetically sorts the pages of the Debug Inspector. If this option is not selected, the pages are
3 sorted by declaration order. Note that this option is ignored in Delphi for Win32 projects.
Inspectors stay on top Keeps all debugger inspector windows visible even if they are inactive.
Embedded in editor Specifies that the Disassembly view comes up as an integral part of the CPU view. This is the default.
Separate dockable Specifies that the Disassembly view comes up as a separate window that you can move around in
window the IDE.
Debug Symbols Search Specifies the path to your debug symbols files (.pdb) and .tds files. These files are normally stored
Path with your executable, or dynamic link library (DLL).
986
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Debug Source path Specifies directories where the CodeGear debuggers look for unit files that cannot be found on the
project search path or project source path.
Additional directories are searched in the following order:
1. Project-specific Debug Source path, specified on the Project Options Debugger page.
2. Browsing path, specified as follows:
• For Delphi for Win32: on Tools Options Environment Options Delphi Options Library
— Win32.
• For Delphi.NET, on Tools Options Environment Options Delphi Options Library —
NET.
• For C++, on Tools Options Environment Options C++ Options Paths and Directories.
3. Debug Source path (this option), for projects that do not have a project-specific Debug source
path and for debugging with no project loaded.
If no project is loaded in the IDE, only the directories specified with this option are searched.
See Also
Setting the Search Order for Debug Symbol Tables ( see page 129)
Use the Paths and Directories page to specify directories, compiler, and linker options for all packages.
Item Description
Include Path Specifies the directories with header files used by default for C++ projects.
Library Path Specifies where to find C++ header and library files for installed components and packages.
Package output Specifies where the compiler should put compiled packages files.
directory
BPI / LIB output Specifies where package bpi and lib files are placed by default. The lib is a static library and the
directory bpi is an import library. The default specified here can be overridden in individual packages by using
the package options.
Browsing path Specifies directories where the Project Browser searches for files when it cannot find an identifier on
the project search path or source path.
Restrict refactoring path Specifies the directories that you want to restrict from refactoring. For example, if you attempt to
rename a symbol, and a reference is found in a file on one of the paths specified here, the refactoring
ends with an error message.
Two built-in directories are automatically restricted from refactoring: $(BDS)\include\vcl and
$(BDS)\include\dinkumware. These two paths restrict refactoring from VCL sources and the
Dinkumware STL sources.
If you are using other third-party libraries (such as Boost), enter in this field the path where the library 3
header files are located.
Tip: You can enter a path relative to the RAD Studio root directory using the $(BDS)
environment variable.
987
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use the Type Library page to select options for the Type Library editor.
Item Description
Use dispinterfaces in If the component supports both vtable and IDispatch-based interfaces, checking this option
control wrappers causes the importer to make the dispinterface the default interface for the component. The
default behavior is to make the vtable-based interface the default interface.
MS-style property If this option is checked, the importer uses Microsoft Visual C++ style prefixes on property getter and
getter/setter prefixes setter methods. Otherwise, the default prefixes get_ and set_ are used.
Change suffix The type library importer appends the suffix _OCX to the component wrapper files it generates. You
can change this behavior by clicking Change suffix and typing a new suffix in the text field.
Ignore special CoClass When you import an ActiveX Control, the type library importer only imports CoClasses that are not
Flags when importing marked as Hidden, Restricted, or Predefined, and marked as CanCreate. These flags are
supposed to be set if the object is intended for general use. However, if you want to create a control
for an internal application only, you can override the flags to generate the CoClass wrappers. In this
case, you would check Ignore special CoClass flags when importing, Hidden, Restricted, and
uncheck CanCreate.
Check the coclass flags you want to ignore when importing ActiveX controls.
Predefined Client applications should automatically create a single instance of this object.
Restricted A coclass marked restricted is supposed to be ignored by tools that access COM objects. It is
exposed by the type library but restricted to those authorized to use it.
Hidden The interface exists but should not be displayed in a user-oriented browser.
Can Create The instance can be created with CoCreateInstance.
Use this page to configure how Code Insight works while editing code in the Code Editor.
Item Description
Source file type Displays a list of programming languages for which you can use Code Insight features. You can
specify different Code Insight options for each language.
Use Editor Font Use the same font as the Code Editor instead of the standard IDE font.
3
Code completion Displays a list of properties, methods and events when you enter a class name followed by a period
in the Code Editor. You can then select an item and press ENTER to add it to your code.
If this option is not checked, you can still invoke code completion by pressing CTRL+SPACE. The
default value is On (checked).
Error Insight Underlines invalid code and HTML in red. Positioning the cursor over invalid text displays a tooltip
window containing the probable cause of the error. The default value is On (checked).
988
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Code Template Automatically adds a code template when you type a token that starts a template and press TAB. The
Completion default value is On (checked).
Auto Complete Invokes code template completion when you press SPACE after you begin an existing template. When
Templates this option is disabled, you must press TAB to invoke template completion after you type in the
template name. The default value is On (checked).
Template Hints Enables template hints. Template hints appear when you add a template in the Code Editor and tab
between the preset cursor positions in the template. The default value is Off (unchecked).
Delay Sets the duration of the pause before a Code Insight window displays. Select from None, Low,
Medium or High.
See Also
Code Editor Overview ( see page 42)
3.2.16.2.9 Colors
Tools Options Editor Options Code Insight Colors
Use the Colors page to change the appearance of the Code Completion window.
Item Description
Source file type Displays a list of programming languages for which you can use Code Insight features. You can
specify different Code Insight options for each language.
Code Completion Specifies the color for each component of the Code Completion window.
Listbox Colors
See Also
Code Editor Overview ( see page 42)
3.2.16.2.10 Color
Tools Options Editor Options Color
Use this page to specify how the different elements of your code appear in the Code Editor.
Item Description
Color SpeedSetting Enables you to quickly configure the Code Editor display using predefined color combinations. 3
Select a Color SpeedSetting from the drop-down list and look at the sample code window to see how
the settings will appear in the Code Editor.
Bold Applies bold formatting to the selected element.
Italic Italicizes the selected element.
Underline Underlines the selected element.
989
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Foreground Displays the code element using default system colors for the foreground. Unchecking this option
restores the previously selected color or, if no color has been previously selected, sets the code
element to the system color.
Background Displays the code element using default system colors for the background. Unchecking this option
restores the previously selected color or, if no color has been previously selected, sets the code
element to the system color.
Element Specifies syntax highlighting for a particular code element. You can choose from the Element list box
or click the element in the sample Code Editor. As you change highlighting on code elements, you
can see the effect in sample code window.
Foreground Color Sets the foreground color for the selected code element. The foreground color changes automatically
for each element you choose in the Element list box.
Background Color Sets the background color for the selected code element.
Language display pane Click on the language tab to see how option choices affect appearance of that language's code
source.
Note: The foreground color and background colorsof the Modified line
item in the Element list are the colors used to mark lines modified since last save and lines modified and saved in the current
session, respectively.
Use this page to set general debugger options for the IDE.
Item Description
Integrated Debugging Activates the Integrated Debugger.
Map TD32 keystrokes Allows you to use the keystrokes from TD32 (Turbo Debugger 32-bit) in the IDE. When this option is
on run checked, the TD32 keymapping will be active anytime a debug session is in progress. Note that if this
option is selected, the Mark buffers read-only on run option is automatically checked as well and
cannot be unchecked.
Mark buffers read-only Marks all editor files, including project and workgroup files, read-only when the program is run. When
on run this option is selected, it will not change the attributes of the files after the program terminates. If the
file was not marked read-only before running the program, the product will change the attributes of
the file back to their original configuration after the program terminates.
Rearrange editor local Moves the Debugger area of the Code Editor context menu to the top when you run a program from
menu on run the IDE, for easier access the Debugger commands. Display the Code Editor context menu by
right-clicking anywhere in the Code Editor window.
Automatically close Closes all files that you did not explicitly open. If the debugger opened a file implicitly, that file is
files implicitly opened closed automatically at the end of the debug session if it has not been changed. Files that have been
while debugging edited or for which you have set a breakpoint are not closed automatically.
3 Registered debuggers An information-only list of the registered debuggers in the system. The current active debugger is
displayed in boldface. (Only displayed when there is more than one registered debugger.)
Use this page to specify preferences for the VCL Forms Designer.
990
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Item Description
Display grid Displays a grid of dots on the Designer to aid in aligning controls.
Use designer guidelines Enables guidelines on the Forms Designer. Guidelines facilitate the alignment of components on a
form.
Snap to grid Automatically aligns controls on the Designer to the nearest grid line as you move the control.
Grid size/Snap Sets grid spacing in pixels along the x- and y-axis. Specify a higher number increase grid spacing.
tolerance
Show Component Displays captions for nonvisual components you drop on a form or data module.
Captions
Show Designer hints Displays a class name in a tooltip for a nonvisual component on a form or data module.
Show extended control Displays a tooltip for controls that include the origin (position on the form), size (width and height), tab
hints stop (whether the user can tab to a control), and order that you added the control to the form.
Disabled if Show Designer hints is turned off.
Embedded Designer Displays VCL Forms on the Design tab next to the Code tab. If unchecked, VCL Forms are displayed
as undocked, floating windows, which is useful for viewing both the form and code at the same time.
If unchecked, you must use either the Classic Undocked Layout or the Default Layout with the
Dock Edit Window option unchecked.
Show virtual screen Displays the virtual screen position view in the lower-right corner of the Form Designer. Use this
position view to quickly set the on-screen runtime position of the form.
New forms as text Toggles the format in which form files are saved. The form files in your project can be saved in binary
or text format. Text files can be modified more easily by other tools and managed by a version control
system. Binary files are backward compatible with earlier versions of the product. (You can override
this setting on individual forms by right-clicking and checking or unchecking the Text DFM or Text
XFM command.)
Auto create forms & Toggles whether or not to automatically create forms. When unchecked, forms added to the project
data modules after the first one are put into the Available Forms list rather than the Auto Create list.
You can change where each form is listed by chooing Project Options Forms.
3.2.16.2.13 Library
Tools Options Delphi Options Library
Use this page to specify directories, compiler, and linker options for all packages.
Item Description
Library path Specifies search paths where compiler can find the source files for the package. The compiler can
find only those files listed in the library path. If you try to build your package with a file not on the
library path, you will receive a compiler error.
Package output Specifies where the compiler should put compiled packages files.
directory
DCP/DCPIL output Specifies a separate directory to contain the .dcp (Win32) or .dcpil (.NET) files. 3
directory
991
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Browsing path Specifies the directories where the Project Browser looks for unit files when it cannot find an
identifier on the project search path or source path.
For Win32 and .NET Delphi language projects, the directories specified with this option are appended
to the debug source path for the project. So the debugger search order for unit files is determined by
the following path settings:
1. The project-specific Debug Source path, specified on the Project Options Debugger page.
2. Browsing path (this option).
3. The global Debug Source path, specified on the Tools Options Debugger
Options CodeGear Debuggers page.
For C# and Visual Basic projects, or if no project is loaded in the IDE, only the Debug Source path
specified on the Tools Options Debugger Options CodeGear Debuggers page is
searched for source files.
Namespace prefixes Specifies the prefixes for dotted namespaces, to allow you to create a shorthand version of the
namespace in the uses clause in your code. For example, instead of writing CodeGear.Vcl.DB,
you could specify CodeGear.Vcl as your namespace prefix. In the uses clause, you could then
specify uses DB;.
Debug DCU/DCUIL To use this option, you must set Use Debug DCU/DCUILs on the Project Options Compiler
path page. When that option is set and a path is given, the debugger looks for the .dcu (Win32) or
.dcuil (.NET) files in this path before looking in the unit search path.
Tip: To list multiple values in an edit box, separate the values with a semicolon. Alternatively, click the ellipsis button next to
each edit box to add multiple values through an appropriate dialog box.
To specify operating system environment variables in an edit box, use the following syntax:
$(VariableName)
3.2.16.2.14 Display
Tools Options Editor Options Display
Use this page to set display and font options for the Code Editor.
Item Description
BRIEF cursor shapes Uses BRIEF editor cursor shapes.
Zoom to full screen Maximizes the Code Editor to fill the entire screen. When this option is off, the Code Editor does not
cover the main window when maximized.
Sort popup pages menu Sorts alphabetically the list of pages displayed when you right-click a Code Editor tab and click
Pages. If unselected, the pages are sorted in the order that they were created.
Show image on tabs Displays an icon on each tab in the Code Editor.
Visible right margin Displays a vertical line at the right margin of the Code Editor.
3 Show line numbers Displays the current line number and every tenth line number in the left margin of the Code Editor.
Number all lines Displays all line numbers in the left margin of the Code Editor.
Visible gutter Displays the gutter on the left edge of the Code Editor.
Right margin Sets the right margin of the Code Editor. The default is 80 characters.
Gutter width Sets the width of the gutter, default is 30.
992
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Editor font Select a font type from the available screen fonts installed on your system (shown in the list). The
Code Editor displays and uses only monospaced screen fonts, such as Courier. Sample text is
displayed in the Sample box.
Size Select a font size from the predefined font sizes associated with the font you selected in the Editor
font list box. Sample text is displayed below the Sample box.
Sample Displays a sample of the selected editor font and size.
Item Description
Insert mode Inserts text at the cursor without overwriting existing text. If Insert Mode is disabled, text at the cursor
is overwritten. (Use the Ins key to toggle Insert Mode in the Code Editor without changing this
default setting.)
Group undo Undoes your last editing command as well as any subsequent editing commands of the same type, if
you press ALT+BACKSPACE or choose Edit Undo.
Cursor beyond EOF Positions the cursor beyond the end-of-file character.
Double click line Highlights the line when you double-click any character in the line. If this option is not selected, only
the selected word is highlighted.
Force cut and copy Enables Edit Cut and Edit Copy, even when there is no text selected.
enabled
Auto-complete text to Enables auto-complete in the find dialog.
find
Create backup files Creates a backup file everytime you update and save a file in the IDE. Backup files are stored in the
current directory in a hidden directory named __history and can be managed from the History tab.
Use File backup limit to specify the number of backup files maintained in the __history directory.
Undo after save Allows you to retrieve changes after a save.
BRIEF regular Uses BRIEF regular expressions. Regular expressions assist in pattern-matching operations.
expressions
Persistent blocks Keeps marked blocks selected, even when the cursor is moved using the arrow keys, until a new
block is selected.
Overwrite blocks Replaces a marked block of text with whatever is typed next. If Persistent blocks is also selected,
text that you enter is appended following the currently selected block.
Find text at cursor Places the text at the cursor into the Text To Find list box in the Find Text dialog box when you
choose Search Find. When this option is disabled you must type in the search text, unless the
Text To Find list box is blank, in which case the editor still inserts the text at the cursor.
Preserve line ends Preserves end-of-line position. 3
993
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Editor SpeedSetting Provides a quick way to set the editor options by using preconfigured settings in the drop-down list.
Default uses key bindings that match CUA mappings (default).
IDE classic uses key bindings that match Borland Classic editor keystrokes.
BRIEF emulation uses key bindings that emulate most of the standard BRIEF keystrokes.
Epsilon emulation uses key bindings that emulate a large part of the Epsilon editor.
Visual Studio emulation uses key bindings that emulate a large part of the Visual Studio editor.
Visual Basic emulation uses key bindings that emulate a large part of the Visual Basic editor.
Undo limit Indicates the number of keystrokes that can be undone. The default value is 32,767.
The undo buffer is cleared each time the product generates code.
File backup limit If Create backup files is checked, controls how many backup files are maintained for files updated
and saved in the IDE. The default value is 10, but can be set to 1 through 90.
Reducing the File backup limit does not cause existing backup files to be deleted from the
__history directory.
See Also
Default Key Mapping ( see page 1073)
Item Description
Editor files Saves all modified files in the Code Editor when you run, compile, build the project, or exit the
product.
Project desktop Saves the arrangement of your desktop when you close a project or exit the product. When you later
open the same project, all files opened when the project was last closed are opened again,
regardless of whether they are used by the project.
Show compiler progress Displays the compilation status of your program as it compiles.
Minimize on run Minimizes the IDE when you run an application by choosing Run Run. When you close the
application, the IDE is restored. When you run an application without using the debugger, the IDE
remains minimized.
3 Hide designers on run Hides Designer windows, such as the Object Inspector and Alignment Palette, while the
application is running. The windows reappear when the application closes.
Show command line Displays the command used to compile the project in the Messages window when you compile a
project. In a C# environment, displays the command used to compile the project and the content of
the response file. The response file lists the compiler options and source files to be compiled.
Verbosity Specifies the verbosity level of the build output. Select Quiet, Minimal, Normal, Detailed, or
Diagnostics. The build output is written to the Output tab of the Messages window.
994
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Auto drag docking For undocked windows, allows you to dock tool windows by dragging the outline of the one window
over another window. If this option selected, pressing the CTRL key while dragging a window disables
the function. If this option is not selected, pressing the CTRL key enables it.
Shared Repository Specifies the path in which the product looks for the shared repository. Click the Browse button to
search directories.
Default Project Specifies the path in which the product looks for default project files. Click the Browse button to
search directories.
Use this page to view system environment variables and to create, edit, and delete user overrides.
Item Description
System variables Lists all environment variables and their values defined at a system level. You cannot delete an
existing system variable, but you can override it.
Add Override Displays the Override System Variable dialog box, allowing you to modify an existing system
variable to create a new user override. This button is dimmed until you select a variable in the
System variables list.
User overrides Lists all defined user overrides and their values. A user override takes precedence over an existing
system variable until you delete the user override.
New Displays the New User Variable dialog box allowing you to create new user override to a system
variable.
Edit Displays the Edit User Variable dialog box allowing you to change the user override currently
selected in the User overrides list.
Delete Deletes the user override currently selected in the User overrides list.
Use this dialog box to control the content, size, and appearance of the event log.
Item Description
Clear log on run Causes the event log to be purged at the start of each debug session. If this option is checked while
debugging multiple processes, the event log view is cleared when the very first process is started.
However, any process started while at least one process is already being debugged will not cause
the event log view to be cleared.
Unlimited length Removes the limit on the length of the event log. When this option is unchecked, set the maximum
length of the event log in the Length field.
3
Length Displays the maximum length of the event log. If the Unlimited length check box is checked, this
option is inactive. For multiple process debugging, length is the total for the event log, not for a
process. The default length is 100.
Scroll new events into Controls scrolling of the event log. Disable this option to prevent the event log from scrolling new
view events into view as they occur. (Set by default.)
Display process info Shows the process name and process ID for the process that generated each event.
with event
995
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Breakpoint Messages Writes a message to the event log each time a breakpoint or First-chance exception is encountered.
The message includes the current EIP address of the program being debugged in addition to
information about the breakpoint (pass count, condition, source file name, and line number) or
exception. (Set by default.)
Process Messages Writes a message to the event log each time a process loads or terminates, whenever a module is
loaded or unloaded by the process. (Set by default.)
Thread Messages Writes a message to the event log each time a thread is created or destroyed during a debugging
session. (Set by default.)
Module Messages Writes a message to the event log each time a module (executable, shared object, or package) is
loaded or unloaded. It includes the name of the module, its base address, and whether it has debug
information. (Set by default.)
Output Messages Writes a message to the event log each time your program or one of its modules calls
OutputDebugString. (Set by default.)
This setting is used only by the CodeGear Win32 Debugger.
Application Domain Writes out a message to the event log each time an application domain is created or unloaded. The
Messages application domain creation message precede process load messages for the application. The
application event unload message follows the process load messages for the application. (Set by
default.) This setting is used only by the CodeGear .NET Debugger.
Managed Debug Writes out a message to the event log each time a Managed Debug Assistant is triggered. (Set by
Assistant Messages default.) This setting is used only by the CodeGear .NET Debugger. More information on Managed
Debug Assistants can be found on MSDN at
http://msdn2.microsoft.com/en-us/library/d21c150d.aspx.
Windows Messages Writes a message to the event log for each window message that is sent or posted to one of your
application's windows. The log entry will have details about the message, including the message
name and any relevant data encoded in its parameters. Messages are not immediately written to the
log if your process is running and not stopped in the debugger. As soon as you pause the process in
the debugger (by encountering a breakpoint or using Run| Pause) the messages will be written to the
event log. (Off by default)
This setting is used only by the CodeGear Win32 Debugger.
Use Event Log Colors Associates colors with specific message types so that the message is displayed in that color in the
event log.
Foreground Sets the color for text that appears in the event log.
Background Sets the color for the background of the event log.
3.2.16.2.19 Explorer
Tools Options Environment Options Explorer
Use this page to control the behavior of the Structure view and Project Manager.
view and choose Properties to display this page as a separate Explorer Options dialog box.
3
Item Description
Highlight incomplete Displays incomplete properties and methods in bold in the Structure view .(Not applicable for C++
class items development.)
Show declaration Displays the syntax and type of methods or properties. By default, only the names of code elements
syntax are displayed in the Structure view . (Not applicable for C++ development.)
996
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Note: Not all of the options described below are available for all occurrences of this dialog.
Item Description
<ordered list> Lists the items that are to be searched, in the order shown. To add items to this list, use the text field
below the list.
or Moves the selected item up or down in the ordered list.
<text_field> Specifies an item to add or replace in the ordered list. You can type an item in this field, or click an
item in the list to select it and display it in this text field.
[...] (Ellipsis) Displays a dialog box allowing you to navigate to and select a folder. The item that you select is
displayed in the text field.
Replace Replaces the selected item with the item in the text field.
Add Adds the item in the text field to the ordered list of items.
Delete Removes the selected item from the ordered list.
Delete Invalid Paths Removes all greyed paths from the ordered list. A path is greyed if it is no longer valid.
Inherit values from Check this box if you want values for this list to be inherited from the Base build configuration. 3
configuration “Base”
<display_field> This display box lists the items that are controlled by the checkbox labeled Inherit values from
configuration “Base.” Items listed here are grayed to indicate that you cannot enter items into this
field or select individual items.
997
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this dialog box to specify preferences for editing HTML on the Designer.
Item Description
Show grid Displays a grid of dots on the Designer to aid in aligning controls.
Snap to grid Automatically aligns controls on the Designer to the nearest grid line as you move the control.
Grid size Sets grid spacing in pixels along the x- and y-axis. Specify a higher number increase grid spacing.
Render HTML controls Applies the current Windows theme to HTML controls on the Designer page (if you have Windows
using... XP installed and a theme enabled). This is useful for determining the effect of a theme on controls at
design time. At run time, the user's theme settings determines how the controls are displayed.
Insert DIV tag... Inserts a <DIV> tag to indicate a division or section in the HTML file when you press ENTER.
Otherwise, a <P> tag is inserted, indicating a paragraph.
Default Page Layout Sets the positioning of added components. Flow Layout: When a component is dropped, it is
positioned in a top to bottom, left to right fashion, flowing similarly to text in word processing. Grid
Layout: Components are positioned using absolute x- and y-coordinates.
Auto show Smart If true, a Smart Task window displays after a control is dropped on a Web Form.
Tasks when...
Highlight Designer Highlights the HTML control on the Designer when the corresponding tag is edited in the tag editor.
element when...
Select highlight color Activated when Highlight Designer element when.. is checked. Clicking this button displays a color
picker for the HTML control highlight color. Default is yellow.
Web Forms Used only for ASP.NET. Indicates what is displayed in the edit window when creating a Web
document. Designer: Displays a WYSIWIG designer. Markup Editor: Displays a code editor for
markup, such as HTML or ASP code. Code Editor: Displays a code editor for programming
languages, such as C#, C++, or Delphi.
HTML Similar to Web Forms. Indicates what is displayed in the edit window when creating a Web
document. Designer: Displays a WYSIWIG designer. Markup Editor: Displays a code editor for
markup, such as HTML or ASP code.
Use this dialog box to specify formatting preferences for auto-generated HTML on the Code tab.
Item Description
Using Spaces Indents generated HTML by using spaces.
3 Using Tabs Indents generated HTML by using the tab character.
Size Specifies the number of spaces used for tab indentation.
Place end tags on the Places closing HTML tags on the same line as the opening HTML tag.
same line
Tags Indicates whether HTML tags are generated in uppercase or lowercase.
Attributes Indicates whether HTML tag attributes are generated in uppercase or lowercase.
998
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Use this dialog box to control how HTML Tidy formats HTML in the Code tab. HTML Tidy is the standard "pretty print" formatting
tool from www.w3c.org.
Item Description
HTML Tidy Option List of HTML Tidy options to be used for all HTML formatting within the IDE. You can change each
Window option with a context menu.
Description Displays a description of the selected HTML Tidy option.
Use this page to configure how the debugger handles thrown language exceptions. The debugger always stops on unhandled
exceptions.
Item Description
Exception Types to Lists the types of exceptions you want the debugger to ignore (checked) or not (unchecked). The
Ignore debugger will not halt execution of your program if the exception raised is listed and checked, or
derived from any exception that is listed and checked.
Add Displays the Add Exception dialog box, allowing you to add a user-defined exception to the list.
Remove Removes the highlighted, user-defined exception from the list. You can not removed default language
exceptions from the list.
Notify on Language Halts the execution of your program when your program raises a language exception. If this box is
Exceptions checked, the debugger ignores the exception types you select in Exception Types to Ignore. To
place this command on your toolbar for easy access, use the
View Toolbars Customize Commands page.
Use this dialog box to determine how exceptions are handled by the debugger. Select an exception from the list and adjust the
Handled By and On Resume options.
Item Description
Exceptions Lists the native operating system exceptions and any user-defined exceptions.
Handled By Specifies whether the exception will be handled by the debugger or by your program. If you have
added exception handling to your project, select User Program. 3
On Resume Specifies whether the product will continue to handle the exception, or whether the project will run
unhandled.
Add Displays the Add Exception Range dialog box, allowing you to add user-defined exceptions to be
handled by the debugger.
Remove Removes the selected user-defined exception from the list. Native operating system exceptions can
not be removed.
999
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use this page to list tags that would normally cause HTML Tidy to issue a warning or error, such as ASP tags.
Item Description
Block level tags Enter the tags that HTML Tidy should process as block tags. Omit the begin (<) and end (>) symbols.
Separate multiple tags by a comma, for example:
asp:button,asp:checkbox
Empty tags Enter the tags that HTML Tidy should process as empty inline tags. Omit the begin (<) and end (>)
symbols. Separate multiple tags by a comma.
Inline tags Enter the tags that HTML Tidy should process as non-empty inline tags. Omit the begin (<) and end
(>) symbols. Separate multiple tags by a comma.
Pre tags Enter the tags that HTML Tidy should process the same way it processes the HTML <PRE> tag. Omit
the begin (<) and end (>) symbols. Separate multiple tags by a comma.
or
Project Options Debugger Environment block Add Override, New, and Edit buttons
Use this dialog box to create or modify user overrides for system variables.
Item Description
Variable Name Type a new variable name or modify an existing one.
Variable Value Type a new value or modify an existing one.
Use this page to configure the Object Inspector. You can also access this page by right-clicking the Object Inspector and
choosing Properties.
Item Description
SpeedSettings Displays a drop-down list box to choose from the following color schemes: Custom colors and
settings, Default colors and settings, Traditional colors and settings, Classic colors and settings, and
Visual Studio(TM) emulation.
3 Show instance list Displays the drop-down list box of components and their class names (called the instance list) at the
top of the Object Inspector. The list is useful when you have many components on your form or data
module and can’t find the one you want right away.
Show classname in Displays the component’s class name for every component in the instance list, not just the first one.
instance list
Show status bar Displays the status bar at the bottom of the Object Inspector. The status bar indicates how many
properties or events are not shown as a result of right-clicking the Object Inspector and selecting
View. If all properties or events are visible in the Object Inspector, it says All shown.
1000
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Render background Adds horizontal background lines to designate columns and rows on the Properties and Events
grid pages.
Integral height (when Adjusts the Object Inspector between a full row instead of a partial row as you vertically resize the
not docked) Object Inspector with your cursor.
Show read only Displays the properties for components even if the properties are read only. By default, they are
properties grayed out.
Bold non default values Displays non-default values as bold text in the current Non Default Value color setting.
Show gutter Draws an outline along the left edge of the Object Inspector and fills the outlined area with the
current Gutter Color setting for additional readability.
Colors To customize one of the imported color schemes, select it from the SpeedSettings list. Then select
an option and select a different color from the drop-down list below. For example, to change the color
of Value, the text color for properties’ values, select Value and click clYellow from the Options list.
You save your new settings once you click OK. This automatically saves the changes to the Custom
colors and settings scheme, not the original scheme.
To return to your default settings, click Default colors and settings or one of the others.
Expand inline Displays the properties of the referenced component. To view these properties, click the plus sign (+)
next to the referenced component. By default, referenced components are red and their properties
green.
Show on events page Displays the events of the referenced component. By default, referenced properties are red and their
events green.
Item Description
Source Code Control Activates a particular source code system provider. The providers must implement the SCC API or a
Providers wrapped client that exposes the API.
User Name Specifies a valid source control system user name. This user name must be defined in the source
control system.
Use this page to configure Code Editor settings for various types of source files.
Item Description
Source file type Choose a predefined or customized source file type. 3
New Displays the New source file type dialog box, allowing you to create a new file type. Enter a name
and click OK, and then enter an extension in the Extensions drop-down list. You must add an
extension if you add a new source file type, or cancel the operation.
Delete Deletes the predefined or customized file type displayed in the Source file type drop-down list box.
Auto indent mode Positions the cursor under the first nonblank character of the preceding nonblank line when you press
ENTER in the Code Editor.
1001
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Use tab character Inserts tab characters when you press TAB in the Code Editor. If not checked, pressing TAB inserts
spaces. If Smart tab is enabled, this option is off. To view tab characters, select Show tab
character.
Smart tab Tabs to the first non-whitespace character in the preceding line. If Use tab character is enabled, this
option is off.
Cursor through tabs Enables the arrow keys to move the cursor to the logical spaces within each tab character.
Optimal fill Begins every auto-indented line with the minimum number of characters possible, using tabs and
spaces as necessary.
Backspace unindents Aligns the insertion point to the previous indentation level (outdents it) when you press BACKSPACE, if
the cursor is on the first nonblank character of a line.
Keep trailing blanks Prevents trailing blanks from being truncated.
Show tab character Displays tab characters as >>, if Use tab characters is selected.
Show space character Displays typed spaces as dots (.).
Use syntax highlight Enables syntax highlighting. To set highlighting options, use the Color page.
Show line breaks Displays line break symbols at the end of each line.
Highlight current line Highlights the current line in the Code Editor.
Syntax Highlighter Choose an option to change the format for displaying code elements. Check Use syntax
highlighting to enable this option.
Block indent Specifies the number of spaces to indent a marked block. The default is 2; the upper limit is 16.
Tab stops Set tabs stops that the cursor will move to when you press TAB. Enter one or more integers
separated by spaces. If multiple tab stops are specified, the numbers indicate the columns in which
the tab stops are placed. Each successive tab stop must be larger than the previous tab stop. If a
single tab stop is specified, it indicates the number of spaces to jump each time you tab.
3.2.16.2.31 Colors
Tools Options Environment Options Tool Palette Colors
Use this dialog box to change the colors of the Tool Palette.
Item Description
Color Schemes Lists predefined color combinations. Select a color scheme from the drop-down list to display it
immediately in the Tool Palette.
You can not modify the default color schemes, however, you can select a color scheme and change
any of the colors associated with it to create your own unnamed color scheme.
Base Color (Category Specifies the color used for the category window background.
Colors)
Gradient Color Specifies the color used for shading the Base Color.
(Category Colors)
3
Text Color Specifies the color used for the category captions.
Bold Captions Applies bold formatting to the category captions.
Vertical Gradient Applies the Gradient Color value to the top of the category window, rather than the left side of the
window.
Caption Only Border Applies the Base Color, Gradient Color, and Text Color values only to the category captions, not
the entire category window.
Use +/– Icons Displays plus (+) and minus (–) signs next to category captions, instead of carets.
1002
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Vertical Captions Displays the category captions vertically on the left side of the category windows.
Normal Color Specifies the color used for the button background.
Selected Color Specifies the color used for the background of a button when it is selected and highlighted.
Hot Color Specifies the color used for the button when you hover the mouse over the button.
Base Color Specifies the color used for the frame around each category window.
(Background Colors)
Gradient Color Specifies the color used to shade the frame around each category window.
(Background Colors)
Gradient Direction Specifies whether the Gradient Color shading around the category window is vertical or horizontal.
Tip: As you change options in this dialog box, the Tool Palette
See Also
Adding Components to the Tool Palette ( see page 160),
Use this dialog box to change the appearance of the Tool Palette.
Item Description
Button Size Changes the size of the icons that represent items on the Tool Palette.
Auto Collapse Allows only one category to be expanded at a time.
Categories
Vertical Category Displays the category captions vertically to the left of items on the Tool Palette.
Captions
Lock Palette Ordering Disables drag-and-drop reordering of items on the Tool Palette.
Show Button Captions Displays captions along with item icons.
Vertical Flow Layout Displays the categories vertically.
Show Palette Wizards Displays items from the New Items dialog box in the Tool Palette when the Code Editor is active or
the Project Manager has focus. The New Items dialog box is also available by choosing
File New Other.
Always Show Designer Displays Designer items, even when the Code Editor is active (similar to Delphi 7 behavior).
Items Uncheck this option to omit Designer items from the Tool Palette when the Code Editor is active.
Tip: As you change options in this dialog box, the Tool Palette
1003
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
3.2.16.2.33 Color
Tools Options Translation Tools Options Color
Use this dialog box to define a color scheme for the Translation Manager.
Item Description
Color Scheme Lets you choose from a selection of predefined color schemes.
Save As Lets you add your own color scheme to the list.
Remove Removes a user-defined color scheme from the list.
Element Lists the elements in the Translation Manager. To set a color for an element, click the element and
then click a color in the color box.
Sample Shows how some of the selected colors will look in the Translation Manager.
User colors Controls color-coding in the Translation Manager.
See Also
Localizing Applications ( see page 18)
3.2.16.2.34 Font
Tools Options Translation Tools Options Font
Use this dialog box to set font preferences for the Translation Manager.
Item Description
Grid fonts Displays the languages and the fonts available to your project.
Sample Shows a sample of the selected font.
Font Displays the Font dialog box, allowing you to choose a font, font style, font size, effect, color, and
script for the language(s) you have selected in the Grid fonts box.
See Also
Localizing Applications ( see page 18)
Use this dialog box to specify preferences for the forms displayed while using the Translation Manager.
Item Description
3 Display grid Displays dots on the form to make the grid visible.
Snap to grid Automatically aligns components on the form with the nearest gridline. You cannot place a
component in between gridlines.
Grid size Sets the grid spacing in pixels along the x- and y-axis. Specify a higher number increase grid
spacing.
1004
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
3.2.16.2.36 Packages
Tools Options Packages
Use this dialog box to add or remove designtime packages from the resource project in the External Translation Manager.
Item Description
Add Lets you navigate to the designtime packages that you want to add to the project. You can add one or
more designtime packages at a time.
Remove Removes the selected designtime packages from the project.
Use this dialog box to configure the Satellite Assembly Wizard, Resource DLL Wizard, Translation Manager, and Translation
Repository.
Item Description
Automatically query Automatically populates resource modules with translations for any strings that have matches in the
repository Translation Repository, each time your assemblies are updated.
If only one match for a string is found in the Translation Repository, that translated string is copied to
the resource modules project. If more than one match is found, the first matching translation in the
Repository is copied to the assembly. You can change this behavior by choosing
Tools Translation Tools Options, clicking the Repository tab, then changing the Multiple Find
Action setting.
Automatically compile Compiles projects, without asking first, whenever required by the translation tools (for example, when
projects running the Satellite Assembly Wizard).
Show Translation Opens the Translation Manager automatically after running the Satellite Assembly Wizard or
Manager after wizard Resource DLL Wizard unless one of the resource module projects is active in the Project Manager
when you use the wizard.
Automatically quote Supplies required quotation marks around translated strings, unless the strings already contain
strings apostrophes, quotation marks, or control characters (such as #13).
Use 'Newly Translated' When a string is manually translated, or automatically translated from the Translation Repository, the
Status status of the string is changed Newly Translated instead of Translated. This status is used to
determine items which are translated in current translation.
Automatically save files Saves the current project, without asking first, whenever appropriate (for example, before closing the
Translation Manager or running the Satellite Assembly Wizard or Resource DLL Wizard).
Hide empty items Hides files that do not contain translation items, such as .nfn and .resN files, in the Workspace tab
tree view of the Translation Manager. This can improve performance when processing many files,
some of which are empty, with the Add strings to repository or Get strings from repository commands.
External editor Indicates the name of the editor to use when using an external editor in the Translation Manager, for
example, notepad.exe. 3
See Also
Localizing Applications ( see page 18)
1005
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
3.2.16.2.38 Repository
Tools Options Translation Tools Options Repository
Item Description
Filename Sets the location of the Translation Repository, a database for translations that can be shared by
different projects.
Enter the full name and directory path of the .tmx file where the Translation Repository is stored.
The default is $(ETM)\default.tmx.
Duplicate action Determines how the repository responds when it finds a duplicate translation string for the same
source string.
Skip does not add the string.
Add adds the string to the repository if no translated string exists for the original string.
Force Add always adds the string to the repository, regardless of whether it exists in the repository.
Replace overwrites the existing string with new string.
Display selection offers the user a choice.
Multiple find action Determines how the repository responds when it finds more than one translation for the same source
string.
Skip does not retrieve anything if the repository contains more than one match.
Use first retrieves the first match.
Display selection offers the user a choice.
See Also
Localizing Applications ( see page 18)
Use the Translation Repository dialog to find, edit, and delete resource strings. While in the Translation Manager, you can use
the Translation Repository to store and retrieve translated strings. By default, the Translation Repository stores data in
default.tmx, located in the RAD Studio/bin directory.
Use the toolbar icons to create, open, and save a Translation Repository .tmx file. After opening a .tmx file, you can use the
right-click context menu commands to perform actions on individual resource strings.
Tip: To configure the Translation Repository, close it and choose Tools->Options->Translation Tools Options->Repository
See Also
3 Localizing Applications ( see page 18)
1006
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Use this dialog box to select options for the Type Library editor.
Item Description
SafeCall function Determines which functions are declared as safecall when declarations specified in Delphi are
mapping converted to Interface Definition Language (IDL) in the generated type library.
Safecall functions automatically implement COM conventions for errors and exception handling,
converting HRESULT error codes into exceptions. If you are entering function declarations in IDL,
you must explicitly specify the calling convention as safecall or stdcall.
All v-table interfaces uses SafeCall for all interfaces.
Only dual interfaces uses SafeCall only for dual interfaces.
Do not map does not use the SafeCall calling convention.
Pascal Delphi language.
IDL Microsoft Interface Definition Language.
Ignore special CoClass When you import an ActiveX Control, the type library importer only imports CoClasses that are not
Flags when importing marked as Hidden, Restricted, or Predefined, and marked as Can Create (actually noncreatable).
These flags are supposed to be set if the object is intended for general use. However, if you want to
create a control for an internal application only, you can override the flags to generate the CoClass
wrappers. In this case, you would check Ignore special CoClass flags when importing, Hidden,
Restricted, and uncheck Can Create (noncreatable).
Predefined Client applications should automatically create a single instance of this object.
Restricted A coclass marked Restricted is ignored by tools that access COM objects. It is exposed by the type
library but restricted to those authorized to use it.
Hidden The interface exists but should not be displayed in a user-oriented browser.
Can Create The instance can be created with CoCreateInstance.
Display updates before Displays the Apply Updates dialog box, which provides a chance to preview proposed changes to
refreshing the sources when you try to refresh, save, or register the type library.
If this option is not checked, the type library editor automatically updates the sources of the
associated object when you make changes in the editor.
3.2.16.2.41 WebSnap
Tools Options WebSnap
Item Description
Enable Debugging Enables the active script debugger when an error occurs while debugging a web page module.
3
HTML File Extension Specifies which file extension you want the New WebSnap Application wizard to apply to HTML
files it generates.
Sample Image File Used by adapter components to display a sample image in the event that the correct image is not
available at design time. Click Browse to locate the path for the sample image.
Note: WebSnap is being deprecated in RAD Studio. Although WebSnap is still documented in the online help, the WebSnap
product is no longer fully supported. As an alternative, you should begin using IntraWeb (VCL for the Web). IntraWeb is
1007
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
documented in this online help. For more documentation on VCL for the Web, go to http://www.atozed.com/intraweb/docs/.
Item Description
Tools Lists programs that have been added to the Tools menu.
Add Displays the Tools Properties dialog box, allowing you to add a program.
Delete Deletes the tool selected in the Tools list, allowing you to change the properties of the program.
Edit Displays the Tools Properties dialog box.
Up and Down arrows Moves the tool selected in the Tools list up or down, which changes the order in which the tools
appear on the Tools menu.
Use this dialog box to edit information about an object in the Object Repository.
Item Description
Category Displays the categories that appear in the New Items dialog box displayed when you choose
File New Other.
Title Indicates the title of the selected item.
Description Indicates the description of the selected item. The description is displayed when you right-click the
New Items dialog box and choose View Details.
Author Indicates the name of the author of the selected item.
Browse button Displays the Select icon dialog box, allowing you to select a different icon to represent the object in
the New Items dialog box. You can use a bitmap of any size, but it will be cropped to 60 x 40 pixels.
New Category Displays the New Category Name dialog box where you enter the name for a new Object
Repository category.
Use this dialog box to add or change build tool titles and file associations.
Item Description
Title Enter the name you want to use for the tool.
1008
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Default Extensions List the file extensions that the tool will compile by default. The tool will be run automatically for files
in your project with this extension whenever you compile or build the project. Separate multiple
extensions with semicolons. In the Project Manager, you can right-click on files with this extension to
access the tool.
Other Extensions List the file extensions for which the tool will be used occasionally. This is useful for tools such as
preprocessors, archiving tools, diagnostics, or auto-help generators. Separate multiple extensions
with semicolons. In the Project Manager, you can right-click on files with this extension to access the
tool.
Target Extension Specify the extension of files that the tool creates (if any).
Command Line Specify the command line to be executed when a file of this type is built.
Filter Indicate a custom filter in a package (created using the Tools API) used to filter the tool output
information and display it in the Messages window.
If no filter is specified, a default filter is used. The default filter sends anything written by the tool to
stdout and stderr to the Messages window.
Macros Displays a list of macros that you can use in the command line (for example, $NAME gets a file
name). The macros are expanded when the tool runs. Double-click the macro or click Insert to add it
to Command Line.
Inserts Adds the selected macro to Command Line.
Use this dialog to convert the current project to a Microsoft Visual Studio project.
Item Description
Name Prefilled with the current project name. You can change the name.
The History Manager is displayed on the History tab, which is in the center of the IDE to the right of the Code tab. The History
Manager contains the following tabbed pages:
Page Description
Contents Displays the current and previous versions of the file.
Info Displays all labels and comments for the active file. 3
Diff Displays the differences between the selected versions of the file.
Button Description
Refresh revision info updates the revision list to include unsaved changes to the file.
1009
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Revert to previous revision makes the selected version the current version and is available on the
Contents and Info pages.
Reverting a prior version deletes any unsaved changes in the editor buffer.
Synchronize scrolling synchronizes scrolling in the Contents and Diff pages and the Code Editor. It
matches the line of text that contains the cursor with the nearest matching line of text in the other view.
If there is no matching text in that region of the file, it matches line numbers.
Go to next difference repositions the source on the Diff page to the next block of different code.
Go to previous difference repositions the source on the Diff page to the previous block of different
code.
Follow text movement locates the same line in the source viewer when switching between views.
The following icons are used to represent file versions in the revision lists.
Icon Description
The latest saved file version.
A backup file version.
The file version that is in the buffer and includes unsaved
changes.
A file version that is stored in a version control repository.
A file version that you have checked out from a version control
respository.
See Also
IDE Tour ( see page 34)
Use this dialog box to edit, move, and remove form and project template libraries.
Item Description
Categories Lists the categories available that contain project and form templates in the Object Repository.
Repository Objects Lists the project and form templates within each category.
Edit Displays the Edit Object Info dialog box, allowing you to edit the properties of templates in the
Object Repository.
3 Delete Removes a template from the Object Repository.
1010
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Item Description
Name column Displays the names of each template library listed.
Version column Displays the current version of each template library listed.
Description column Displays the descriptions of each template library listed.
Path column Displays the complete path to the location of each template library.
Properties Opens a window which displays the Categories in which the template library is listed in the Object
Repository and the name and description of each object in the template library.
Add Opens a browser enabling you to select an existing template library to add to the list.
Remove Deletes the selected template library from the list. It does not delete the template library from the disc.
Use this dialog box to enter or edit the properties for a program listed on the Tools menu.
Item Description
Title Enter a name for the program you are adding. This name will appear on the Tools menu. To add an
accelerator to the menu command, precede that letter with an ampersand (&). If you specify a
duplicate accelerator, the Tool Options dialog box displays a red asterisk (*) next to the program
names.
Program Enter the location of the program you are adding. Include the full path to the program. To search your
drives and directories to locate the path and file name for the program, click the Browse button.
Working Dir Specify the working directory for the program. The product specifies a default working directory when
you select the program name in the Program text box. You can change the directory path if needed.
Parameters Enter parameters to pass to the program at startup. For example, you might want to pass a file name
when the program launches. Type the parameters or use the Macros button to supply startup
parameters. You can specify multiple parameters and macros.
Macros Expands the Tool Properties dialog box to display a list of available macros. You can use these
macros to supply startup parameters for your application. Select a macro and click Insert to add the
macro to the Parameters text box.
Browse Displays the Select Transfer Item dialog box opens, allowing you to navigate to a program.
At design-time, defines the mappings between generic XML documents and the data packets that client datasets use. Each
3
mapping describes the correspondences between the nodes of an XML document and the fields in a data packet.
You can define mappings from an existing XML schema (or document) to a client dataset that you define, from an existing data
packet to a new XML schema you define, or between an existing XML schema and an existing data packet.
1011
Tools RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
represents:
Item Description
Represents an element node that is a tag that acts as a parent to other nodes (tags), but does not
have a value. The name of the node is the tag name. Typically, element nodes map to datasets (the
data packet itself or a nested detail set), although they can also map to fields whose values are a
composite of the child node values.
Represents a text node. Text nodes represent tagged elements with text values. In the tree, they
have the form Nodename="TextValue", where Nodename is the tag name and TextValue is the text
that appears between the starting tag and the ending tag. Typically, text nodes map to fields in the
corresponding data packet.
Represents an attribute node. Attribute nodes correspond to attributes of the parent element’s tag in
the XML document. In the tree, attributes have the form Nodename="AttributeValue", where
Nodename is the name of the attribute and AttributeValue is its value. Typically, A nodes map to
fields in the corresponding data packet, where the element for which they are attributes maps to a
record.
Represents a nested node. Nested nodes are element nodes that can appear replicated sequentially
in the XML document. Typically, nested nodes map to records in the corresponding data packet.
Data View If unchecked, the hierarchy displays only the names and types of nodes. No values are shown for text
or attribute nodes, and only a single instance is shown for any nested nodes.
If checked, the hierarchy displays sample values on text and attribute nodes, and repetitions of
nested nodes. If you loaded a sample XML file, the Data View shows the values stored in that file. If
the document was generated from a schema or data packet, sample values are generated for the
nodes.
When examining a large XML document, it is sometimes easier to uncheck Data View, so you can
see more of the logical structure with the detailed information removed.
Item Description
UTF-8 encoded Controls whether extended characters are encoded using UTF-8 (when checked) or using an escape
sequence in the XML (when unchecked). When checked, the Data Format property for Strings,
Memos, and WideStrings changes from ANSI to UTF-8.
User Defined Controls whether the selected node should be transformed automatically. This allows you to perform
Translation conversions that are not simple one-to-one mappings that can be specified by giving a data type. For
3 example, you can create a user-defined node to convert an element node that has children for first
name and last name into a single "full name" field in the data packet. When you check the User
Defined check box, you must assign an ID string to represent the node. This ID string is passed to
the OnTranslate event handler of TXMLTransform so that you can perform the translation in code. If
you do not identify a node as user-defined, the OnTranslate event does not occur for the node.
Node Description Optional. Enter a description of the node. This description is not added to the XML document or the
data packet, but is useful for identifying the purpose of a base set element when you are saving
property sets to a node repository file
1012
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Tools
Tip: To save the current node settings to a node repository file, right-click and choose Save Repository. To read a set of node
settings from a node repository file, right-click and choose Open Repository. To back out all changes made on the Node
Properties
page, reverting to the values deduced from the XML document, right-click and choose Clear.
Mapping Page
This page lets you specify the mapping between fields in the data packet and nodes in the XML document, create a
transformation file, and save the transformation file.
The top of the page displays a two-column table that lists the nodes from the XML document and the corresponding fields in the
data packet. When you first display the mapping page, this table is empty. In order to define a mapping, you must fill this table.
Note: You can only add nodes with values (text and attribute nodes), or nodes that have been marked as user-defined using the
Node Properties
page.
Item Description
Represents the entire data packet or a dataset field. The children of a dataset node represent the
fields in that dataset.
Represents a field that is not a dataset field. The children of a field node represent the attributes of
the field.
Represents a field attribute, such as the data type, maximum length, and so on. The node is labeled
with a string of the form AttributeName = Value, where AttributeName is the name of the field
attribute and Value is its value.
Item Description
Represents an element node. Element nodes in data packets represent datasets or dataset fields.
Represents an attribute node. Attribute nodes in data packets represent fields (unless they are
dataset fields).
Represents a nested node. Nested nodes in data packets represent records.
Note: XML mapper can use a data packet in binary format (a .cds
file) as well as data packets that have been saved as XML. If you use a data packet in binary format, XML mapper converts it to
XML format.
3
See Also
Using XML in Database Applications
1013
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Acts like a Web server on your development machine. If you build your Web server application as a Web App Debugger
executable, deployment happens automatically during the build process. To debug your application, start it using Run Run.
Next, select Tools Web App Debugger, click the default URL and select your application in the Web browser that appears.
Your application will launch in the browser window, and you can use the IDE to set breakpoints and obtain debugging
information.
See Also
Types of Web Server Applications
3.2.17 View
Topics
Name Description
Add to Repository ( see page 1017) Adds strings in the selected unit to the Translation Repository. This dialog is
displayed when you right-click a node on the Workspsace tab of the Translation
Manager and use the Add strings to repository comand.
To add individual strings, rather than adding the strings for an entire unit,
right-click the string in the Translation Manager and choose Repository Add
strings to repository.
The following options determine the criteria used for adding the strings.
Debug Windows ( see page 1018)
Code Explorer ( see page 1033) View Code Explorer
Navigates through the unit files. The Code Explorer contains a tree diagram that
shows all of the types, classes, properties, methods, global variables, and global
routines defined in your unit. It also shows the other units listed in the uses
clause. Right-click an item in the Code Explorer to display its context menu.
When you select an item in the Code Explorer, the cursor moves to that item’s
implementation in the Code Editor. When you move the cursor in the Code
Editor, the highlight moves to the appropriate item in the Code Explorer.
The Code Explorer uses... more ( see page 1033)
Customize Toolbars ( see page 1033) View Toolbars Customize
Changes the toolbar configuration. Using this dialog box, you can add, remove,
and rearrange buttons on toolbars.
Data Explorer ( see page 1034) View Data Explorer
Adds new connections, modifies; deletes, or renames your connections. You can
browse database server-specific schema objects including tables, fields, stored
procedure definitions, triggers, and indexes. Additionally, you can drag and drop
data from a data source to a project to build your database application quickly.
The Data Explorer commands available depend upon the object selected in the
tree view. Commands are available for the following nodes:
• Provider types
• Provider connections
• Tables node
• Individual tables
• Individual views
3 • Individual stored procedures
Delete Saved Desktop ( see page 1036) View Desktops Delete Desktop
Delete a saved desktop by selecting it from the list and clicking Delete.
Desktop Toolbar ( see page 1036) Selects an existing desktop layout or saves the current settings as a desktop
layout. The Desktop toolbar is located at the far right end of the upper toolbar in
the IDE.
1014
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
1015
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
1016
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
To add individual strings, rather than adding the strings for an entire unit, right-click the string in the Translation Manager and
choose Repository Add strings to repository.
The following options determine the criteria used for adding the strings.
Item Description
Status Adds strings based on the status displayed in the Status column on the Workspace tab. Check the
statuses that you want to add.
Duplicate action Determines how the repository responds when it finds a duplicate translation string for the same
source string.
Skip does not add the string.
Add adds the string to the repository if no translated string exists for the original string.
Force Add always adds the string to the repository, regardless of whether it exists in the repository.
Replace overwrites the existing string with new string.
Display selection offers the user a choice.
Include context Adds the unit path, and the value displayed in the Id column of the Workspace tab, to the Translation
information Repository. This context information is displayed in the status bar when you select a string in the
Translation Repository.
Value Indicates whether a string is added based on changes to its original value.
Changed adds the string only if the original and translated values are different.
Unchanged adds the string even if the original and translated values are the same.
Don't care adds the string, whether it has changed or not, provided the string meets the other criteria
set in this dialog box.
Comment Adds or excludes strings based on the text in the Comment column on the Workspace tab. Type the
comment text in the edit box and check Include to add strings with a matching comment, or check
Not include to exclude strings with a matching comment.
Tip: To set general options for the Translation Repository, choose Tools->Translation Tools Options
See Also
Localizing Applications ( see page 18)
3
1017
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
1018
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Disassembly ( see page 1032) View Debug Windows CPU Windows Disassembly
Displays the address, the hexadecimal representation of the machine code
instructions (opcodes), and the assembly instructions for each line of source
code. The address is the offset into the disassembled method.
Memory ( see page 1032) View Debug Windows CPU Windows Memory
Displays the raw values contained in addressable areas of your program.
Displayed only for unmanaged code. The pane displays the memory addresses,
the current values in memory, and an ASCII representation of the values in
memory.
There are four different views in order to view four distinct areas in memory at the
same time. You can have more than one view and then use Search Goto
Address in the separate views to look at different places in memory at the same
time.
Registers ( see page 1032) View Debug Windows CPU Windows Registers
Displays the contents of the CPU registers of the 80386 and greater processors.
Stack ( see page 1032) View Debug Windows CPU Windows Stack
Displays the raw values contained in the program stack. Displayed only for
unmanaged code.
Adds a module load breakpoint that will halt program execution when the module is loaded. You also use this dialog when you
click Edit Type the module name (usually a DLL or package) into the edit box, or click the Browse button to navigate to the
module.
This dialog box also adds the module to the Modules window. Modules are automatically added to the Modules window when
they are loaded into memory, but if you want to halt execution for debugging when the module first loads into memory, you must
add it to the modules window.
See Also
Modules Window ( see page 1028)
1019
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Displays, enables, or disables breakpoints currently set in the loaded project. Also changes the condition, passes count, or
groups associated with a breakpoint. If no project is loaded, it shows all breakpoints set in the active Code Editor or in the CPU
window.
Column Description
Indicates whether the breakpoint is enabled or disabled. Check the box to enable the breakpoint.
Uncheck it to disable the breakpoint.
Filename/Address The source file for the source breakpoint or the address for the address breakpoint.
Line/Length The code line number for the breakpoint or the length (the number of bytes to watch) for the data
breakpoint.
Condition The conditional expression that is evaluated each time the breakpoint is encountered. Click a
condition value to edit it.
Action The action associated with breakpoints.
Pass Count The current pass and the total number of passes specified for the breakpoint. Click a pass count
value to edit it.
Group The group name with which the breakpoint is associated. Click a group value to edit it.
The following icons are used to represent breakpoints in the Breakpoint List window.
Icon Description
The breakpoint is valid and enabled.
The breakpoint is valid and disabled.
The breakpoint is set at an invalid location, such as a comment, a blank line, or invalid declaration.
Item Description
Add Opens dialog boxes where you can create new breakpoints.
Delete All Removes all breakpoints. This command is not reversible.
Disable All Disables all enabled breakpoints. When you disable a breakpoint, its settings remain defined, but the
breakpoint does not cause your program to stop. Disabling is useful when you temporarily do not
need a breakpoint but want to preserve its settings.
Enable All Enables all disabled breakpoints.
Disable Group Disables the breakpoint group that you select.
Enable Group Enables the breakpoint group you select.
3 Dockable Toggles whether the Breakpoint List window is dockable.
Stay On Top Keeps the window visible when out of focus.
1020
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Item Description
Enabled Toggles between enabling and disabling a breakpoint.
Delete Removes a breakpoint.
View Source For source breakpoints, locates a breakpoint in your source code. For address breakpoints, displays
the location in the CPU window.
Edit Source For source breakpoints, locates a breakpoint in your source code and activates the Code Editor. For
address breakpoints, displays the location in the CPU window.
Properties Displays the Breakpoint Properties dialog box, where you can modify breakpoints.
Breakpoints Displays a menu of breakpoint commands.
Stay On Top Keeps the window visible when out of focus.
Dockable Enables drag-and-dock for the Breakpoint List window.
Displays the function calls that brought you to your current program location and the arguments passed to each function call. The
Call Stack window lists the last function called, followed by each previously called function. The first function called is at the
bottom of the list. If debug information is available for a function, it is followed by the arguments that were passed when the call
was made.
Double-clicking an item in the Call Stack window displays both the source for the frame and the locals for the frame.
To toggle a breakpoint on a particular frame, either click the breakpoint icon in the far left column, or right-click the frame and
click the Toggle Breakpoint command on the context menu. The icon in the far left column of the Call Stack window indicates the
following:
Item Description
View Source Scrolls the Code editor to the location of the function call that is selected in the Call Stack window,
but does not give the Code editor focus.
Edit Source Scrolls the Code Editor window to the location of the function call that is selected in the Call Stack
window, and sets the focus to the Code Editor.
View Locals Displays in the Local Variables window any local variables associated with function call currently 3
selected in the Call Stack window.
Toggle Breakpoint Sets a breakpoint that is disabled, or disables a breakpoint that is set. Breakpoint icons are displayed
in colors that indicate the symbols status of the frame. See the description of icon colors preceding
this list.
Show Fully Qualified Displays full paths of file names.
Names
Stay On Top Keeps the Call Stack window visible when out of focus.
1021
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
See Also
Compiling ( see page 2)
Displays the assembly language code for the program you are debugging. This window opens automatically when program
execution stops at a location for which source code is unavailable.
Area Description
Address Status (at the Displays the effective address (when available) and the value stored at that address. For example, if
top of the window) you select an address containing an expression in brackets such as [eax+edi*4-0x0F], the location in
memory being referenced and its current value is displayed.
The current thread ID is also displayed.
Disassembly pane Displays the address, the hexadecimal representation of the machine code instructions (opcodes),
(upper left side) and the assembly instructions for each line of source code. The address is the offset into the
disassembled method.
If you are debugging managed code, the assembly instructions correspond to the native code created
by the JIT compiler. The Microsoft Intermediate Language (MSIL) created by the compiler is also
displayed. Note that there is not a one-to-one relationship between the native code instructions and
the MSIL instructions. You can not step into or set breakpoints on the MSIL instructions.
If debug information is available, the debugger displays the source code that corresponds to the
assembly instructions.
A right arrow ( ) to the left of an address indicates the current execution point.
When the current instruction is a transfer instruction (for example, call or jmp), either an up or down
arrow after the instruction indicates the target direction for the transfer instruction. For example, if the
target is located before the current instruction, an up arrow is displayed. If the target is after the
current instruction, a down arrow is displayed.
For conditional transfer instructions (for example, jz or jle), an arrow is displayed only if the
condition is true. For conditional set instructions (for example, seta or setz), a left arrow is
displayed if the condition is true.
Register pane (upper Displays the contents of the CPU registers of the 80386 and greater processors. These registers
middle pane ) consist of eight 32-bit general purpose registers and the 32-bit program counter (EIP).
When debugging Win32 code, the flags (EFL) register and the six segment registers are also
displayed.
After you execute an instruction, any registers that have changed value since the program was last
paused are highlighted in red.
3 Memory Dump pane Displayed only for unmanaged code. Displays the raw values contained in addressable areas of your
(lower left side) program. The pane displays the memory addresses, the current values in memory, and an ASCII
representation of the values in memory. The leftmost part of each line shows the starting address of
the line. Following the address listing is an 8-byte hexadecimal listing of the values contained at that
location in memory. Each byte in memory is represented by two hexadecimal digits. Following the
hexadecimal display is an ASCII display of the memory. Non-printable values are represented with a
period.
Press CTRL+LEFT ARROW or CTRL+RIGHT ARROW to shift the starting point of the display up or
down one byte.
1022
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Flags pane (upper right Displayed only for unmanaged code. Displays the current state of the flags and information bits
side) contained in the 32-bit register EFL. After you execute an instruction, the Flags pane highlights in red
any flags that have changed value since the program was last paused.
The processor uses the bits in this register to control certain operations and indicate the state of the
processor after it executes certain instructions.
Pass the mouse over a flag to display the flag name.
Machine Stack pane Displayed only for unmanaged code. Displays the raw values contained in the your program stack.
(lower right side) The pane has three sections: the memory addresses, the current values on the stack, and an ASCII
representation of the stack values. A green arrow indicates the value at the top of the call stack.
• Press CTRL+LEFT ARROW and CTRL+RIGHT ARROW to shift the starting point of the display up or down one byte. Changing
the starting point of the display changes where the debugger begins disassembling the machine code.
• Click above or below the vertical scrollbar to scroll up or down a screen. (Due to the high volume of information available for
display in the Disassembly pane, dragging the scrollbar is disabled.)
• Use the Goto Address, Goto Current EIP, Follow, and Previous context menu commands, as described in the following
section.
Context Menu
The following table lists alphabetically the commands for the panes in the CPU window. Right-click CPU window to display the
following context menu commands.
Item Description
Breakpoint Properties Displays the Address Breakpoint Properties dialog box.
Caller Positions the Disassembly pane to the instruction past the one that called the current interrupt or
subroutine. If the current interrupt routine has pushed data items onto the stack, the debugger might
not be able to determine where the routine was called from.
Caller works best when you turn on Stack frames option under Code Generation (on the
Project Options Compiler page).
Change Lets you modify the bytes located at the current cursor location and prompts you for an item of the
current display type.
Change register Displays the Change Register dialog box where you enter a new value for the register. You can
make full use of the expression evaluator to enter new values. Be sure to precede hexadecimal
3
values with $.
Change thread Displays the Select a Thread dialog box, where you can select the thread you want to debug from
the threads listed. When you choose a new thread from the Flags pane, all panes in the CPU window
reflect the state of the CPU for that thread.
Copy Copies all selected instructions to the clipboard. From the disassembly pane, you can select a single
instruction or you can use the SHIFT key to select multiple instructions. In all other panes, you can
only select a single item to copy.
1023
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Decrement register Subtracts 1 from the value in the currently highlighted register. This option lets you test “off-by-one”
bugs by making small adjustments to the register values.
Display as Formats the data listed in the Machine Stack pane of the CPU window. Choose from the following
formats:
Data type displays format.
Bytes displays data in hexadecimal bytes.
Words displays data in 2-byte hexadecimal numbers.
DWords displays data in 4-byte hexadecimal numbers.
Singles displays data in 4-byte floating-point numbers using scientific notation.
Enabled Available only when right-clicking a breakpoint. Toggles the breakpoint between enabled and
disabled.
Follow Positions the pane at the destination address of the currently instruction highlighted.
Goto Address Displays the Enter Address to Position dialog box where you can enter a symbol or, for managed
code, an address in just in time (JIT) compiler format.
Goto Current EIP Positions the CPU window to the location of the current program counter (the location indicated by
the EIP register). This location indicates the next instruction to be executed by your program.
Increment register Adds 1 to the value in the currently highlighted register. This option lets you test "off-by-one” bugs by
making small adjustments to the register values.
Mixed IL Code When debugging managed code, toggles the display to include MSIL instructions.
Mixed Source Toggles the display between assembly instructions only and assembly instructions and their
corresponding source code (if debug information is available).
New EIP Changes the location of the instruction pointer (the value of EIP register) to the line currently
highlighted in the Disassembly pane. Use this command when you want to skip certain machine
instructions. When you resume program execution, execution starts at this address.
This command is not the same as stepping through instructions; the debugger does not execute any
instructions that you might skip.
Use this command with extreme care; it is easy to place your system in an unstable state when you
skip over program instructions.
Next Finds the next occurrence of the item you last searched for in the Memory Dump pane.
Previous Restores the CPU window to the display it had before the last Follow command.
Run to Current Runs your program at full speed to the instruction that you have selected in the CPU window. After
your program is paused, you can use this command to resume debugging at a specific program
instruction.
Search Displays the Enter Search Bytes dialog box where you can search forward in the CPU window for
an expression or byte list (click Help on the Enter Search Bytes dialog box for details).
Show addresses Includes instruction addresses.
Show opcodes Includes instruction opcodes. Choices are Auto, Always, and Never. Auto is the default value and
causes opcodes to be shown whenever the window is wide enough to contain the opcode column.
Toggle Breakpoint Set or removes a breakpoint at the currently selected address.
3
Toggle flag The flag and information bits in the Flags pane can each hold a binary value of 0 or 1. This command
toggles the selected flag or bit between these two binary values.
Top of stack Positions the Machine Stack pane at the address of the stack pointer (the address held in the ESP
register).
View FPU Available only when debugging Win32 code. Displays the FPU view, which displays the floating-point
registers, MMX registers, and SSE registers.
1024
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
View Source Activates the Code Editor and positions the insertion point at the source code line that most closely
corresponds to the disassembled instruction selected in the CPU window. If there is no corresponding
source code, this command has no effect.
Zero register Sets the value of the currently highlighted register to 0.
This dialog is displayed when you right-click and choose Change from the Dump, Stack, or Register pane of the CPU window
or the Register pane of the FPU window. Enter a value for the currently selected item. Precede hexadecimal values with $.
From the Dump and Stack panes of the CPU window, you can enter more than one value separated by a space. You must enter
a value that corresponds to the current display type set using Display As.
From the Register pane of the FPU view, specify a single 32-bit hexadecimal value (use of decimal numbers is allowed but is
not typical).
Item Description
Edit Box Enter a byte list for two or more values located in a specific order. Precede hexadecimal values with
0x. For example, if you enter 0x5D 0xC3, the debugger goes to the following location:
00000001 5D
00000002 C3
Alternatively, you can use a dollar sign ($) instead of 0x.
To search for DWords, reverse the order of the bytes. For example, if you enter 0X1234, the
debugger positions the pane to memory location 34 12.
Shows messages for breakpoints, process control, threads, modules, and output that occur during a debug session.
You can copy text in the Event Log by using Ctrl-C or the Edit->Copy command.
1025
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Properties Displays the Debugger Event Log Properties page, allowing you control the content and
appearance of the Event Log window. You can also display this page by choosing
Tools Options Debugger Options Event Log.
Stay On Top Keeps the window visible when out of focus.
Dockable Enables drag-and-dock for the Event Log window.
Item Description
Comment Enter the comment you want to appear in the Event Log window.
3.2.17.2.10 FPU
View Debug Windows FPU
Displays the contents of the Floating-point Unit and SSE registers in the CPU.
Item Description
Instruction Pointer Displays the Instruction Pointer (IPTR) address, opcode, operand (OPTR) address of the last
(IPTR) floating-point instruction executed.
FPU Registers pane Displays the floating-point register stack (ST0 through ST7) in ascending order. After the list, the
control word, status word, and tag word are shown. The information displayed for each of the eight
registers is shown as follows: Register name, register status, and register value.
The register status can be one of the following values:
Empty Indicates that the register contains invalid data. When a register is empty, no value is
displayed for that register, because the data in the register is presumed to be invalid.
Valid Indicates that the register contains nonzero valid data.
Spec. (Special) Indicates that the register contains valid data, but the valid data represents a special
condition, either NAN (not a number), infinity, or a denormalized value.
The status of each register is determined by examining the tag word and the eleventh through
thirteenth bits of the status word (top of stack indicator). When a register’s status is not Empty, the
value of the register in long double (extended) format is displayed immediately following the status.
The registers can be displayed in different formats (other than long doubles).
The control, status, and tag words are displayed in hexadecimal format only. For these three words,
any values that were altered by the last run operation are displayed in red.
1026
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Control Flags pane Lists the control flags encoded in the control word. Any flags that were altered by the last run
operation are displayed in red. The control flags and their bit number in the control word are as
follows:
IM Invalid Operation Exception, 0
DM Denormalized Operation Exception Mask, 1
ZM Zero Divide Exception Mask, 2
OM Overflow Exception Mask, 3
UM Underflow Exception Mask, 4
PM Precision Exception Mask, 5
PC Precision Control, 8, 9
RC Rounding Control, 10, 11
IC Infinity Control (Obsolete), 12
Select any of the flags and right-click to change the flag’s value. For single-bit flags, it changes the
value from 0 to 1 or from 1 to 0. For multi-bit flags, it cycles through all possible values.
Status Flags pane Lists the status flags encoded in the status word. Any flags that were altered by the last run operation
are displayed in red. The flags and their bit number in the control word are as follows:
IE Invalid Operation Exception, 0
DE Denormalized Operation Exception, 1
ZE Zero Divide Exception, 2
OE Overflow Exception, 3
UE Underflow Exception, 4
PE Precision Exception, 5
SF Stack Fault, 6
ES Error Summary Status, 7
C0 Condition Code 0 (CF), 8
C1 Condition Code 1, 9
C2 Condition Code 2 (PF), 10
ST Top of Stack, 11-13
C3 Condition Code 3 (ZF), 14
BF FPU Busy, 15
Select any of the flags and right-click to change the flag’s value. For single-bit flags, it changes the
value from 0 to 1 or from 1 to 0. For multi-bit flags, it cycles through all possible values.
SSE pane Displays the Streaming SIMD Extensions (SSE) registers.
Right-click the SSE pane and choose Display As to change the display format of the register content.
Context Menu
Right-click FPU window to display the following context menu commands.
Item Description
Zero Sets the selected register's value to 0. When used on one of the seven FPU registers, this command
also sets that register's tag bits in the tag word to 01 indicating that the register holds a zero value.
3
Empty Sets the selected register's tag bits in the tag word to 11 indicating that the register is empty. This
command is grayed out if the selected register is the CTRL word, STAT word, or TAG word.
1027
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Change Displays the Change dialog, where you can enter a new value for the selected register. When used
on one of the seven FPU registers, this command also sets that register's tag bits in the tag word to
00 indicating that the register holds a valid value.
The value you enter in the Change dialog should match the format currently specified by the Display
As menu item. For example, if the currently displayed format is Extended, you should enter an
Extended value in the Change dialog.
Display As Determines how the values in registers are displayed. The items on the submenu change depending
on Show menu selection.
For FPU registers, the possible display types are Words and Extendeds (long doubles).
For MMX registers, the possible display types are Bytes, Words, DWords (double words), and
QWords (quad words).
For SSE registers, the possible values are Bytes, Words, DWords (double words), QWords (quad
words), DQWords (double quad words), Singles, and Doubles.
Radix Available only when MMX registers are shown. Determines how the values in the MMX register are
displayed. The possible values are Binary, Unsigned Decimal, Hexadecimal, and Signed Decimal.
Show Toggles the FPU Registers pane between between FPU and MMX registers:
Floating Point Registers displays the 10-byte FPU registers ST(0) through ST(7). The registers can
be viewed as either Extended (long double) values or as 5 DWord values.
MMX Registers displays the 8-byte MMX registers MM0 through MM7. The registers can be viewed
as 8 Byte values, 4 Word values, 2 DWord values, or 1 QWord value. These values can be shown in
either binary, decimal, or hexadecimal format (see Radix). MMX registers can only be shown on a
computer that is MMX enabled.
Toggle Flag In the Status Flags and Control Flags panes, changes the value of the selected flag. For single-bit
flags, changes the value from 0 to 1 or from 1 to 0. For multi-bit flags, cycles through all possible
values.
Stay on Top Keeps the FPU view on top of other windows.
Shows the current function’s local variables while in debug mode. To view local variables from a non-current stack frame, select
a frame from the drop-down list.
Item Description
Inspect Displays information about the currently selected variable in the Inspector window.
Stay On Top Keeps the Local Variables window visible, even when it does not have focus.
Dockable Enable drag-and-dock for the Local Variables window.
while any IDE window has focus, even if you are not in debug mode. However, the window will be empty unless the debugger is
paused. Keep this window open during your debugging sessions to monitor how your program updates the values of variables as
the program runs.
1028
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Shows processes under control of the debugger and the modules currently loaded by each process. This window is divided into
the following areas.
Area Description
Modules pane (upper Displays the processes and modules sorted, by default, in the order in which they are loaded. Each
left side) process can have one or more modules which it loads. When a process terminates or a module is
unloaded, it is removed from the list.
indicates the current process.
To sort the display, click a column heading.
Source pane (lower left If debug information is available, displays the source files that were used to build the module currently
side) selected in the Modules pane.
Scope Browser (right Displays a hierarchical tree view of the namespaces, classes, and methods used in the application.
side, for managed code represents a namespace.
only)
represents a class.
represents a method.
Entry Point pane (right Displays the name and addresses of the entry points for the module currently selected in the
side, for unmanaged Modules pane.
code only) The entry point is only shown if the source for it can found.
To sort the display, click a column heading.
The runtime image base address is the memory offset, in hexadecimal, where the module actually
loads, and is distinct from the preferred image base address you may have specified in the
Project Options window.
Context Menus
Right-click the Modules pane to display the following commands for unmanaged code.
Item Description
Break On Load Toggles a breakpoint to halt the execution of the application when it loads the selected module into
memory. This setting is used only by the Borland Win32 Debugger. You can also click on the module
icon to toggle a module load breakpoint.
Reload Symbol Table Displays the Reload Symbol Table dialog box, allowing you to load the debug symbol table into the
Modules window.
Add Module Displays the Add Module dialog, allowing you to add a module to the list. Use this command to add a
module load breakpoint on a module that is not currently loaded. This setting is used only by the
CodeGear Win32 Debugger.
Item Description
Edit Source Activates the Code Editor and positions it to the selected module.
Right-click the Scope Browser to display the following commands (the Scope Browser is only displayed in managed
debugging). 3
Item Description
Browse Class Displays the CodeGear Reflection tool, allowing you to inspect the currently selected class.
Edit Source Available for methods only. Activates the Code Editor and positions it to the method.
Selecting a method that has not been Just In Time compiled yet results in the message No native
code is available.
1029
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Go to Entry Point Displays the selected entry point in the CPU window if there is no source for the entry point. If source
can be found, it will be shown. Your program must be paused before you can jump to an entry point.
Item Description
Path to source file Displays the name of the source file that the debugger can not find. Click the Browse button to
navigate to the source file or type the full path name of the source file.
Add directory to Debug Appends the file path to the end of the debug source path (in Project Options Debugger).
Source Path
3.2.17.2.14 Threads
View Debug Windows Threads
Shows the status of all processes and threads that are executing in each application being debugged.
Item Description
Thread ID Displays the process name, the OS assigned thread ID, and, if the thread is named, its name.
State Indicates the execution state of the thread as Runnable, Stopped, Blocked, or None; for processes,
the state indicates how the process was created: Spawned, Attached, or Cross-process Attach.
Status Indicates the thread status as one of the following:
Breakpoint - The thread stopped due to a breakpoint.
Faulted - The thread stopped due to a processor exception.
Unknown - The thread is not the current thread so its status is unknown.
Stepped - The last step command was successfully completed.
Location Indicates the function name or address associated with the thread.
Tip: The current process is marked with a green arrow. Non-current processes are marked with a light blue arrow.
The current process and current thread become the context for the next user action, for example, run, pause, or reset.
Context Menu
Right-click the Thread Status window to display the following commands.
Item Description
3 View Source Displays the Code Editor at the corresponding source location of the selected thread ID, but does
not make the Code Editor the active window.
Go to Source Displays the Code Editor at the corresponding source location of the selected thread ID and makes
the Code Editor the active window.
Make Current Makes the selected thread the active thread if it is not so already. If the thread is not already part of
the active process, its process also becomes the active process.
Terminate Process Terminates the process, if a process is selected, or the process that the thread is part of, if a thread is
selected.
1030
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Detach Process Detaches the process, if a process is selected, or the process that the thread is part of, if a thread is
selected..
Pause Process Pauses the process, if a process is selected, or the process that the thread is part of, if a thread is
selected. This option is available only if the process is running.
Process Properties Lets you set debugger options temporarily for a particular process during the debugging session.
Dockable Enables drag-and-dock for the Thread Status window.
Displays the current value of the watch expression based on the scope of the execution point. The Watch List window is a
multi-tabbed view with each tab representing a distinct watch group. Only the watch group on the active tab is evaluated while
debugging.
Tip: To enable or disable a watch expression quickly, use the check box next to the watch.
Item Description
Watch Name Shows the expression entered as a watch.
Value Lists the current value of the expression entered.
Note: If the execution point moves to a location where any of the variables in an expression is undefined (out of scope), the
entire watch expression becomes undefined. If the execution point reenters the scope of the expression, the Watch List
Tip: By grouping watches, you can prevent out of scope expressions from slowing down stepping.
Context menu
Right-click the Watch List window to display the following commands.
Item Description
Edit Watch Displays the Watch Properties dialog box that lets you modify the properties of a watch.
Add Watch Displays the Watch Properties dialog box that lets you create a watch
Enable Watch Enables a disabled watch expression.
Disable Watch Disables a watch expression and so that it is not monitored as you step through or run your program.
The watch settings remain defined. Disabling watches improves debugger performance.
Delete Watch Removes a watch expression. This command is not reversible.
Copy Watch Value Copies the text in the Value column of the selected watch to the clipboard.
Copy Watch Name Copies the text in the Watch Name column of the selected watch to the clipboard. 3
Enable All Watches Enables all disabled watch expressions.
Disable All Watches Disables all enabled watch expressions.
Delete All Watches Removes all watch expressions.
Add Group Displays a dialog box, allowing you to name a watch group and add it to the watch list as a new tab.
Delete Group Deletes a watch group from the watch list.
1031
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Move Watch to Group Moves one or more selected watches to another watch group.
Stay On Top Keeps the window visible when out of focus.
Show Column Headers Toggles the display of the Watch Name and Value column titles.
Inspect Displays information about the currently selected expression.
Dockable Enables drag-and-dock for the Watch List window.
3.2.17.2.16 Disassembly
View Debug Windows CPU Windows Disassembly
Displays the address, the hexadecimal representation of the machine code instructions (opcodes), and the assembly instructions
for each line of source code. The address is the offset into the disassembled method.
See Also
CPU Window ( see page 1022)
3.2.17.2.17 Memory
View Debug Windows CPU Windows Memory
Displays the raw values contained in addressable areas of your program. Displayed only for unmanaged code. The pane
displays the memory addresses, the current values in memory, and an ASCII representation of the values in memory.
There are four different views in order to view four distinct areas in memory at the same time. You can have more than one view
and then use Search Goto Address in the separate views to look at different places in memory at the same time.
See Also
CPU Window ( see page 1022)
3.2.17.2.18 Registers
View Debug Windows CPU Windows Registers
Displays the contents of the CPU registers of the 80386 and greater processors.
See Also
CPU Window ( see page 1022)
3.2.17.2.19 Stack
View Debug Windows CPU Windows Stack
3 Displays the raw values contained in the program stack. Displayed only for unmanaged code.
See Also
CPU Window ( see page 1022)
1032
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Navigates through the unit files. The Code Explorer contains a tree diagram that shows all of the types, classes, properties,
methods, global variables, and global routines defined in your unit. It also shows the other units listed in the uses clause.
Right-click an item in the Code Explorer to display its context menu.
When you select an item in the Code Explorer, the cursor moves to that item’s implementation in the Code Editor. When you
move the cursor in the Code Editor, the highlight moves to the appropriate item in the Code Explorer.
Icon Description
Classes
Interfaces
Units
Constants or variables (including fields)
Methods or routines: Procedures (green)
Methods or routines: Functions (yellow)
Properties
Types
Changes the toolbar configuration. Using this dialog box, you can add, remove, and rearrange buttons on toolbars.
Toolbars Page
The Toolbars page lists the toolbars you can show, hide, and reset.
Item Description
Toolbars Lists the toolbars available, such as Standard, Debug, and Desktop.
Reset Returns any selected toolbar to its default configuration.
Commands Page 3
The Commands page displays the menu commands you can drag and drop onto a toolbar.
Item Description
Categories Lists the menus available, such as Debug and Run.
Commands Lists all the commands available for the menu selected in the Categories list box. The icon to the left
of the menu command is the button that will appear on the toolbar.
1033
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Options Page
The Options page allows you to specify that the IDE displays or hides tooltips and shortcut keys for toolbar button.
Item Description
Show tooltips Displays tooltips for toolbar buttons when you move the mouse over the button.
Show shortcut keys on Displays any toolbar button shortcut keys in the tooltip text.
tooltips
See Also
Customizing Toolbars ( see page 156)
Adds new connections, modifies; deletes, or renames your connections. You can browse database server-specific schema
objects including tables, fields, stored procedure definitions, triggers, and indexes. Additionally, you can drag and drop data from
a data source to a project to build your database application quickly. The Data Explorer commands available depend upon the
object selected in the tree view. Commands are available for the following nodes:
• Provider types
• Provider connections
• Tables node
• Individual tables
• Individual views
• Individual stored procedures
Provider Types Commands
The following commands are available when you select nodes for providers types, such as DB2 and Interbase:
Item Description
Refresh Re-initializes all connections defined for the selected provider.
Add New Conection Adds a new connection to the Data Explorer.
Migrate Data Opens a a tabbed Data Explorer page for data migration in the Code Editor. This data migration
page lets you select one or more tables from a source provider connection and a destination
connection to which the tables will be migrated. Click Migrate to migrate the tables.
3 Item Description
Refresh Re-initializes all connections defined for the selected provider.
Delete Connection Deletes the current connection.
Modify Connection Makes changes to the appropriate values in the editor.
Close Connection Closes the current connection.
Rename Connection Provides a new name to a named connection.
1034
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
SQL Window Opens the Active Query Builder, a tabbed page for writing and editing SQL statements in the Code
Editor. This SQL window can be used to write, edit and execute SQL statements. When you execute
the SQL, the results are displayed in the lower part of the page. For details on how to use the Active
Query Builder, see http://www.activequerybuilder.com/hs15.html.
Item Description
Refresh Re-initializes all connections defined for the selected provider.
New Table Opens a tabbed Data Explorer page for table design in the Code Editor. This Table Design page
can be used to specify the data structure for a new table. The Table Design page lets you add and
remove columns, and alter column information. The Table Design page lets you change the following
column information: Column Name, Data Type, Precision, Scale, and Nullable (that is, whether or not
the column can be null). Right-click the page and choose Save Table to add the new table to your
database.
Item Description
Refresh Re-initializes all connections defined for the selected provider.
Retrieve Data From Opens a tabbed Data Explorer page in the Code Editor, displaying the data from the selected table.
Table The Data Explorer page lets you sort and modify the data, but changes will not be saved back to the
database.
Drop Table Removes the selected table and all its data from the database.
Alter Table Opens a tabbed Data Explorer page for table design in the Code Editor. This Table Design page
can be used to modify the data structure for an existing table. The Table Design page lets you add
and remove columns, and alter column information. The Table Design page lets you change the
following column information: Column Name, Data Type, Precision, Scale, and Nullable (that is,
whether or not the column can be null). If you make modifications, you are asked to save them when
you close the Table Design page.
Copy Table Copies the table structure and data for the selected table.
Paste Table Migrates the table structure and data copied from a given provider to the selected provider. Although
you must select a table in the target provider, no data will be overwritten.
View Commands
The following commands are available when you select individual views:
Item Description
Refresh Re-initializes all connections defined for the selected provider.
Retrieve Data From Opens a tabbed Data Explorer page in the Code Editor, displaying the data from the selected view. 3
View The Data Explorer page lets you sort and modify the data, but changes will not be saved back to the
database.
1035
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Locate Implementation Navigate to the stored procedure's source code if you have a project with such source code open in
the project group. Supported for Blackfish SQL only.
Refresh Re-initializes all connections defined for the selected provider.
View Parameters Opens a tabbed Data Explorer page for viewing and editing stored procedure parameter data in the
Code Editor. The stored procedure can also be executed from this page.
See Also
Borland Data Providers for Microsoft .NET
ISQLSchemaCreate
BdpCopyTable
Delete a saved desktop by selecting it from the list and clicking Delete.
See Also
Saving Desktop Layouts
Item Description
Dropdown list Lists the distributed and user-defined desktop layouts. Click the desktop layout that you want to use,
such as Default Layout, Classic Undocked, or Debug Layout.
Save current desktop Displays the Save Desktop dialog box, allowing you to name and save the current desktop settings.
Set debug desktop Sets the current desktop as the debug desktop, which is automatically displayed during runtime.
See Also
Dockable Windows-style File Browser views files and directories and performs simple operations on files while you are running
1036
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
the IDE. The File Browser supports standard Windows context menu options, as well as the following commands that are
specific to RAD Studio:
Item Description
Open with RAD Studio. Opens the selected file in the IDE.
Add to Project Adds the selected file to the current project.
See Also
Using the File Browser ( see page 166)
To add individual strings, rather than adding the strings for an entire unit, right-click the string in the Translation Manager and
choose Repository Add strings to repository.
The following options determine the criteria used for adding the strings.
Item Description
Status Adds strings based on the status displayed in the Status column on the Workspace tab. Check the
statuses that you want to add.
Duplicate action Determines how the repository responds when it finds a duplicate translation string for the same
source string.
Skip does not add the string.
Add adds the string to the repository if no translated string exists for the original string.
Force Add always adds the string to the repository, regardless of whether it exists in the repository.
Replace overwrites the existing string with new string.
Display selection offers the user a choice.
Include context Adds the unit path, and the value displayed in the Id column of the Workspace tab, to the Translation
information Repository. This context information is displayed in the status bar when you select a string in the
Translation Repository.
Value Indicates whether a string is added based on changes to its original value.
Changed adds the string only if the original and translated values are different.
Unchanged adds the string even if the original and translated values are the same.
Don't care adds the string, whether it has changed or not, provided the string meets the other criteria
set in this dialog box.
Comment Adds or excludes strings based on the text in the Comment column on the Workspace tab. Type the
comment text in the edit box and check Include to add strings with a matching comment, or check
Not include to exclude strings with a matching comment.
3
Tip: To set general options for the Translation Repository, choose Tools->Translation Tools Options
See Also
Localizing Applications ( see page 18)
1037
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
The Build tab displays the build command. The Output tab displays build output messages. To select the verbosity level for
build output, use the Tools Options Environment Options page.
Sets the properties and events for the currently selected object.
Tab Description
Properties Displays the properties for the selected object on a form.
Events Displays the events for the selected object on a form.
Context Menu
Right-click the Object Inspector to display the following commands.
Item Description
View Filters the display of properties or events.
Arrange Sorts the property or events by name or by category.
Revert to Inherited Changes the property setting back to its original, inherited value.
Expand Expands the selected property or event.
Collapse Collapses the selected property or event.
Hide Close the Object Inspector. To redisplay it, choose View Object Inspector.
Help Displays this Help topic.
Properties Displays the Object Inspector Properties dialog box, allowing you to change the appearance of the
Object Inspector.
Stay on Top Displays the Object Inspector on top of the desktop even if other windows are displayed.
Dockable Enables drag-and-dock for the Object Inspector.
See Also
Setting Properties and Events ( see page 164)
3
3.2.17.12 Project Manager
View Project Manager
Displays and organizes the contents of your current project group and any project it contains. You can perform several project
management tasks, such as adding, removing, and compiling files.
Note: Some features described here are available only in specific editions of the product. For example, some functionality in the
1038
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Item Description
Project list box Displays the projects in the current project group.
New Displays the New Items dialog box so that you can add a new project to the current project group.
Remove Removes the selected project from the current project group.
Activate Displays the selected project on top of other projects in the IDE so that you can make changes to it.
You can also double-click the project to activate it. The active project is displayed in bold.
Files Displays a tree view of all the files in your project or project group. Click the plus sign (+) to display or
the minus sign (-) to hide all the source files in your project.
Item Description
Auto Collapse Collapses the tree structure of the project after you complete an operation.
Dockable Docks (attaches) the Project Manager window to other tool windows, such as the Code Editor.
Uncheck to make the Program Manager a floating window.
Show Path Adds an additional field (Path) to the Project Manager to display the path of the files, projects, and
project groups.
Status Bar Displays the full path name of the selected file at the bottom of the Project Manager window.
Stay on Top Displays the Project Manager on top of the desktop even if other windows are displayed.
Toolbar Shows or hides the toolbar on the top of the Project Manager.
Item Description
Add New Project Displays the New Items dialog box, allowing you to create a new project and add it to the current
project group.
Add Existing Project Displays the Open Project dialog box, allowing you to add an existing project to the current project
group.
Customize... Opens the Customize New menu, which allows you to select items, including menu-item separators,
from a gallery and add them to your Add New... menu on the Project Manager.
Save Project Group Saves the project file (.bdsgroup) for the project group. Use this command after adding, removing, or
changing the order of projects in a project group.
Save Project Group As Displays the Save As dialog box, allowing to save the project with a new name and location.
3
Rename Renames the project file.
Configuration manager Opens the Build Configuration Manager dialog box. Use this dialog box to apply the active
configuration to a project or several projects.
1039
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Add Displays the Add to
Project dialog box,
allowing you to add files
to the selected project.
Add New Unit Adds a compilation unit
to the selected project,
assigning the name
Unit01.cpp for the first
unit added, and then
augmenting the number
for each subsequent unit
added. To rename a unit
and all its components,
right-click the unit name
in the Project Manager,
and select Rename.
Add New Form Adds a new form to the
selected project and
displays the new form in
the Code Editor.
Add New Password Adds a PassWord.cpp
Dialog node to the selected
project in C++Builder,
including a
PassWord.dfm file, and
sets up a template for
creating a PassWord
unit in your project.
Add New Other... Displays the New Items
dialog box and lists the
item categories that are
available to you, such as
C++Builder Files. Click a
category in the left-hand
pane, and then the
right-hand pane displays
the items of that
category that you can
add to your project.
Add New > Directory Displays the Directory
View View or Folder dialog
box, which allows you to
select a directory to add
to the Project Manager.
Adding a Directory View
3 adds a yellow-colored
folder node to the tree
structure.
1040
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
1041
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
1042
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
1043
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
1044
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Show All Files Shows all the project's ASP.NET Runs the Microsoft ASP.NET Web Site Administration View D
files in the Project Configuration tool. This provides a UI for editing the web.config file Source i
Manager. This menu for ASP.NET projects. See s
item is a toggle, so you http://msdn2.microsoft.com/en-us/library/yy40ytx0(vs.80) p
can click it to hide files. for more information. l
a
y
s
t
h
e
s
o
u
r
c
e
c
o
d
e
f
o
r
t
h
e
s
e
l
e
c
t
e
d
p
r
o
j
e
c
t
.
3
Deployment Context-Menu
Right-click the Deployment node in the Project Manager to display the context menu commands. The commands vary depending
on the type of project being deployed.
1045
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
New ASP.NET Opens the Deployment Manager for an ASP.NET project.
Deployment
Item Description
Add Reference Displays the Add Reference dialog box, allowing you to add an assembly, COM type library, or
project reference to the project.
Add Web Reference Displays the Add Reference dialog box, allowing you to Web reference to your client application and
access the Web Service you want to use.
Build Is a shortcut that compiles the selected file.
Copy Local Copies the assembly to the local output directory. By default, Copy Local is checked for assemblies
that are not in the Global Assembly Cache (GAC).
Edit Local Options For C++, displays an abbreviated Project Options dialog box that contains only the Paths and
Defines page, nine pages of C++ compiler options, and the Build Events page.
Open Opens the selected files in the Code Editor.
Preprocess Runs the C++ preprocessor (cpp32).
Remove From Project Removes the selected files from the project. You will be prompted to save any changes.
Save Saves changes made to the selected files using their current names.
Save As Displays the Save As dialog box, allowing you to saves the selected files with new names and
locations.
Show Dependencies Displays
Rename Allows you to rename the file and any corresponding secondary files that appear as child nodes in the
Project Manager.
Item Description
Add New Adds a child configuration, based on the selected configuration, and listed in the Project Manager
under the name of the parent configuration..
Save As Displays the Save as dialog box and allows you both to save the selected configuration to a specific
location and to rename the saved file.
Rename Allows you to rename the selected build configuration.
3
Delete Displays the Confirm dialog box and allows you to delete the selected configuration.
Activate Makes the selected build configuration the current active configuration for the project. The active build
configuration is listed in boldface.
Apply Option Set Displays the Apply Option Set dialog box and allows you to select an .optset file to apply to the
selected build configuration. You can choose to overwrite, replace, or preserve the existing option
values.
1046
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Edit Displays the Project Options dialog box preloaded with the values set in the selected build
configuration.
Item Description
Save current desktop Enter a new name for the desktop or select a name from the drop-down list.
as
See Also
Saving Desktop Layouts
Determines which saved desktop layout is used when you are debugging.
Item Description
Debug desktop Select a desktop layout from the drop-down list.
See Also
Saving Desktop Layouts
Shows the hierarchy of source code or HTML displayed in the Code Editor, or components displayed on the Designer. When
displaying the structure of source code or HTML, you can double-click an item to jump to its declaration or location in the Code
Editor. When displaying components, you can double-click a component to select it on the form.
If your code contains syntax errors, they are displayed in the Errors node in the Structure View. You can double-click an error
to locate the corresponding source in the Code Editor. ( (Not applicable for C++ development.)
Tip: You can control the content and appearance of the Structure View
by choosing Tools Options Environment Options Explorer and changing the settings. 3
Context Menu
Right-click the Structure View to display the following commands. The commands on the context menu depend on whether
source code or components are displayed in the Structure View.
Item Description
New Adds a new node to the Structure View.
1047
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Rename Changes the name of the selected node in the Structure View.
Edit Displays a submenu allowing you to undo changes, cut, copy, paste, delete, or select all of the
controls on the Designer.
Control Displays a submenu allowing you to bring the selected control to the front or send it to the back of the
the Designer.
Properties Displays the Explorer Options dialog box allowing you to change the content and appearance of the
Structure View.
Stay on Top Displays the Structure View on top of the desktop even if other windows are displayed.
Dockable Enables drag-and-dock for the Structure View.
Toolbar (C++)
The Structure view contains a toolbar for C++ application development that allows you to control how the contents of the
Structure view are displayed. It consists of the following buttons:
Item Description
Name Displays the name of the available live templates.
Description Describes the live template.
1048
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
See Also
Creating Live Templates ( see page 138)
Item Description
Action Item This column includes a check box, an icon, and the task.
The check box indicates whether the item has been completed.
A window icon indicates the item was entered in the to-do list. A unit icon indicates it is a comment in
the source code.
The text is the actual task to be done. Grayed text indicates the item comes from a source file that is
part of the current project but is not open in the Code Editor. Bold text indicates the source is open in
the Code Editor. Double-click an item to open its source in the editor.
Priority Specifies the importance of the item using a decimal number from 1 (the highest) to 5 (the lowest).
Module For items that have been added as code comments, indicates the path and module in which the
comment exists.
Owner Indicates who is responsible for completing the task.
Category Indicates a type of task, for example, user interface task or an error handling task.
Tip: To sort the list, click any column heading. For additional processing options, right-click and use the context menu
commands.
See Also
Using To-Do Lists ( see page 166)
Item Description
Text Specifies the to-do list item text.
Priority Specifies the importance of the item using a decimal number from 1 to 5. Type the number or select
one using the spin control.
Owner Indicates who is responsible for completing the task. Type the name or select one if others are listed
in the spin control.
Category Indicates the type of task, for example, a user interface or UI, or Interface implementation. Type the 3
category or select one if others are listed in the spin control.
See Also
Using To-Do Lists ( see page 166)
1049
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Item Description
Filter by Uncheck a category, owner, or item type to hide it from the to-do list.
Show All Checks everything in the Filter by list.
See Also
Using To-Do Lists ( see page 166)
Table tab
Specifies the properties for the HTML table used to display the to-do list.
Item Description
Caption Specifies a caption for the table.
Border Width Specifies the width (in pixels only) of the frame around a table.
Width (Percent) Specifies a value for how wide the table will appear on the page. The value is relative to the amount
of available horizontal space.
Cell Spacing Specifies how much space to leave between the left side of the table and the left side of the leftmost
column, the top of the table and the top-side attribute. Also specifies the amount of space to leave
between cells.
Cell Padding Specifies the amount of space between the border of the cell and its contents.
Background Color Indicates a background color for the HTML table cells.
Alignment Indicates the location (left, right, or center) of the table on the HTML page.
Columns tab
Specifies the properties for each of the columns in the to-do list.
Item Description
Column Indicates the column for which you want to specify properties.
Alignment Specifies the alignment of the text within the column (left, right, or center).
3 Vertical alignment Specifies the alignment of the text within the cell (top, middle, or bottom).
Title Indicates the column heading.
Width Specifies the width of the column in a percentage of the whole table width.
Height Specifies a recommended cell height in pixels.
Wrap text Allows text within cells to wrap.
Visible Determines whether or not this column will be included in the table or not.
1050
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Font Size Specifies the point size of the text in the column.
Face Sets the typeface of the text in the column.
Color Sets the color of the column.
Bold Makes the text in the column bold.
Italic Makes the text in the column italic.
See Also
Using To-Do Lists ( see page 166)
Assists with a new project, adds components to a form, or adds code snippets to the Code Editor.
Item Description
Categories Displays a list of the item categories, allowing you to position the Tool Palette to a category.
Sets or removes the Tool Palette filter. Click anywhere in Tool Palette and begin typing the name of
the item you want to locate. The Tool Palette is automatically displays only those items that match
what you type. Click the filter icon to remove the filter.
, click the item or category and drag and drop it elsewhere on the Tool Palette. The context menu command Lock Reordering
disables/enables drag and drop reordering.
Context Menu
Right-click the Tool Palette to display the following commands.
Item Description
Add New Category Displays the Create a New Category dialog box, allowing you to create an empty category. You can
then drag-and-drop components from other categories into the new category to create a customized
category.
Delete Category Deletes the selected category from the Tool Palette. To restore the category, choose Customize
.NET Components.
Delete Button Deletes the selected item from the Tool Palette.
Hide Button Removes the selected item from the Tool Palette, but does not delete it.
Unhide Button Redisplays items previously hidden by using the Hide Button.
Installed .NET Displays the Installed .NET Components dialog box, allowing you to add components to the Tool
Components Palette. This command is available only when the Tool Palette contains components.
3
Clear All Code Removes user defined code snippets from the Tool Palette.
Snippets
Auto Collapse Allows only one category to be expanded at a time.
Categories
Collapse All Displays only the categories of items.
Expand All Displays the items in each category.
1051
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Lock Ordering Disables drag and drop reordering of categories and items on the Tool Palette.
Reset Palette Removes all Tool Palette customizations.
Properties Displays the Tool Palette page of the Options dialog box, allowing you to change the appearance of
the Tool Palette.
Stay on Top Displays the Tool Palette on top of the desktop even if other windows are displayed.
Dockable Enables drag-and-dock for the Tool Palette.
See Also
Adding Components to the Tool Palette ( see page 160)
Item Description
Project tab Displays the following tabs:
The Languages tab lists each language in the open project and the locale ID, file extension, and
translation directory for each language.
The Files tab lists the resource files for the language selected on the Languages tab. Double-click a
resource file to open it in a text editor.
Workspace tab Displays a tree view of the project. When you select a non-resource in the left pane, summary
information appears in the right pane. When you select a resource file in the left pane, a grid for
viewing and editing translations appears.
Item Description
Filters Lets you can display or hide rows based on the following criteria: Show All, Toggle (jumps between
displaying criteria that are either checked and unchecked in the Columns context menu), Show None,
Show Untranslated, Show Translated, Show Newly Translated, Show Auto Translated, and Show
Unused (translations that were kept even after the resource was later deleted).
3
Columns Lets you display or hide columns by checking the column name. Show All displays all columns,
Toggle jumps between displaying criteria that are either checked and unchecked in the Columns
context menu), and Show None removes all of the columns from the display.
Edit Displays the Edit Selection dialog box where you can edit the value for the target language, status,
or comment field.
1052
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Item Description
Ctrl+A Select everything in grid.
Ctrl+C Copy selection to clipboard.
Ctrl+D Copy translation from prior row in grid.
Ctrl+E Show Multiline editor.
Ctrl+F Show Find dialog box.
Ctrl+K Keep forms on top.
Ctrl+N Find next untranslated item.
Ctrl+O Copy text from source (base language) column into translation column.
Ctrl+P Restore translation from Previous translation column.
Ctrl+Q Show Actions context menu.
Ctrl+S Save translations.
Ctrl+T Change status to Translated.
Ctrl+V Paste selection from clipboard.
Ctrl+W Reset column width.
3
Ctrl+X Cut selection and add to clipboard.
F6 Switch between left and right panes in Workspace tab.
Ctrl+F5 Refresh translated form.
Ctrl+F7 Show original form.
Ctrl+F8 Show translated form.
Shift+Ctrl+F5 Refresh grid.
1053
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Shift+Ctrl+F7 Synchronize the translated version with the base language version, for example, when changes are
made to the base version.
See Also
Localizing Applications ( see page 18)
Item Description
Up and Down arrows Moves to the previous or next string in the Translation Manager grid. Clicking either button saves
your changes.
Tile Across and Tile Changes the orientation of the editor panes.
Down
Save Saves your changes.
Close Discards unsaved changes and close the editor.
Font Changes the display font in the editor. The changes apply to whichever pane the cursor is in when
you click the Font button and affect the Translation Manager grid as well as the Multi-line editor.
Word Wrap Enables or disables wrapping of long lines.
See Also
Localizing Applications ( see page 18)
Makes changes to your type library. The Type Library editor generates the required IDL syntax automatically. Any changes you
make in the editor are reflected in the corresponding implementation class (if it was created using a wizard).
The View Type Library command is available only for projects that contain a type library. The wizards on the ActiveX page
automatically add a type library to the project when they create a COM object.
3
Object List Pane
Each instance of an information type in the current type library appears in the object list, represented by a unique icon. Select an
icon to see its data pages displayed in the information pane at the right.
Attributes Page
Lists the type information associated with the object currently selected in the object list pane. You can use the controls to edit
these values. What attributes appear depends on the selected element.
1054
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Item Description
Name A descriptive name for the type library. The name can’t include spaces or punctuation.
GUID The globally unique 128-bit identifier of the type library’s interface (a descendant of ITypeLib).
Version A particular version of the library in cases where multiple versions of the library exist. The version is
either a pair of decimal integers separated by a period, or a single decimal integer. The first of the two
integers represents the major version number, and the second represents the minor version number.
If a single integer is used, it represents the major version number. Both major and minor version
numbers are short unsigned integers in the range between 0 and 65535, inclusive
LCID The locale identifier that describes the single national language used for all text strings in the type
library and its elements.
Help String A short description of the type library. Used with Help Context to provide Help as a Help file. This
string is mapped to the Help Context when creating the help file.
Help Context The Help context ID of for the type library’s main help. This ID identifies the Help topic within the Help
file.
Help String Context For help DLLs, the Help context ID of the type library’s main help. Used with Help String DLL to
provide Help as a separate DLL.
Help String DLL The fully-qualified name of the DLL used for help, if any.
Help File The name of the help file (.hlp) associated with the type library, if any.
Note: The Type Library editor supports two mechanisms for supplying help. The traditional help mechanism, where a standard
windows help file has been created for the library, or where the help information is located in a separate DLL (for localization
purposes). You must supply the help file to which the Help attributes apply.
Text Page
Contains the declarations for the currently selected element in IDL or Object Pascal. You can use this page to enter changes
more quickly than using the other pages or to review all the type information at once.
All type library elements have a text page that displays the IDL or Object Pascal syntax for the element. The Type Library page
of the Environment Options dialog determines which language is used on the text page. Any changes you make in other pages
of the element are reflected here. If you add IDL or Object Pascal code directly in the text page, changes are reflected in the
other pages of the Type Library editor.
Note: The Type Library editor generates syntax errors if you add IDL identifiers that are currently not supported by the editor;
the editor currently supports only those IDL identifiers that relate to type library support (not RPC support).
Flags Page
Lists various attributes that modify the object described on the Attributes page. This page is not available for all elements.
Some type library elements have flags that let you enable or disable certain characteristics or implied capabilities. The flags page
lists several check boxes let you turn these flags on or off.
Uses Page
Only available when the type library is selected in the Object List pane. Lists other type libraries that contain definitions on
which this one depends.
3
To add a dependency, check the box to the left of the type library name. The definitions in that type library can then be used by
this one. If the type library you want to add is not in the list, right click and choose Show All Type Libraries.
To remove a dependency, uncheck the box to the left of a type library name.
To view one of the other type libraries, select that type library, right click and choose View Type Library.
1055
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Implements Page
Only available when a CoClass is selected in the Object List pane. Lists the interfaces that the CoClass implements. Use this
page to change the interfaces associated with the object or change their properties.
Item Description
Interface Name of an interface or dispinterface that the CoClass supports. Note that the name for interfaces
and dispinterfaces is assigned on the Attributes page when the interface is selected.
GUID The globally unique identifier for the interface. This column is informational only: its value can’t be
changed.
Source Indicates whether the interface functions as an event source. If so, the CoClass does not implement
the interface. Rather, clients implement the interface and the CoClass calls them using this interface
when it fires events.
Default Indicates that the interface or dispinterface represents the default interface. This is the interface that
is returned by default when an instance of the class is created. A CoClass can have two default
members at most. One represents the primary interface, and the other represents an optional
dispinterface that serves as an event source.
Restricted Prevents the item from being used by a programmer. An interface cannot have both restricted and
default attributes.
VTable Indicates whether interface methods can be called using a VTable (as opposed to IDispatch calls).
This column is informational only: its value can’t be changed.
COM+ Page
Use this page to change the transaction attribute of a transactional object you will install with MTS or the COM+ attributes of a
CoClass you will install with COM+.
You can also use this page for Automation objects that were not created using the Transactional Object wizard, and it will
influence the way the IDE installs them into MTS packages or COM+ applications. However, objects that are not created using
the wizard do not automatically include support for IObjectControl. This means that they are not notified about activation and
deactivation (and so do not have OnActivate and OnDeactivate events). They also do not have an ObjectContext property. You
must therefore obtain the object context by calling the global GetObjectContext function.
Note: Only the Transaction Model attribute is used when installing into an MTS package, all other settings are ignored. If you
intend to install the object under MTS, it must be an Automation object in an in-process server (DLL).
Warning: The attributes you specify on the COM+ page are encoded as custom data in the type library. This data is not
recognized outside of Delphi. Therefore, it only has an effect if you install the transactional object from the IDE. If you deploy
your object in any other way, these settings must be explicitly set using the MTS Explorer or COM+ Component Manager.
Item Description
Call Syncronization COM+ only: Determines how the object participates in activities. These provide additional
3 synchronization support beyond that supplied by the threading model.
Transaction Model Specifies the transaction attribute, which indicates how the object participates in transactions, if at all.
The possible values differ depending on whether the object is to be deployed under MTS or COM+.
Note that if the transaction attribute indicates that transactions are supported, Just In time Activation
must be enabled.
Object Pooling COM+ only: Determines whether object instances can be pooled. When enabling Object Pooling, it is
your responsibility to ensure that the object is stateless.
1056
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Creation TimeOut COM+ only: Determines how long, in milliseconds, a pooled object remains in the object pool before
it is freed.
Allow Inproc Only applicable when the CoClass represents a COM+ event object. Determines whether in-process
Subscribers applications can register interest as clients of the event object.
Fire In Parallel Only applicable when the CoClass represents a COM+ event object.Determines whether COM+ fires
events in parallel (on multiple threads), or one by one on the same thread.
Parameters Page
Only available when a property or method is selected in the Object List pane. It lets you set the parameters and return value for
methods (including property access methods).
Item Description
Name Represents the parameter name. You can edit the value directly.
Type Represents the data type of the parameter. Select an available type from the drop-down list that
appears when you click in the Type column.
Default Value Specify a default value for an optional parameter by typing it into the column. All subsequent
parameters must be optional. Any preceding optional parameters should also have a default value.
When working in Object Pascal, local IDs are specified using a parameter type specifier of TLCID. In
IDL, this is specified using a parameter modifier.
Views any form in the current project. When you select a form, it becomes the active form, and its associated unit becomes the
active module in the Code Editor.
Views the project file or any unit in the current project. When you open a unit, it becomes the active page in the Code Editor.
Item Description 3
Windows Select a window and click OK to display that window.
1057
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Brings up a new Code Editor window as a separate window. The previous Code Editor window remains open.
See Also
Form Designer ( see page 46)
Shows the logical structure and containment hierarchy of your project. Note the ECO framework is available only for C# and
Delphi for .NET, and in the Architect SKU and higher. ECO-related icons and topic links are unavailable in other product SKUs.
3 Note: On code visualization diagrams, each .NET namespace declaration corresponds to a UML package (this is not true for
ECO-enabled source code). Double-clicking on a namespace node in the Model View tree
cannot open a specific source code file, since namespaces can span multiple source files.
for a specific class, interface, or member, double-click the item in the Model View tree.
1058
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
See Also
Using Code Visualization
Importing a Model
Provides runtime debugging for C++ applications being developed. CodeGuard reports errors that are not caught by the compiler
because they do not violate the syntax rules. CodeGuard tracks runtime libraries with full support for multithreaded applications.
See Also
Errors reported by CodeGuard
Using CodeGuard
3.2.17.32 Desktops
View Desktops
Allows you to choose between preset desktop layouts. Desktop layouts can be used to create and manage windows.
Item Description
None Does not specify a preset desktop layout.
Classic Undocked Emulates earlier Delphi versions, with separate windows for the menus and palette, designer, etc.
3
Debug Layout Customized for debugging, with call stack, thread, and other views shown instead of the default
windows used for designing applications.
Default Layout Shows all windows docked into one container, with the most-used designing windows shown,
including the tool palette, object inspector, design form, etc.
See Also
Saving Desktop Layouts ( see page 161)
1059
View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
Sizes new Code Editor windows to fit appropriately inside the IDE. You can reselect Dock Edit Window to toggle between the
new Code Editor window and the original Code Editor window.
See Also
New Edit Window ( see page 1057)
Brings up the Find References pane. This pane is dockable and is used in conjunction with the Search Find function.
See Also
Finding References ( see page 141)
Displays a hint containing information about the symbol such as type, file, location of declaration, and any XML documentation
associated with the symbol (if available).
Alternative ways to invoke Help Insight is to hover the mouse over an identifier in your code while working in the Code Editor, or
by pressing CTRL+SHIFT+H.
See Also
Code Editor ( see page 42)
Displays gray borders that represent page margins in the Diagram View and Overview. Diagrams exist within the context of a
3
namespace (or a package). This feature is only applies to ASP .NET applications.
See Also
Together Diagram Overview ( see page 90)
1060
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) View
Shows the design grid in the background behind diagrams. Diagrams exist within the context of a namespace (or a package).
This feature is only applies to ASP .NET applications.
To turn on the grid, open Tools Options HTML/ASP.NET. In the Designer Options select Grid Layout from the pull-down
menu.
See Also
Together Diagram Overview ( see page 90)
Displays tags in an ASP form. This feature only applies to ASP .NET applications.
Allows diagram elements to "snap" to the border of a control to the nearest coordinate of the diagram background design grid.
The snap function works whether the grid is visible or not. Diagrams exist within the context of a namespace (or a package). This
feature is only applies to ASP .NET applications.
See Also
Together Diagram Overview ( see page 90)
3.2.17.40 Toolbars
View Toolbars
Allows you to choose the toolbars that are displayed in the IDE.
3
Item Description
Standard Adds buttons that are used for opening and saving files and other common tasks.
Debug Adds buttons that are used for stepping, tracing, and other debugging tasks.
Custom Adds buttons that links to Help Contents. See link below.
Spacing Adds buttons that control spacing of components on the design form.
Position Adds buttons that control positioning and visibility of components on the design form.
1061
Win View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
See Also
Packages ( see page 156)
Edits resource strings directly, adds translated strings to the Translation Repository, or gets strings from the Translation
Repository.
See Also
Editing Resource Files in the Translation Manager ( see page 170)
Opens the product's Welcome Page, which displays lists of your recent projects and favorites. The Welcome Page also contains
links to developer resources, such as product-related online help. As you develop projects, you can quickly access them from the
list of recent projects at the top of the Welcome Page.
See Also
IDE Tour ( see page 34)
3 Assembly Metadata Explorer (Reflection viewer) ( see page 1063) File Open...
Use the assembly metadata explorer (Reflection viewer) to inspect types
contained within a .NET assembly.
Type Library Explorer ( see page 1065) File Open...
Use the type library explorer to inspect types and interfaces defined within a
Windows type library.
Search ( see page 1066) Use this dialog box to search for various kinds of elements (such as classes or
interfaces), or for a specific element within a .NET assembly, or a type library.
1062
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Win View
Use the assembly metadata explorer (Reflection viewer) to inspect types contained within a .NET assembly.
The metadata fields shown on each tab differ according to the type of item selected in the tree. The sections below list the
metadata fields that are displayed on each tab.
Properties Tab
Displays properties of the selected item
1063
Win View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
ID Class, Field, Property, Method, Event The ID is an internal number that shows where to
find the type in the assembly's internal metadata
tables.
Extends Class The base class of the selected class
Extends ID Class The internal ID of the base class
Value Type Field
Value Field
Return Type Method
Attributes Tab
The Attributes tab shows all attributes (including custom attributes) that were applied to the selected item in source code. For
each attribute, the name is displayed alongside the attribute's value.
Flags Tab
The Flags tab displays the set of metadata flags that could apply to the selected item. Each flag is represented by a check box.
If the box is checked, the flag is set in the selected item's metadata. If the box is cleared, the flag has not been applied to the
selected item.
Uses Tab
The Uses tab displays the list of assemblies that the selected assembly depends on. Each assembly listed must be deployed on
the end-user's machine.
Implements Tab
The Implements tab is visible when the selected item is a class, sealed class, or interface. This tab lists each interface
implemented by the selected item. Each implemented interface is a link that you can click. Clicking an implemented interface link
will cause that item to be selected in the tree, and its metadata properties will be displayed. You can use the Forward and Back
browser buttons on the Toolbar to quickly navigate back to the previously selected class or interface.
Implementors Tab
The Implementors tab is visible when an interface is selected in the left-hand pane. This tab displays all those classes that
implement the interface.
Parameters Tab
The Parameters tab is visible when a method is selected in the left-hand pane. Each parameter is listed by name, alongside its
type, and modifier (such as ref and out).
Certain methods, denoted by blue color and underlining, are clickable links; these are methods that are within the assembly you
are viewing. Click a method link to make that method the selected item in the left-hand pane. Other methods listed in the Calls
3 and Called By panes are not links; these methods are defined in assemblies outside the one you are viewing.
You can navigate forward and back to previously selected items using the browser buttons on the Toolbar.
See Also
Using COM Interop in Managed Applications
1064
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Win View
Use the type library explorer to inspect types and interfaces defined within a Windows type library.
1065
Win View RAD Studio (Common) 3.2 RAD Studio Dialogs and Commands
See Also
Using COM Interop in Managed Applications
3.2.18.3 Search
Use this dialog box to search for various kinds of elements (such as classes or interfaces), or for a specific element within a
.NET assembly, or a type library.
Item Description
Text to find The text string to search for in the assembly or type library.
Type to find A drop-down list containing the types of elements you can search for. These are: Class, Interface,
Method, Property, Field, and Event. If no element type is specified, all elements matching the search
string will be returned.
3
Case sensitive If checked, elements matching the search string must also match case. If unchecked, all elements
matching the search string will be returned, regardless of case.
Search Click to begin the search.
Items matching the search criteria are displayed in a table in the Search dialog. Items in the table are clickable links; clicking on
an item will cause that item to be selected in the left-hand pane of the explorer view.
1066
3.2 RAD Studio Dialogs and Commands RAD Studio (Common) Win View
dialog is modeless, so you can leave it open and continue working with the main explorer window.
See Also
Using COM Interop in Managed Applications
1067
Key Mappings RAD Studio (Common) 3.3 Keyboard Mappings
Topics
Name Description
Key Mappings ( see page 1068) Tools Options Editor Options Key Mappings
Use this page to enable or disable key binding enhancement modules and
change the order in which they are initialized.
BRIEF Keyboard Shortcuts ( see page 1069) The following table lists the BRIEF Mapping keyboard shortcuts for the Code
Editor.
IDE Classic Keyboard Shortcuts ( see page 1070) The following table lists the IDE Classic Mapping keyboard shortcuts for the
Code Editor.
Note: Keyboard shortcuts that include the CTRL+ALT
key combination are disabled when the Use CTRL+ALT Keys option is
unchecked on the Tools Options Editor Options Key Mappings page.
Default Keyboard Shortcuts ( see page 1073) The following table lists the Default Mapping keyboard shortcuts for the Code
Editor.
Note: Keyboard shortcuts that include the CTRL+ALT
key combination are disabled when the Use CTRL+ALT Keys option is
unchecked on the Tools Options Editor Options Key Mappings page.
Epsilon Keyboard Shortcuts ( see page 1076) The following table lists the Epsilon Mapping keyboard shortcuts for the Code
Editor.
Note: Keyboard shortcuts that include the CTRL+ALT
key combination are disabled when the Use CTRL+ALT Keys option is
unchecked on the Tools Options Editor Options Key Mappings page.
Visual Basic Keyboard Shortcuts ( see page 1078) The following table lists the Visual Basic Mapping keyboard shortcuts for the
Code Editor.
Note: Keyboard shortcuts that include the CTRL+ALT
key combination are disabled when the Use CTRL+ALT Keys option is
unchecked on the Tools Options Editor Options Key Mappings page.
Visual Studio Keyboard Shortcuts ( see page 1079) The following table lists the Visual Studio Mapping keyboard shortcuts for the
Code Editor.
Note: Keyboard shortcuts that include the CTRL+ALT
key combination are disabled when the Use CTRL+ALT Keys option is
unchecked on the Tools Options Editor Options Key Mappings page.
Use this page to enable or disable key binding enhancement modules and change the order in which they are initialized.
3 Item Description
Key mapping modules Lists the available key bindings.
To set the default key binding, use the Editor Options page Editor SpeedSettings option.
1068
3.3 Keyboard Mappings RAD Studio (Common) BRIEF Keyboard Shortcuts
Enhancement modules Enhancement modules are special packages that are installed and registered and use the keyboard
binding features that can be developed using the Open Tools API. You can create enhancement
modules that contain new keystrokes or apply new operations to existing keystrokes.
Once installed, the enhancement modules are displayed in the Enhancement modules list box.
Clicking the check box next to the enhancement module enables it and unchecking it disables it. Key
mapping defined in an installed and enabled enhancement module overrides any existing key
mapping defined for that key in the key mapping module which is currently in effect.
Move Up Moves the selected enhancement module up one level in the list.
Move Down Moves the selected enhancement module down one level in the list.
Use CTRL+ALT Keys If checked, the CTRL+ALT key combination is used in shortcuts throughout the IDE. If unchecked,
those shortcuts are disabled and CTRL+ALT can be used to perform other functions, such as entering
accent characters.
See Also
Default Key Mapping ( see page 1073)
Shortcut Action
Alt+A Marks a non-inclusive block
Alt+B Displays a list of open files
Alt+Backspace Deletes the word to the right of the cursor
Alt+C Mark the beginning of a column block
Alt+D Deletes a line
Alt+F9 Displays the local menu
Alt+Hyphen Jumps to the previous page
Alt+I Toggles insert mode
Alt+K Deletes of the end of a line
3
Alt+L Marks a line
Alt+M Marks an inclusive block
Alt+N Displays the contents of the next page
Alt+P Prints the selected block
Alt+Page Down Goes to the next tab
Alt+Page Up Goes to the previous tab
1069
IDE Classic Keyboard Shortcuts RAD Studio (Common) 3.3 Keyboard Mappings
1070
3.3 Keyboard Mappings RAD Studio (Common) IDE Classic Keyboard Shortcuts
key combination are disabled when the Use CTRL+ALT Keys option is unchecked on the Tools Options Editor
Options Key Mappings page.
Shortcut Action
Alt+[ Finds the matching delimiter (forward)
Alt+] Finds the matching delimiter (backward)
Alt+Page Down Goes to the next tab
Alt+Page Up Goes to the previous tab
Alt+Shift+Down Arrow Moves the cursor down one line and selects the column from the left of the starting cursor position
Alt+Shift+End Selects the column from the cursor position to the end of the current line
Alt+Shift+Home Selects the column from the cursor position to the start of the current line
Alt+Shift+Left Arrow Selects the column to the left of the cursor
Alt+Shift+Page Down Moves the cursor down one line and selects the column from the right of the starting cursor position
Alt+Shift+Page Up Moves the cursor up one screen and selects the column from the left of the starting cursor position
Alt+Shift+Right Arrow Selects the column to the right of the cursor
Alt+Shift+Up Arrow Moves the cursor up one line and selects the column from the left of the starting cursor position
Click+Alt+mousemove Selects column-oriented blocks
Ctrl+/ Adds or removes // to each line in the selected code block to comment the code.
Ctrl+Alt+Shift+End Selects the column from the cursor position to the end of the current file
Ctrl+Alt+Shift+Home Selects the column from the cursor position to the start of the current file
Ctrl+Alt+Shift+Left Selects the column to the left of the cursor
Arrow
Ctrl+Alt+Shift+Page Selects the column from the cursor position to the top of the screen
Down
Ctrl+Alt+Shift+Page Up Selects the column from the cursor position to the bottom of the screen
Ctrl+Alt+Shift+Right Selects the column to the right of the cursor
Arrow
Ctrl+Backspace Deletes the word to the right of the cursor
Ctrl+Del Deletes a currently selected block
Ctrl+Down Arrow Scrolls down one line
Ctrl+End Moves to the end of a file
Ctrl+Enter Opens file at cursor
Ctrl+Home Moves to the top of a file
Ctrl+I Inserts a tab character
3
Ctrl+J Templates pop-up menu
Ctrl+Left Arrow Moves one word left
Ctrl+N Inserts a new line
Ctrl+O+C Turns on column blocking
Ctrl+O+K Turns off column blocking
Ctrl+O+O Insert compiler options
1071
IDE Classic Keyboard Shortcuts RAD Studio (Common) 3.3 Keyboard Mappings
3 Shift+End Selects from the cursor position to the end of the current line
Shift+Enter Inserts a new line with a carriage return
Shift+Home Selects from the cursor position to the start of the current line
Shift+Left Arrow Selects the character to the left of the cursor
Shift+PgDn Moves the cursor down one line and selects from the right of the starting cursor position
Shift+PgUp Moves the cursor up one screen and selects from the left of the starting cursor position
Shift+Right Arrow Selects the character to the right of the cursor
1072
3.3 Keyboard Mappings RAD Studio (Common) Default Keyboard Shortcuts
key combination are disabled when the Use CTRL+ALT Keys option is unchecked on the Tools Options Editor
Options Key Mappings page.
Shortcut Action
Alt+[ Finds the matching delimiter (forward).
Alt+] Finds the matching delimiter (backward).
Alt+Left Arrow Go back after Alt+Up Arrow or Ctrl+Click (go to declaration) operation.
Alt+F7 Go to previous error or message in Message View.
Alt+F8 Go to next error / message in Message View.
Alt+Page Down Goes to the next tab.
Alt+Page Up Goes to the previous tab.
Alt+Right Arrow Go forward after Alt+Left Arrow operation.
Alt+Shift+Down Arrow Moves the cursor down one line and selects the column from the left of the starting cursor position.
Alt+Shift+End Selects the column from the cursor position to the end of the current line.
Alt+Shift+Home Selects the column from the cursor position to the start of the current line.
Alt+Shift+Left Arrow Selects the column to the left of the cursor.
Alt+Shift+Page Down Moves the cursor down one line and selects the column from the right of the starting cursor position.
Alt+Shift+Page Up Moves the cursor up one screen and selects the column from the left of the starting cursor position.
Alt+Shift+Right Arrow Selects the column to the right of the cursor.
Alt+Shift+Up Arrow Moves the cursor up one line and selects the column from the left of the starting cursor position.
Alt+Up Arrow Go to declaration.
Click+Alt+mousemove Selects column-oriented blocks.
Ctrl+/ Adds or removes // to each line in the selected code block to comment the code.
Ctrl+Alt+F12 Display a drop down list of open files.
3
Ctrl+Alt+Shift+End Selects the column from the cursor position to the end of the current file.
Ctrl+Alt+Shift+Home Selects the column from the cursor position to the start of the current file.
Ctrl+Alt+Shift+Left Selects the column to the left of the cursor.
Arrow
Ctrl+Alt+Shift+Page Selects the column from the cursor position to the top of the screen.
Down
1073
Default Keyboard Shortcuts RAD Studio (Common) 3.3 Keyboard Mappings
Ctrl+Alt+Shift+Page Up Selects the column from the cursor position to the bottom of the screen.
Ctrl+Alt+Shift+Right Selects the column to the right of the cursor.
Arrow
Ctrl+Backspace Deletes the word to the right of the cursor.
Ctrl+Click Go to declaration.
Ctrl+Del Deletes a currently selected block.
Ctrl+Down Arrow Scrolls down one line.
Ctrl+End Moves to the end of a file.
Ctrl+Enter Opens file at cursor.
Ctrl+Home Moves to the top of a file.
Ctrl+I Inserts a tab character.
Ctrl+J Templates pop-up menu.
Ctrl+K+n Sets a bookmark, where n is a number from 0 to 9.
Ctrl+K+T Select word.
Ctrl+Left Arrow Moves one word left.
Ctrl+n Jumps to a bookmark, where n is the number of the bookmark, from 0 to 9.
Ctrl+N Inserts a new line.
Ctrl+O+C Turns on column blocking.
Ctrl+O+K Turns off column blocking.
Ctrl+O+L Turn on line blocking mode.
Ctrl+O+O Insert compiler options.
Ctrl+P Causes next character to be interpreted as an ASCII sequence.
Ctrl+PgDn Moves to the bottom of a screen.
Ctrl+PgUp Moves to the top of a screen.
Ctrl+Q+# Go to bookmark.
Ctrl+Right Arrow Moves one word right.
Ctrl+Shift+C Invokes class completion for the class declaration in which the cursor is positioned.
Ctrl+Shift+# Set bookmark.
Ctrl+Shift+B Display buffer list.
Ctrl+Shift+Down Arrow Jump between declaration and implementation.
Ctrl+Shift+Enter Find usages.
Ctrl+Shift+J SyncEdit.
Ctrl+Shift K+A Expands all blocks of code.
3 Ctrl+Shift K+C Collapses all classes.
Ctrl+Shift K+E Collapses a block of code.
Ctrl+Shift K+G Initializes/finalize or interface/implementation.
Ctrl+Shift K+M Collapses all methods.
Ctrl+Shift K+N Collapses namespace/Unit.
Ctrl+Shift K+O Toggles between enabling and disabling Code Folding.
1074
3.3 Keyboard Mappings RAD Studio (Common) Default Keyboard Shortcuts
1075
Epsilon Keyboard Shortcuts RAD Studio (Common) 3.3 Keyboard Mappings
Shift+Up Arrow Moves the cursor up one line and selects from the left of the starting cursor position.
key combination are disabled when the Use CTRL+ALT Keys option is unchecked on the Tools Options Editor
Options Key Mappings page.
Shortcut Action
Alt+) Locates the next matching delimiter (cursor must be on ')', '}' or ']')
Alt+? Displays context-sensitive Help
Alt+\ Deletes spaces and tabs around the cursor on the same line
Alt+Backspace Deletes the word to the left of the current cursor position
Alt+C Capitalizes the first letter of the character after the cursor and lowercases all other letters to the end
of the word
Alt+D Deletes to word to the right of the cursor
Alt+Del Deletes all text in the block between the cursor and the previous matching delimiter (cursor must be
on ')', '}' or ']')
Alt+L Converts the current word to lowercase
Alt+Shift+/ Displays context-sensitive Help
Alt+Shift+O Locates the next matching delimiter (cursor must be on ')', '}' or ']')
Alt+T Transposes the two words on either side of the cursor
Alt+Tab Indents to the current line to the text on the previous line
Alt+U Converts a selected word to uppercase or converts from the cursor position to the end of the word to
uppercase
Alt+X Invokes the specified command or macro
Backspace Deletes the character to the left of the current cursor position
Ctrl+/ Adds or removes // to each line in the selected code block to comment the code.
Ctrl+_ Displays context-sensitive Help
Ctrl+Alt+B Locates the next matching delimiter (cursor must be on ')', '}' or ']')
Ctrl+Alt+F Locates the previous matching delimiter (cursor must be on ')', '}' or ']')
Ctrl+Alt+H Deletes the word to the left of the current cursor position
3
Ctrl+Alt+K Deletes all text in the block between the cursor and the next matching delimiter (cursor must be on ')',
'}' or ']')
Ctrl+D Deletes the currently selected character or character to the right of the cursor
Ctrl+H Deletes the character to the left of the current cursor position
Ctrl+K Cuts the contents of line and places it in the clipboard
Ctrl+L Centers the active window
1076
3.3 Keyboard Mappings RAD Studio (Common) Visual Basic Keyboard Shortcuts
1077
Visual Basic Keyboard Shortcuts RAD Studio (Common) 3.3 Keyboard Mappings
key combination are disabled when the Use CTRL+ALT Keys option is unchecked on the Tools Options Editor
Options Key Mappings page.
1078
3.3 Keyboard Mappings RAD Studio (Common) Visual Studio Keyboard Shortcuts
1079
Visual Studio Keyboard Shortcuts RAD Studio (Common) 3.3 Keyboard Mappings
key combination are disabled when the Use CTRL+ALT Keys option is unchecked on the Tools Options Editor
Options Key Mappings page.
Shortcut Action
Alt+[ Finds the matching delimiter (forward)
Alt+] Finds the matching delimiter (backward)
Alt+Backspace Edit|Undo
Alt+F12 Browse symbol at cursor (Delphi)
Alt+Page Down Goes to the next tab
Alt+Page Up Goes to the previous tab
Alt+Shift+Backspace Edit|Redo
Alt+Shift+Down Arrow Moves the cursor down one line and selects the column from the left of the starting cursor position
Alt+Shift+End Selects the column from the cursor position to the end of the current line
Alt+Shift+Home Selects the column from the cursor position to the start of the current line
Alt+Shift+Left Arrow Selects the column to the left of the cursor
Alt+Shift+Page Down Moves the cursor down one line and selects the column from the right of the starting cursor position
Alt+Shift+Page Up Moves the cursor up one screen and selects the column from the left of the starting cursor position
Alt+Shift+Right Arrow Selects the column to the right of the cursor
Alt+Shift+Up Arrow Moves the cursor up one line and selects the column from the left of the starting cursor position
Ctrl+Alt+Shift+End Selects the column from the cursor position to the end of the current file
Ctrl+Alt+Shift+Home Selects the column from the cursor position to the start of the current file
Ctrl+Alt+Shift+Left Selects the column to the left of the cursor
Arrow
Ctrl+Alt+Shift+Page Selects the column from the cursor position to the top of the screen
Down
Ctrl+Alt+Shift+Page Up Selects the column from the cursor position to the bottom of the screen
Ctrl+Alt+Shift+Right Selects the column to the right of the cursor
Arrow
Ctrl+F4 Closes the current page
Ctrl+J Templates pop-up menu
Ctrl+K+C Adds or removes // to each line in the selected code block to comment the code.
Ctrl+K+E Converts the word under the cursor to lower case
Ctrl+K+F Converts the word under the cursor to upper case
Ctrl+L Search|Search Again
3
Ctrl+P Causes next character to be interpreted as an ASCII sequence
Ctrl+Q+[ Finds the matching delimiter (forward)
Ctrl+Q+] Finds the matching delimiter (backward)
Ctrl+Q+Ctrl+[ Finds the matching delimiter (forward)
Ctrl+Q+Ctrl+] Finds the matching delimiter (backward)
Ctrl+Q+Y Deletes to the end of a line
1080
3.3 Keyboard Mappings RAD Studio (Common) Visual Studio Keyboard Shortcuts
Ctrl+Shift+C Invokes class completion for the class declaration in which the cursor is positioned
Ctrl+Shift+End Selects from the cursor position to the end of the current file
Ctrl+Shift+Home Selects from the cursor position to the start of the current file
Ctrl+Shift+Left Arrow Selects the word to the left of the cursor
Ctrl+Shift+PgDn Selects from the cursor position to the bottom of the screen
Ctrl+Shift+PgUp Selects from the cursor position to the top of the screen
Ctrl+Shift+Right Arrow Selects the word to the right of the cursor
Ctrl+Shift+Tab Displays the previous window in the buffer list
Ctrl+T Deletes the word to the left of the cursor
Ctrl+Tab Displays the next window in the buffer list
Ctrl+Y Deletes to the end of a line
Shift+Down Arrow Moves the cursor down one line and selects from the right of the starting cursor position
Shift+End Selects from the cursor position to the end of the current line
Shift+Enter Inserts a new line character
Shift+Home Selects from the cursor position to the start of the current line
Shift+Left Arrow Selects the character to the left of the cursor
Shift+PgDn Moves the cursor down one line and selects from the right of the starting cursor position
Shift+PgUp Moves the cursor up one screen and selects from the left of the starting cursor position
Shift+Right Arrow Selects the character to the right of the cursor
Shift+Space Inserts a blank space
Shift+Up Arrow Moves the cursor up one line and selects from the left of the starting cursor position
1081
IDE Command Line Switches and Options RAD Studio (Common) 3.4 Command Line Switches and File
Topics
Name Description
IDE Command Line Switches and Options ( see page 1082) Describes available options when starting the IDE from the command line.
File Extensions of Files Generated by RAD Studio ( see page 1084) The following table lists the extensions of files generated by RAD Studio.
Note: MSBuild requires that the extension for all project files end in 'proj' (that is,
MSBuild uses the mask *.*proj).
Use the IDE command line switches with the IDE startup command: bds.exe
For example:
General options
Option Description
? Launches the IDE and displays online help for IDE command-line options.
3 -- (two hyphens) Ignore rest of command-line.
ns No splash screen. Suppresses display of the splash screen during IDE startup.
np No welcome page. Does not display the welcome page after starting the IDE.
ppersonality Starts the specified personality of the RAD Studio IDE. The possible values for personality are:
Delphi
CBuilder
DelphiDotNet
1082
3.4 Command Line Switches and File RAD Studio (Common) File Extensions of Files Generated by RAD
rregkey Allows you to specify an alternate base registry key so you can run two copies of the IDE using
different configurations. This allows component developers to debug a component at design-time by
using the IDE as the hosting application without the debugging IDE interfering by trying to load the
component package being developed.
Debugger options
Option Description
attach:%1;%2 Performs a debug attach, using %1 as the process ID to attach to and %2 as the event ID for that
process. The attach option can be used manually, but is used mostly for Just in Time debugging.
dexename Loads the specified executable (exename) into the debugger. Any parameters specified after the
exename are used as parameters to the program being debugged and are ignored by the IDE. A
space is allowed between the -d and the exename.
l (Lowercase L) Assembler startup. Do not execute startup code. Must be used with the d option.
Normally, when you specify the -d option, the debugger attempts to run the process to either main or
WinMain. When -l is specified, the process is merely loaded and no startup code is executed.
sddirectories Source Directories. Must be used with the -d option. The argument is either a single directory or a
semicolon delimited list of directories which are used as the Debug Source Path setting (can also be
set using the Project Options Debugger page). No space is allowed between sd and the
directory list argument.
hhostname Remote debugger host name. Must be used with the -d option. A remote debug session is initiated
using the specified host name as the remote host where debugging is performed. The remote debug
server program must be running on the remote host.
tworkingdirectory Specifies a working directory for your debug session (corresponds to "Working directory" setting on
the Load Process dialog).
Project options
Option Description
filename (No preceding dash) The specified filename is loaded in the IDE. It can be a project, project group, or
a single file.
b AutoBuild. Must be used with the filename option. When the -b option is specified, the project or 3
project group is built automatically when the IDE starts. Any hints, errors, or warnings are then saved
to a file. Then the IDE exits. This facilitates doing builds in batch mode from a batch file. The Error
Level is set to 0 for successful builds and 1 for failed builds. By default, the output file has the same
name as the filename specified with the file extension changed to .err. This can be overridden using
the -o option.
m AutoMake. Same as AutoBuild, but a make is performed rather than a full build.
ooutputfile Output file. Must be used the -b or -m option. When the -o option is specified, any hints, warnings,
or errors are written to the file specified instead of the default file.
1083
File Extensions of Files Generated by RAD RAD Studio (Common) 3.4 Command Line Switches and File
Note: MSBuild requires that the extension for all project files end in 'proj' (that is, MSBuild uses the mask *.*proj).
File Description
Extension
app.config Dynamic properties and their values for .NET Windows applications.
asax, ASP.NET application files.
ascx,
asmx,
aspx
bdsproj Project options file for BDS 2006 and earlier. Contains the current settings for project options, such as compiler
and linker settings, directories, conditional directives, and command-line parameters. Set these options using
Project Options.
bdsgroup Project group for BDS 2006 and earlier products.
bpk Source file for a C++ Builder package; produces a .bpl file when compiled and linked.
bpl A compiled Delphi package or a compiled C++ package (see also .dpk).
bpr C++ Builder project source; when compiled, produces .exe, .dll or .ocx file.
cbproj C++ project. This is not 'cproj', which is a VS.NET C++ project.
cfg Project configuration file used for command line compiles. The compiler searches for a dcc32.cfg in the
compiler executable directory, then for dcc32.cfg in the current directory, and then finally for
projectname.cfg in the project directory. You can type dcc32 projectname on the command line and
compile the project with same options specified in the IDE.
config Config files contain project option information and build logic. Each project has a .config file.
cpp C++ source file.
cs The code-behind file for ASP.NET; also a C# source code file.
csm C++ precompiled header file.
csproj C# project, in keeping with MSBuild convention.
dci Holds Code Insight changes you make in the IDE.
dcp Contains all compile and link information for a Delphi package in the same way that a .dcu file has this information
for a .pas file. Use this file if building with runtime packages.
dcpil Delphi.NET compiled CLR import. Same as .dcp file for .NET.
dcu Delphi compiled unit. An intermediate compiler output file produced for each Win32 unit's source code. You do not
3 need to open these binary files or distribute them with your application. The .dcu file enables rapid compiling and
linking.
dcuil An intermediate compiler output file produced for each .NET unit's source code. Same as .dcu file for .NET.
delphi.dct Component template changes you make in the IDE.
dfm A Windows VCL form file.
dpk The source file for a Delphi package. When compiled, produces a .bpl file.
dpr Delphi project source; when compiled produces .exe, .dll, or .ocx file.
1084
3.4 Command Line Switches and File RAD Studio (Common) File Extensions of Files Generated by RAD
See Also 3
Packages and Standard DLLs
1085
Together Configuration Options RAD Studio (Common) 3.5 Together Reference
Topics
Name Description
Together Configuration Options ( see page 1086) This section describes UML modeling options.
Together Keyboard Shortcuts ( see page 1104) Together enables you to perform many diagram actions without using the mouse.
You can navigate between diagrams, create diagram elements, and more, using
the keyboard only.
GUI Components for Modeling ( see page 1105) This section describes GUI components of the RAD Studio interface you use for
UML modeling.
Together Refactoring Operations ( see page 1115) The following refactoring operations are available in Together:
Refactoring operations
Project Types and Formats with Support for Modeling ( see page 1116) There are two basic project types:
1086
3.5 Together Reference RAD Studio (Common) Together Configuration Options
Topics
Name Description
Configuration Levels ( see page 1088) The configuration options apply to the four hierarchical levels. Each level
contains a number of categories, or groups, of options.
The configuration options can be specified at the following levels:
1087
Together Configuration Options RAD Studio (Common) 3.5 Together Reference
• Default: Options at this level apply to all the current projects and project groupsolutions, as well as newly created ones.
Diagram options apply to newly created diagrams within these projects and project groupsolutions. All options are available at
this level.
• Project groupSolution: Options at this level apply to the current project groupsolution. Diagram options apply to newly
created diagrams within this project groupsolution. All options are available at this level.
• Project: Options at this level apply to the current project. Diagram options apply to newly created diagrams within this project.
All options except the Model View category are available at this level.
• Diagram: Options at this level apply to the current diagram. The Diagram options category is only available at this level.
See Also
Configuring Together ( see page 183)
Topics
Name Description
Together Diagram Appearance Options ( see page 1089) Tools Options Together Various Diagram Appearance
Descriptions for diagram appearance options.
The Diagram options enable you to control a number of default behaviors and
appearances of diagrams. The table below lists the Appearance options,
descriptions, and default values.
Together Diagram Layout Options ( see page 1091) Tools Options Together Various Diagram Layout
Descriptions for diagram layout options.
Layout options define the alignment of diagram elements.
Together Diagram Print Options ( see page 1094) Tools Options Together Various Diagram Print
Descriptions for diagram print options.
The Print options define default settings that apply to your printed diagrams.
Note that after these settings are applied to the printed material, OS-specific and
printer-specific settings will be applied as well.
The tables below list the Print options, descriptions, and default values.
Together Diagram View Filters Options ( see page 1096) Tools Options Together Various Diagram View Management
Descriptions for view filters options.
The View Filter group of options provide a set of filters that enable you to control
the type of data displayed in different views of a model.
The View Filters options control what elements display on your class and
namespace (package) diagrams. The table below lists the filters, descriptions,
and default values.
3
Together General Options ( see page 1098) Tools Options Together Various General
Descriptions for general options.
The General options allow you to customize certain behaviors in the user
interface that do not pertain to any other specific category of options such as
Diagram or View Filters. The table below lists the General options, descriptions,
and default values.
1088
3.5 Together Reference RAD Studio (Common) Together Configuration Options
Together Generate Documentation Options ( see page 1099) Tools Options Together Various Generate Documentation
Descriptions for generate documentation options.
The Generate Documentation options control the variety of content (as well as
appearance) to include or exclude from your generated HTML documentation.
The table below lists the Generate Documentation options, descriptions, and
default values.
Together Model View Options ( see page 1101) Tools Options Together Various Model View
Descriptions for Model View options.
The Model View options control how diagram content displays in the Model
View. The table below lists the Model View general options, descriptions, and
default values.
The Diagram options enable you to control a number of default behaviors and appearances of diagrams. The table below lists
the Appearance options, descriptions, and default values.
Font in diagrams This option defines the font and font size that is used in printed diagrams.
The default value is Arial, 9.75pt.
Wrap text in nodes This option controls whether the text displayed in a node automatically continues on the next line
when it reaches the right border of the node. If set to False, the rest of the text is not displayed.
The default value is True.
Maximum width of text This setting specifies a width limit for all text labels outside nodes (for example, link labels). The text
labels (pixels) automatically continues on the next line when it reaches this limit. If set to 0, the text is always
displayed in a single line.
The default value is 200.
Member format This option controls the format of members in class diagrams.
The default value is UML.
UML Methods (functions) are displayed as <name> (parameters) : <type>. Fields are displayed as
<name> : type> 3
Language Methods in C# are displayed as <type> <name>. Fields in C# are displayed as <type> <name>.
Functions in Visual Basic are displayed as <name> (parameters) As <type>. Fields in Visual
Basic are displayed as <name> As <type>.
1089
Together Configuration Options RAD Studio (Common) 3.5 Together Reference
Show page borders This option controls whether to show gray borders that represent page margins in the Diagram View
and Overview.
The default value is False.
Use default This parameter controls whether the system background color is used in diagrams. If this parameter
background color is true, then background color is defined according to the current Windows color scheme. If this
parameter is false, the background color is defined by the Custom diagram background color
parameter (see above).
The default value is True.
1090
3.5 Together Reference RAD Studio (Common) Together Configuration Options
Sort according to Choose this option to sort fields, methods, subclasses and properties according to their positions in
positions in source code the source code.
This option prevails over the others: if it is set to True, the options Sort elements alphabetically and
Sort elements by visibility are ignored.
Sort elements This option controls the order of members displayed within elements on diagrams. If this option is
alphabetically true, fields, methods, subclasses, and properties are sorted alphabetically within compartments.
The default value is True.
Sort elements by This option controls the order of members displayed within elements on diagrams. If this option is
visibility true, fields, methods, subclasses, and properties are sorted by visibility within compartments.
The default value is True.
See Also
Configuring Together ( see page 183)
1091
Together Configuration Options RAD Studio (Common) 3.5 Together Reference
1092
3.5 Together Reference RAD Studio (Common) Together Configuration Options
1093
Together Configuration Options RAD Studio (Common) 3.5 Together Reference
See Also
Diagram Layout Overview ( see page 92)
The Print options define default settings that apply to your printed diagrams.
Note that after these settings are applied to the printed material, OS-specific and printer-specific settings will be applied as well.
The tables below list the Print options, descriptions, and default values.
1094
3.5 Together Reference RAD Studio (Common) Together Configuration Options
3
Margins group Description and default value
Options
Bottom margin The bottom margin offset in inches. Use the decimal separator as defined in your regional settings.
The default value is 1.
Left margin The left margin offset in inches. Use the decimal separator as defined in your regional settings.
The default value is 1.
1095
Together Configuration Options RAD Studio (Common) 3.5 Together Reference
Right margin The right margin offset in inches. Use the decimal separator as defined in your regional settings.
The default value is 1.
Top margin The top margin offset in inches. Use the decimal separator as defined in your regional settings.
The default value is 1.
See Also
Configuring Together ( see page 183)
The View Filter group of options provide a set of filters that enable you to control the type of data displayed in different views of a
model.
The View Filters options control what elements display on your class and namespace (package) diagrams. The table below lists
the filters, descriptions, and default values.
1096
3.5 Together Reference RAD Studio (Common) Together Configuration Options
1097
Together Configuration Options RAD Studio (Common) 3.5 Together Reference
Show delegates This filtering option controls showing/hiding delegates in the current project. If it is set to true,
delegates are displayed.
The default value is True.
Show enumerations This filtering option controls showing/hiding enums in the current project. If it is set to true, enums are
displayed.
The default value is True.
Show events This filtering option controls showing/hiding events in the current project. If it is set to true, events are
displayed.
The default value is True.
Show interfaces This filtering option controls showing/hiding interfaces in the current project. If it is set to true,
interfaces are displayed.
The default value is True.
Show modules This filtering option controls showing/hiding modules in the current project. If it is set to true, modules
are displayed.
The default value is True.
Show namespaces This filtering option controls showing/hiding namespaces in the current project. If it is set to true,
namespaces are displayed.
The default value is True.
Show non public This filtering option controls showing/hiding nonpublic classes in the current project. If it is set to true,
classes nonpublic classes are displayed.
The default value is True.
Show notes This filtering option controls showing/hiding notes in the current project. If it is set to true, notes are
displayed.
The default value is True.
Show shortcuts This filtering option controls showing/hiding shortcuts in the current project. If it is set to true,
shortcuts are displayed.
The default value is True.
Show structures This filtering option controls showing/hiding structures in the current project. If it is set to true,
structures are displayed.
The default value is True.
See Also
Configuring Together ( see page 183)
1098
3.5 Together Reference RAD Studio (Common) Together Configuration Options
See Also
Interoperability Overview
The Generate Documentation options control the variety of content (as well as appearance) to include or exclude from your
generated HTML documentation. The table below lists the Generate Documentation options, descriptions, and default values.
3
1099
Together Configuration Options RAD Studio (Common) 3.5 Together Reference
Documentation Title Specifies the title to be placed at the top of the overview summary file. The title will be placed as a
centered, level-one heading directly beneath the upper navigation bar. It can contain HTML tags and
white spaces.
Footer Specifies the footer text to be placed at the bottom of each output file. The footer is placed to the right
of the lower navigation bar. It can contain HTML tags and white spaces.
Header Specifies the header text to be placed at the top of each output file. The header is placed to the right
of the upper navigation bar. It can contain HTML tags and white spaces.
Navigation type Specifies the location for descriptions of design elements:
Package: in package files
Diagram: in diagram files
The default value is Package.
Use Internal Browser When this options is true, an internal browser is used for documentation presentation.
The default value is False.
Window Title Specifies the title to be placed in the HTML <title> tag. This text appears in the window title and in
any browser bookmarks (favorites) created for this page. This title should not contain any HTML tags,
since the browser does not interpret them properly.
1100
3.5 Together Reference RAD Studio (Common) Together Configuration Options
Generate Tree This option controls whether to generate the class/interface hierarchy.
The default value is True.
Generate Use If this option is true, one Use page is included for each documented class and namespace. The page
describes which namespaces, classes, methods, constructors, and fields use any API of the given
class or namespace. Given class C, things that use class C would include subclasses of C, fields
declared as C, methods that return C, and methods and constructors with parameters of type C.
The default value is False.
See Also
Configuring Together ( see page 183)
The Model View options control how diagram content displays in the Model View. The table below lists the Model View general
options, descriptions, and default values.
See Also
Configuring Together ( see page 183)
3
3.5.1.3 Option Value Editors
To edit an option, click the value field to invoke the appropriate value editor. There are several types of value editors:
• In-line text editor. To edit a value in a text field, type the new value. Changes are applied when you press Enter or move the
focus to another field.
• Combo box or list box. Clicking a box field reveals the list of possible values. Select the required value from the list.
1101
Together Configuration Options RAD Studio (Common) 3.5 Together Reference
• Dialog box. Clicking a dialog box field reveals the button that opens the dialog box. Specify the required values and click OK
to apply changes.
See Also
Configuring Together ( see page 183)
The Sequence Diagram Roundtrip options apply to generating sequence diagrams from source code and generating source
code from a sequence diagram. The table below lists the Sequence Diagram Roundtrip options, descriptions, and default values.
3 See Also
Roundtrip engineering overview
1102
3.5 Together Reference RAD Studio (Common) Together Keyboard Shortcuts
The Source Code options allows you to control whether dependency links are drawn automatically on diagrams. The table below
lists the Source Code general options, descriptions, and default values.
See Also
Configuring Together ( see page 183)
1103
Together Keyboard Shortcuts RAD Studio (Common) 3.5 Together Reference
Action Shortcut
Cut, Copy, or Paste model elements or members. CTRL+X, CTRL+C,
CTRL+V
Activate the in-place editor for a diagram element to edit, rename a member. F2
Undo CTRL+Z
Redo CTRL+Y, CTRL+SHIFT+Z
Select all elements on the diagram CTRL+A
Close the Overview window ESC
Add a new namespace (package) to a diagram CTRL+E
Add a new class to a diagram CTRL+L
Add new method (operation) to a class or interface CTRL+M
3
Add a new field (attribute) to a class CTRL+W
Add a new interface to diagram CTRL+SHIFT+L
Open the Add Shortcuts dialog box CTRL+SHIFT+M
Add a new diagram from the Model View CTRL+SHIFT+D
1104
3.5 Together Reference RAD Studio (Common) GUI Components for Modeling
Action Shortcut
Open the Print Diagram dialog box CTRL+P
Diagram update F6
See Also
Help on Help ( see page 51)
Topics
Name Description
Diagram View ( see page 1106) Context menu (in the Model View) Open Diagram
The Diagram View displays model diagrams. Each diagram is presented in its
own tab.
To open the Diagram View, choose a diagram, namespace or a package in the
Model View, right-click it and choose Open Diagram on the context menu.
Most manipulations with diagram elements and links involve drag-and-drop
operations or executing right-click (or context) menu commands on the selected
elements.
Some of the actions provided by the context menus are:
1105
GUI Components for Modeling RAD Studio (Common) 3.5 Together Reference
The Diagram View displays model diagrams. Each diagram is presented in its own tab.
To open the Diagram View, choose a diagram, namespace or a package in the Model View, right-click it and choose Open
Diagram on the context menu.
Most manipulations with diagram elements and links involve drag-and-drop operations or executing right-click (or context) menu
commands on the selected elements.
Item Description
Working area The main part of the Diagram View shows the current diagram.
1106
3.5 Together Reference RAD Studio (Common) GUI Components for Modeling
Context menu The context menus of the Diagram View are context-sensitive. Right-clicking model elements,
including class members, provides access to element-specific operations on the respective context
menu. Right-clicking the diagram background opens the context menu for the diagram.
Overview button Opens the Overview pane (see below).
Overview pane
The overview feature of the Diagram View provides a thumbnail view of the current diagram. The Overview button is located in
the bottom right corner of every diagram.
OCL Editor
The OCL Editor is used to enter and edit OCL expressions. Any changes to the names of your model components (classes,
operations, attributes, and so on) used in these expressions are automatically updated by Together. This guarantees that your
OCL constraints always stay up-to-date.
See Also
Diagram Overview ( see page 90)
Topics
Name Description
Pattern Organizer ( see page 1107) Tools Pattern Organizer
The Pattern Organizer window enables you to logically organize the patterns
found in the Pattern Wizard using virtual trees, folders and shortcuts. You can
also view and edit pattern properties.
Pattern Registry ( see page 1109) Pattern Organizer context menu New Shortcut (or: Assign Pattern)
The Pattern Registry defines the virtual hierarchy of patterns. When you create
a folder or a shortcut in the Pattern Organizer and save the changes, a new entry
is added to the registry of shortcuts. All operations with the contents of the
Pattern Registry are performed in the Pattern Organizer, and synchronized with
the registry.
The window opens when using New Shortcut and Assign Pattern commands on
the Pattern Organizer context menu.
The Pattern Organizer window enables you to logically organize the patterns found in the Pattern Wizard using virtual trees, 3
folders and shortcuts. You can also view and edit pattern properties.
1107
GUI Components for Modeling RAD Studio (Common) 3.5 Together Reference
The subfolders beneath the root folder contain the following context menu items:
The context menu for pattern elements contains the following menu items:
Assign Pattern Opens the Pattern Registry allowing you to assign a pattern to the selected pattern element.
Cut Cuts the selected node to the clipboard.
Copy Copies the selected node to the clipboard.
Paste Pastes the clipboard contents to the selected node.
Delete Removes the selected node.
Properties
This section displays properties of the selected pattern or folder. You can edit the Name and Visible fields.
Name The name displayed in the Virtual pattern tree. This field is editable.
Valid This field applies only to patterns. If you have registered the pattern using the Pattern Registry, then
the status is reported as valid. Otherwise, the pattern status is Invalid, and it will not display in the
Pattern Wizard. Folders are always considered valid and shown in the Pattern Wizard dialog (unless
hidden using the Visible property).
Visible Use the combobox to specify whether the pattern or folder is visible or hidden in the Pattern Wizard
dialog.
Pattern description
A read-only section that displays comments for the selected pattern.
See Also
Patterns Overview ( see page 96)
1108
3.5 Together Reference RAD Studio (Common) GUI Components for Modeling
The Pattern Registry defines the virtual hierarchy of patterns. When you create a folder or a shortcut in the Pattern Organizer
and save the changes, a new entry is added to the registry of shortcuts. All operations with the contents of the Pattern Registry
are performed in the Pattern Organizer, and synchronized with the registry.
The window opens when using New Shortcut and Assign Pattern commands on the Pattern Organizer context menu.
Filters
The filters determine which patterns to display in the Patterns table. The Filters section provides the following set of filtering
options:
Option Description
Category The available options are:
Class Link Member Other All
Register This option filters patterns by status of registration: All - all existing patterns Already - the patterns
assigned to shortcuts None - the patterns not assigned to shortcuts
Containers This option filters patterns by the container metaclass.
Diagram type This option filters patterns that pertain to the selected diagram type.
Language This option is available for implementation projects only, and enables you to filter out
language-specific patterns.
Main sections
Option Description
Patterns Displays a table with the names and types of available patterns.
Pattern Properties Displays the properties of the pattern selected in the Patterns table.
Pattern Description A read-only section that displays comments for the pattern selected in the Patterns table.
Buttons
Button Description
Synchronize Click this button to search for patterns throughout your storage and update the Pattern Registry.
OK Click this button to save the filtering settings and close the window.
Cancel Click this button to discard the filtering settings and close the window.
Help Displays this page.
3
See Also
Patterns Overview ( see page 96)
1109
GUI Components for Modeling RAD Studio (Common) 3.5 Together Reference
3.5.3.3 Menus
Item Description
File menu You can use the File menu to export diagrams to image files, and print diagrams.
Edit menu Use the Edit menu to cut, copy, paste, and delete diagrams and diagram elements, select all items on
a diagram, and undo/redo actions.
View menu The View menu contains the command for opening the Model View.
Project menu Use the Project menu to enable or disable Together support for specific projects in the project
groupsolution currently open.
RefactorRefactoring The RefactorRefactoring menu contains refactoring commands for the implementation projects.
menu
Tools menu Use the Tools menu to generate documentation, open the pattern registry and pattern organizer, run
audits and metrics (for the implementation projects), and set Together-specific options.
Diagram context menu Use the Diagram context menu to add new elements, manage the layout, zoom in and out, show or
hide diagram elements, synchronize your diagram with the Model view, and edit hyperlinks.
Model View context Context menus of the various elements of the Model View are context-sensitive. The list of elements
menu that can be added to a diagram from the Model View depends on the element and diagram type.
Element context menus You can add or delete members (or delete the element itself), cut/copy/paste, view source code,
show element information and more. Explore the context menus of the different elements as you
encounter them to see what is available for each one.
See Also
Model View ( see page 1112)
Topics
Name Description
Audit Results Pane ( see page 1111) QA Audits dialog window Start button
Use this pane to view and export audit results.
Audit results are displayed as a table in the Audits View.
Each time that you generate audits for the same project, the audit results display
in a tabbed-page format with the most recent results having focus in the window.
Although the audit results open initially as a free-floating window, it is a dockable
window. The docking areas are any of the four borders of the RAD Studio
window. You can position the audit results window according to your preferences.
Tip: Press F1
3 with the Audits... more ( see page 1111)
Metric Results Pane ( see page 1112) QA Metrics dialog window Start button
Use this pane to view and export metric results.
The metrics results report is displayed as a table in the Metrics results pane.
The rows display the elements that were analyzed, and the columns display the
corresponding values of selected metrics. Context menus of the rows and
columns enable you to navigate to the source code, view descriptions of the
metrics, and produce graphical output.
Tip: Press F1
with the Metrics results pane having the focus to display this page.
1110
3.5 Together Reference RAD Studio (Common) GUI Components for Modeling
Each time that you generate audits for the same project, the audit results display in a tabbed-page format with the most recent
results having focus in the window.
Although the audit results open initially as a free-floating window, it is a dockable window. The docking areas are any of the four
borders of the RAD Studio window. You can position the audit results window according to your preferences.
Tip: Press F1
with the Audits View having the focus to display this page.
Item Description
Toolbar buttons
Save Audit results Saves audit results.
Print Audit results Prints audit results.
Refresh Recalculates the results that are currently displayed.
Restart Opens the Audits dialog window, define new settings and start new audits analysis.
Context menu
commands
Group By Groups items according to the selected column.
Show Description Displays a window with the full name and description of the selected audit.
Open Opens the selected element in the source code editor highlighting the relevant code.
Copy You can copy one row or multiple rows in the Audit results.
Use CTRL+CLICK to select multiple rows to copy.
Close Closes the current tab.
Close All Closes all tabs and the results window.
Close All But This Closes all tabs except for the tab currently in focus.
Note that only audit violations are shown in the results table. For this reason, the results do not necessarily display all of the
audits that you ran, or all the packages or classes that you processed. The table contains the following columns:
Audit violations
Violation Description
table column
Abbreviation The abbreviation for the audit name. The full name is displayed in the description (choose Show Description 3
on the context menu of the violation).
Description Describes why the audit flagged the item.
Severity Indicates how serious, in general, violations of the audit are considered to be. This will help you sort the results
and assess which violations are critical and which are not.
Resource The source code item that was flagged by the audit.
File The file that contains the problem code.
1111
GUI Components for Modeling RAD Studio (Common) 3.5 Together Reference
Line The line number in the file where the problem code is located.
See Also
Quality Assurance Facilities Overview ( see page 98)
The metrics results report is displayed as a table in the Metrics results pane. The rows display the elements that were
analyzed, and the columns display the corresponding values of selected metrics. Context menus of the rows and columns
enable you to navigate to the source code, view descriptions of the metrics, and produce graphical output.
Tip: Press F1
with the Metrics results pane having the focus to display this page.
Item Description
Toolbar buttons
Save Saves metric results.
Refresh Recalculates the results that are currently displayed.
Restart Opens the Metrics dialog window, define new settings and start new metrics analysis.
Context menu
commands
Show Description Displays a window with the full name and description of the selected metric.
Chart Builds a metric chart.
See Also
Quality Assurance Facilities Overview ( see page 98)
The Model View provides the logical representation of the model of your project: namespaces (packages) and diagram nodes.
Using this view, you can add new elements to the model; cut, copy, paste and delete elements, and more. Context menu
commands of the Model View are specific to each node. Explore these commands as you encounter them.
In the Model View, only the nodes and their respective subnodes shown in the Diagram View are listed under the
corresponding diagram node. For example, if you have a namespace (package) containing a class, both the namespace
(package) and class are shown under the diagram node in the Model View. However, any members of the class are not shown
1112
3.5 Together Reference RAD Studio (Common) GUI Components for Modeling
under the diagram node as they are displayed under the namespace (package) node only.
Although the Model View opens initially as a free-floating window, it is a dockable window. The docking areas are any of the four
borders of the RAD Studio window. You can position the Model View window according to your preferences.
• In the Show diagram nodes expandable field (Options Together Model View) choose True to show, or False to hide
expandable diagram nodes. By default, the Model View displays expandable diagram nodes with the elements contained
therein. You can hide expandable diagram nodes to further simplify the visual presentation of the project.
• In the Show links field (Options Together Model View) choose True to show, or False to hide expandable diagram
nodes. By default, the Model View does not display links between nodes. You can opt to show the links to make the visual
presentation of the project more detailed.
• In the Sorting type field ( Options Together Model View) choose Metaclass, Alphabetical, or None to sort elements in the
Model View. By default, diagram nodes are sorted by metaclass. You can sort elements in the Model View by metaclass,
alphabetically, or none.
• In the View type field (Options Together Model View) choose Diagram-centric or Model-centic from the list box. For the
sake of better presentation you can opt to show your model in diagram-centric or in model-centric modes. The Diagram-centic
mode assumes that the design elements are shown under their respective diagrams; the namespaces only contain classes
and interfaces (and the source-code elements for implementation projects). The Model-centric mode assumes that all
elements are shown under the namespaces.
Item Description
Root project node The topmost item of a project structure.
Nodes Namespaces (packages), diagrams, then model elements of the current model.
Refresh Model View Updates the model structure in the Model View to show possible changes in source code.
button
Regenerate ECO
source code button
Update ECO source
code button
Reload command
This command is available for implementation projects only.
You can use the Reload command (available at the root project node) to refresh the Together model from the source code. This
command provides a total refresh for the elements and removes invalid code elements from the model. Using this command has
the same effect as reopening the project groupsolution, but avoids the overhead of reinitializing RAD Studio.
See Also
Modeling Overview ( see page 89)
1113
Together Refactoring Operations RAD Studio (Common) 3.5 Together Reference
When Together support is activated, the Object InspectorProperties Window shows the properties of an element that is selected
in the Model or Diagram Views. To view the Object InspectorProperties Window, choose Object InspectorProperties Window
from the View menu, press F4, or press ALT+ENTER. The content of the Object InspectorProperties Window depends on the
element type.
You can use the Object InspectorProperties Window to edit diagram or element properties.
Item Description
Description Text editor field where you can optionally provide textual description of an element.
Design These properties are used to define the appearance of an element.
General UML and source code element properties.
User properties This node appears when there are user properties defined. In addition to the standard properties, you
can define an unlimited number of user-defined properties.
Using the Object InspectorProperties Window, you can view and edit the properties of an element. Clicking on an editable field
reveals which type of internal editor is available: text area, combobox with a list of values, or a dialog box. The read-only fields
are displayed gray. As you click on the element properties, their respective descriptions display at the bottom of the Object
InspectorProperties Window.
See Also
Working with User Properties ( see page 206)
Together extends the Tool PaletteToolbox of RAD Studio by adding model elements to it.
The RAD Studio Tool PaletteToolbox displays special tabs for the supported UML diagrams. When a diagram is opened in the
Diagram View, the appropriate tab appears in the Tool PaletteToolbox.
In the Tool PaletteToolbox you see model elements (nodes, links) that can be placed on the current diagram. However, you can
choose to show the tabs for all diagram types. Use the Tool PaletteToolbox buttons to create the diagram contents.
Note: The set of available model elements depends on the type of a diagram that is currently selected in the Diagram View
Tip: You can control the diagram elements that appear in the Tool Palette
Toolbox and create your own Tool PaletteToolbox tabs with specified items. You can cut, copy, paste, delete, rename, move up,
and move down Tool PaletteToolbox items to customize your Tool PaletteToolbox view. You can also display Tool
3 PaletteToolbox items alphabetically or in a list. Use the Tool PaletteToolbox context menu to accomplish such tasks. For further
information, please refer to the RAD Studio documentation.
See Also
Creating a Single Element ( see page 209)
1114
3.5 Together Reference RAD Studio (Common) Together Refactoring Operations
Refactoring operations
Operation Description
Change You can rename, add, or remove parameters for a single method using the Model View, Diagram View, or the
parameters Editor.
Extract The Extract Interface command creates a new interface from one or more selected classes. Each selected class
interface should implement the interface.
Extract You can extract method from a class or interface using the Editor only. It is important that the code fragment to be
method extracted must contain complete statements.
Extract The Extract Superclass command creates an ancestor class from several members of a given class.
superclass
Inline If you have a temporary variable that is assigned once with a simple expression, you can replace all references to
variable that variable with the expression using the Inline Variable command in the RAD Studio Editor.
Introduce Creates a new field.
field
Introduce Creates a new variable. This command is available in the Editor.
variable
Move Moving members only applies to the static methods, static fields and static properties (static members). This
members command is available on the Diagram View, on the Model View, and in the Editor.
Pull Use this command to copy a member (field, method, property, indexer, and event) from a subclass to a
Members superclass, optionally making it abstract. If there are no superclasses, an error message is displayed.
Up
Push Use this command to copy a member (field, method, property, and event) from a superclass to a subclass,
Members optionally making it abstract. If there are no subclasses, an error message is displayed.
Down Indexers cannot be pushed down.
Rename You can rename certain code elements: class, interface, method, field, parameter, local variable, and so on.
Together propagates the name changes to the dependent code in your project files.
You cannot rename indexers, constructors, or destructors.
You can rename namespaces by changing their names in the Diagram or Model Views. Together makes the
appropriate changes in this case as well. This action does not require you to use the Refactoring commands.
When renaming a method, all descendant classes are scanned for possible overrides. All found overrides and
their usages are renamed too. However, if the method being renamed overrides some base class method, you
are asked if you want to rename this base class method (and all overrides as well), or only the selected method
(and its overrides). Refactoring also checks whether the method name that you enter coincides with some base
class method. In such cases, a warning is displayed. When renaming a method that belongs to a child class, you
can choose to propagate renaming to the parent classes and overloads, checking the respective options Refactor
Ancestors and Rename Overloads in the Rename Method dialog. If such renaming in the ancestor classes is 3
impossible, a warning message appears. However, you can still rename the selected method only.
If you rename a model element that is referenced from another project, RAD Studio updates both projects.
Safe The Safe Delete command searches your code for any usages of the element that you wish to delete. You can
Delete invoke the command from the Diagram View, Model View, or from the Editor.
See Also
Refactoring Overview ( see page 98)
1115
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
• Design project. Project file extension: .bdsproj.tgproj. These projects are language-neutral and comply with one of the
two versions of UML specifications: UML 1.5 or UML 2.0.
• Implementation project. Project file extension: .bdsproj.csproj (Visual C# .NET), and .vbproj (Visual Basic .NET).
You can create models for language-specific projects. Modeling that complies with UML 1.5 specification is supported for C#
and DelphiVisual Basic .NET projects. Together modeling features are automatically activated for these projects.
The set of available project types depends on your license. Together Designer is required to work with design projects. Together
Developer is required to work with implementation projects.
There are multiple project formats of the types mentioned above, supported by Together:
Supported project formats
See Also
Modeling Project Overview ( see page 89)
1116
3.5 Together Reference RAD Studio (Common) UML 1.5 Reference
UML 1.5 Statechart Diagrams ( see page 1135) This section describes the elements of UML 1.5 Statechart diagrams.
UML 1.5 Use Case Diagrams ( see page 1137) This section describes the elements of UML 1.5 Use Case Diagrams.
Topics
Name Description
Deferred Event ( see page 1117) A deferred event is like an internal transition that handles the event and places it
in an internal queue until it is used or discarded.
A deferred event may be thought of as an internal transition that handles the
event and places it in an internal queue until it is used or discarded. You can add
a deferred event to a state or activity element.
State ( see page 1117) A state models a situation during which some (usually implicit) invariant condition
holds. The invariant may represent a static situation such as an object waiting for
some external event to occur. However, it can also model dynamic conditions
such as the process of performing some activity (for example, the model element
under consideration enters the state when the activity commences and leaves it
as soon as the activity is completed).
Transition ( see page 1118) A single transition comes out of each state or activity, connecting it to the next
state or activity.
A transition takes operation from one state to another and represents the
response to a particular event. You can connect states with transitions and
create internal transitions within states.
UML 1.5 Activity Diagram Definition ( see page 1119) This topic describes the UML 1.5 Activity Diagram.
UML 1.5 Activity Diagram Elements ( see page 1120) The table below lists the elements of UML 1.5 Activity diagrams that are available
using the Tool PaletteToolbox.
UML 1.5 activity diagram elements
A deferred event may be thought of as an internal transition that handles the event and places it in an internal queue until it is
used or discarded. You can add a deferred event to a state or activity element.
See Also
UML 1.5 Statechart diagram ( see page 1135)
3.5.6.1.2 State
A state models a situation during which some (usually implicit) invariant condition holds. The invariant may represent a static
situation such as an object waiting for some external event to occur. However, it can also model dynamic conditions such as the 3
process of performing some activity (for example, the model element under consideration enters the state when the activity
commences and leaves it as soon as the activity is completed).
Actions
Entry and exit actions are executed when entering or leaving a state, respectively.
You can create these actions in statechart diagrams as special nodes, or as stereotyped internal transitions.
1117
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
See Also
UML 1.5 Statechart Diagram Reference ( see page 1135)
3.5.6.1.3 Transition
A single transition comes out of each state or activity, connecting it to the next state or activity.
A transition takes operation from one state to another and represents the response to a particular event. You can connect states
with transitions and create internal transitions within states.
Internal transition
An internal transition is a way to handle events without leaving a state (or activity) and dispatching its exit or entry actions. You
can add an internal transition to a state or activity element.
An internal transition is shorthand for handling events without leaving a state and dispatching its exit or entry actions.
Self-transition
A self-transition flow leaves the state (or activity) dispatching any exit action(s), then reenters the state dispatching any entry
action(s). You can draw self-transitions for both activity and state elements on an Activity Diagram.
A transition may fork into two or more parallel activities. A solid bar indicates a fork and the subsequent join of the threads
coming out of the fork.
A transition may have multiple sources (a join from several concurrent states) or it may have multiple targets (a fork to several
concurrent states).
You can show multiple transitions with either a vertical or horizontal orientation in your State and Activity Diagrams. Both the
State and Activity Diagram toolbars provide separate horizontal and vertical fork/join buttons for each orientation. The two
orientations are semantically identical.
Guard expressions
3
All transitions, including internal ones, are provided with the guard conditions (logical expressions) that define whether this
transition should be performed. Also you can associate a transition with an effect, which is an optional activity performed when
the transition fires. The guard condition is enclosed in the brackets (for example, "[false]") and displayed near the transition
link on a diagram. Effect activity is displayed next to the guard condition. You can define the guard condition and effect using the
Object InspectorProperties Window.
Guard expressions (inside [ ]) label the transitions coming out of a branch. The hollow diamond indicates a branch and its
subsequent merge that indicates the end of the branch.
1118
3.5 Together Reference RAD Studio (Common) UML 1.5 Reference
See Also
UML 1.5 Statechart Diagram ( see page 1135)
Definition
An Activity diagram is similar to a flowchart. Activity diagrams and Statechart diagrams are related. While a Statechart diagram
focuses attention on an object undergoing a process (or on a process as an object), an Activity diagram focuses on the flow of
activities involved in a single process. The Activity diagram shows how these single-process activities depend on one another.
Activity diagrams can be divided into object swimlanes that determine which object is responsible for an activity.
Sample Diagram
The Activity Diagram below uses the following process: "Withdraw money from a bank account through an ATM." The three
involved classes of the activity are Customer, ATM Machine, and Bank. The process begins at the black start circle at the top
and ends at the concentric white/black stop circles at the bottom. The activities are shown as rounded rectangles.
The three involved classes (people, and so on) of the activity are Customer, ATM, and Bank. The process begins at the black
start circle at the top and ends at the concentric white/black stop circles at the bottom. The activities are shown as rounded
rectangles.
1119
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
Name Type
Activity node
Decision node
Signal Receipt node
Signal Sending node
3
State node
Start State node
End State node
History node
Object node
Transition link
1120
3.5 Together Reference RAD Studio (Common) UML 1.5 Reference
Topics
Name Description
Association Class and N-ary Association ( see page 1122) Association classes appear in diagrams as three related elements:
1121
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
Class Diagram Types ( see page 1124) There are two types of class diagrams used in Together:
1122
3.5 Together Reference RAD Studio (Common) UML 1.5 Reference
The Object InspectorProperties Window of an association class, association link, and connector contain an additional
Association tab. This tab contains the only label property, its value being synchronized with the name of the association class.
For the association classes and association end links, the Custom node of the Object InspectorProperties Window displays
additional properties that corresponds to the role of this part of n-ary association (associationClass and
associationEnd respectively).
You can delete each of the association end links or participant classes without destroying the entire n-ary association. However,
deleting the association class results in deleting all the components of the n-ary association.
See Also
Creating an Association Class ( see page 239)
• Association: A relationship between instances of the two classes. There is an association between two classes if an instance
of one class must know about the other to perform its work. In a diagram, an association is a link connecting two classes.
Associations can be directed or undirected. A directed link points to the supplier class (the target). An association has two
ends. An end may have a role name to clarify the nature of the association. A navigation arrow on an association shows which
direction the association can be traversed or queried. A class can be queried about its Item, but not the other way around. The
arrow also lets you know who "owns" the implementation of the association. Associations with no navigation arrows are
bi-directional.
• Generalization/Implementation: An inheritance link indicating that a class implements an interface. An implementation has a
triangle pointing to the interface.
• Dependency
There are several subtypes of an association relationship:
• Simple Association
• Aggregation: An association in which one class belongs to a collection. An aggregation has a diamond end pointing to the
part containing the whole.
• Composition
Every class diagram has classes and associations. Navigability, roles, and multiplicities are optional items placed in a diagram to
provide clarity.
The multiplicity of an association end is the number of possible instances of the class associated with a single instance of the
other end. Multiplicities are single numbers or ranges of numbers. This table lists the most common multiplicities:
Multiplicities
Multiplicity Meaning
0..1 Zero or one instance. The notation n . . m indicates n to m instances
0..* or * No limit on the number of instances (including none) 3
1 Exactly one instance
1..* At least one instance
See Also
UML 1.5 Class diagrams ( see page 1121)
1123
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
• Package (namespace) diagrams. These diagrams are referred to as package diagrams in design projects, and namespace
diagrams in implementation projects. They are stored as XML files in the ModelSupport_%PROJECTNAME%ModelSupport
folder of the project groupsolution with the file extension .txvpck.
• Logical class diagrams. These diagrams are stored as XML files in the ModelSupport_%PROJECTNAME%ModelSupport
folder of the project groupsolution with the file extension .txvcls.
Together automatically creates a default namespace diagram for the project and for each subdirectory under the project
directory. The default project diagram is named default; the default namespace (package) diagrams are named after the
respective namespaces (packages).
You create logical class diagrams manually by using the Add Class Diagram or Add Other Diagram command on the
project context menu.
See Also
UML 1.5 Class Diagram ( see page 1121)
Inner classifiers
1124
3.5 Together Reference RAD Studio (Common) UML 1.5 Reference
See Also
UML 1.5 Class Diagram Reference ( see page 1121)
• Changing the name, adding a member, creating a new link, or applying a pattern makes the corresponding change in the
actual source code.
• Choose Delete from View on the context menu of the element to remove the element from a current diagram and keep the
element in the namespace (package).
• Choose Delete on the context menu to completely remove the element from the model.
• When you press Delete on the keyboard, the Delete from view command is applied, if it is available in this particular
situation. If it is not, the element is deleted completely.
• Direct changes in source code editor, such as renaming a class, cannot be tracked by Together. Use refactoring operations
for this purpose.
See Also
LiveSource Overview ( see page 93)
3.5.6.2.6 Members
Note that the set of available members is different for the design and implementation projects.
The table below lists the diagram elements along with the members that can be added using the context menu of the element.
The type of applicable project is specified in square brackets.
Members available
1125
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
For implementation projects: If you set the abstract property for a method, property, or indexer (in abstract classes) as True in
the Properties Window, the method body is removed from the source code. This is the desired behavior. Resetting the abstract
property to False in the Object InspectorProperties Window, adds a new empty method body.
See Also
3 Adding a Member to a Container ( see page 241)
1126
3.5 Together Reference RAD Studio (Common) UML 1.5 Reference
implementation projects. For implementation projects, all diagram elements are immediately synchronized with the source code.
Definition
A class diagram provides an overview of a system by showing its classes and the relationships among them. Class diagrams are
static: they display what interacts but not what happens during the interaction.
UML class notation is a rectangle divided into three parts: class name, fields, and methods. Names of abstract classes and
interfaces are in italics. Relationships between classes are the connecting links.
In Together, the rectangle is further divided with separate partitions for properties and inner classes.
Sample Diagram
The following class diagram models a customer order from a retail catalog. The central class is the Order. Associated with it are
the Customer making the purchase and the Payment. There are three types of payments: Cash, Check, or Credit. The order
contains OrderDetails (line items), each with its associated Item.
Name Type
Namespace (Package) node
3
Class node
Interface node
Association Class node
Structure node
Enumeration node
Delegate node
1127
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
Object node
Generalization/Implementation link
Association link
Dependency link
Node by Pattern opens Pattern Wizard ( see page 1162)
Link by Pattern opens Pattern Wizard ( see page 1162)
Constraint OCL node
Constraint link OCL link
Note annotation
Note Link annotation link
Topics
Name Description
UML 1.5 Component Diagram Definition ( see page 1128) Both component and deployment diagrams depict the physical architecture of a
computer-based system. Component diagrams show the dependencies and
interactions between software components.
UML 1.5 Component Diagram Elements ( see page 1129) The table below lists the elements of UML 1.5 compoment diagrams that are
available using the Tool PaletteToolbox.
UML 1.5 component diagram elements
Definition
A component is a container of logical elements and represents things that participate in the execution of a system. Components
also use the services of other components through one of its interfaces. Components are typically used to visualize logical
packages of source code (work product components), binary code (deployment components), or executable files (execution
components).
Sample Diagram
Following is a component diagram that shows the dependencies and interactions between software components for a cash
register program.
1128
3.5 Together Reference RAD Studio (Common) UML 1.5 Reference
Name Type
Subsystem node
Component node
Interface node
Supports link
Dependency link
Node by Pattern opens Pattern Wizard ( see page 1162)
Link by Pattern opens Pattern Wizard ( see page 1162)
Note annotation
Note Link annotation link
1129
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
Topics
Name Description
UML 1.5 Deployment Diagram Definition ( see page 1130) Both component and Deployment Diagrams depict the physical architecture of a
computer-based system.
Deployment Diagrams are made up of a graph of nodes connected by
communication associations to show the physical configuration of the software
and hardware.
Components are physical units of packaging in software, including:
• External libraries
• Operating systems
• Virtual machines
UML 1.5 Deployment Diagram Elements ( see page 1131) The table below lists the elements of UML 1.5 deployment diagrams that are
available using the Tool PaletteToolbox.
UML 1.5 deployment diagram elements
Deployment Diagrams are made up of a graph of nodes connected by communication associations to show the physical
configuration of the software and hardware.
• External libraries
• Operating systems
• Virtual machines
Definition
The physical hardware is made up of nodes. Each component belongs on a node. Components are shown as rectangles with
two tabs at the upper left.
Sample Diagram
Following is a Deployment Diagram that shows the relationships of software and hardware components for a real estate
transaction.
1130
3.5 Together Reference RAD Studio (Common) UML 1.5 Reference
Name Type
Node node
Component node
Interface node
Supports link
Aggregates link
Object node
Association link
Dependency link
Node by Pattern opens Pattern Wizard ( see page 1162)
Link by Pattern opens Pattern Wizard ( see page 1162)
Note annotation
Note Link annotation link
Topics
Name Description
Activation Bar ( see page 1132) Together automatically renders the activation of messages that show the period
of time that the message is active. When you draw a message link to the
destination object, the activation bar is created automatically.
You can extend or reduce the period of time of a message by vertically dragging
the top or bottom line of the activation bar as required. A longer activation bar
means a longer time period when the message is active.
1131
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
Conditional Block ( see page 1132) Conditional block statement is a flexible tool to enhance a sequence diagram.
The following statements are supported:
• if
• else
• for
• foreach
• while
• do while
• try
• catch
• finally
• switch
• case
• default
UML 1.5 Message ( see page 1133) By default, message links in a sequence diagram are numbered sequentially
from top to bottom. You can reorder messages.
A “self message” is a message from an object back to itself.
Nested Message ( see page 1133) You can nest messages by originating message links from an activation bar. The
nested message inherits the numbering of the parent message.
For example, if the parent message has the number 1, its first nested message is
1.1. It is also possible to create message links back to the parent activation bars.
UML 1.5 Collaboration Diagram Definition ( see page 1133) Class diagrams are static model views. In contrast, interaction diagrams are
dynamic, describing how objects collaborate.
UML 1.5 Interaction Diagram Elements ( see page 1134) The table below lists the elements of UML 1.5 Interaction (Sequence and
Collaboration) diagrams that are available using the Tool PaletteToolbox.
UML 1.5 interaction diagram elements
UML 1.5 Sequence Diagram Definition ( see page 1134) Class diagrams are static model views. In contrast, interaction diagrams are
dynamic, describing how objects collaborate.
You can extend or reduce the period of time of a message by vertically dragging the top or bottom line of the activation bar as
required. A longer activation bar means a longer time period when the message is active.
• if
3 • else
• for
• foreach
• while
• do while
• try
• catch
1132
3.5 Together Reference RAD Studio (Common) UML 1.5 Reference
• finally
• switch
• case
• default
See Also
Messages in UML 2.0 ( see page 1153)
For example, if the parent message has the number 1, its first nested message is 1.1. It is also possible to create message links
back to the parent activation bars.
See Also
UML 1.5 message ( see page 1133)
Definition
Like sequence diagrams, collaboration diagrams are also interaction diagrams. Collaboration diagrams convey the same
information as sequence diagrams, but focus on object roles instead of the times that messages are sent.
In a sequence diagram, object roles are the vertices and messages are the connecting links. In a collaboration diagram, as
follows, the object-role rectangles are labeled with either class or object names (or both). Colons precede the class names (:).
Sample Diagram
Each message in a collaboration diagram has a sequence number. The top-level message is numbered 1. Messages at the
same level (sent during the same call) have the same decimal prefix but suffixes of 1, 2, etc. according to when they occur.
1133
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
Name Type
Object node
Actor node
Message link
Self Message link
Message with delivery time link, Sequence only
Conditional Block node, Sequence only
Return link, Sequence only
Association link, Collaboration only
Aggregates link, Collaboration only
Node by Pattern opens Pattern Wizard ( see page 1162)
Link by Pattern opens Pattern Wizard ( see page 1162)
Note annotation
Note Link annotation link
You can add shortcuts to the interaction diagrams, by using the Add Shortcut command. However, referring to the elements
of the other interaction diagrams is not allowed.
3
3.5.6.5.7 UML 1.5 Sequence Diagram Definition
Class diagrams are static model views. In contrast, interaction diagrams are dynamic, describing how objects collaborate.
Definition
A sequence diagram is an interaction diagram that details how operations are carried out: what messages are sent and when.
Sequence diagrams are organized according to time. The time progresses as you go down the page. The objects involved in the
1134
3.5 Together Reference RAD Studio (Common) UML 1.5 Reference
operation are listed from left to right according to when they take part in the message sequence.
Sample Diagram
Following is a Sequence Diagram for making a hotel reservation. The object initiating the sequence of messages is a
Reservation window (the UserInterface).
The UserInterface sends a makeReservation() message to a HotelChain. The HotelChain then sends a
makeReservation() message to a Hotel. If the Hotel has available rooms, then it makes a Reservation and a
Confirmation.
Each vertical dotted line is a lifeline, representing the time that an object exists. Each arrow is a message call. An arrow goes
from the sender to the top of the activation bar of the message on the receiver's lifeline. The activation bar represents the
duration of execution of the message.
In this diagram, the Hotel issues a self call to determine if a room is available. If so, then the Hotel creates a Reservation
and a Confirmation. The asterisk on the self call means iteration (to make sure there is available room for each day of the
stay in the hotel). The expression in square brackets, [ ], is a condition.
The diagram has a clarifying note, which is text inside a dog-eared rectangle. Notes can be included in any kind of UML diagram.
Topics
Name Description
UML 1.5 Statechart Diagram Definition ( see page 1135) This topic describes the UML 1.5 Statechart Diagram.
UML 1.5 Statechart Diagram Elements ( see page 1136) The table below lists the elements of UML 1.5 Statechart diagrams that are
available using the Tool PaletteToolbox.
UML 1.5 Statechart diagram elements
3
3.5.6.6.1 UML 1.5 Statechart Diagram Definition
This topic describes the UML 1.5 Statechart Diagram.
Definition
Objects have behaviors and states. The state of an object depends on its current activity or condition. A statechart diagram
shows the possible states of the object and the transitions that cause a change in state.
1135
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
Sample Diagram
The following diagram models the login part of an online banking system. Logging in consists of entering a valid social security
number and personal id number, then submitting the information for validation. Logging in can be factored into four
non-overlapping states: Getting SSN, Getting PIN, Validating, and Rejecting. Each state provides a complete set of
transitions that determines the subsequent state.
States are depicted as rounded rectangles. Transitions are arrows from one state to another. Events or conditions that trigger
transitions are written next to the arrows. This diagram has two self-transitions: Getting SSN and Getting PIN. The initial
state (shown as a black circle) is a dummy to start the action. Final states are also dummy states that terminate the action.
The action that occurs as a result of an event or condition is expressed in the form /action. While in its Validating state, the
object does not wait for an outside event to trigger a transition. Instead, it performs an activity. The result of that activity
determines its subsequent state.
Name Type
State node
Start State node
End State node
History node
3
Object node
Transition link
Horizontal Fork/Join node
Vertical Fork/Join node
Node by Pattern opens Pattern Wizard ( see page 1162)
Link by Pattern opens Pattern Wizard ( see page 1162)
1136
3.5 Together Reference RAD Studio (Common) UML 1.5 Reference
Note annotation
Note Link annotation link
Topics
Name Description
Extension Point ( see page 1137) An extension point refers to a location within a use case where you can insert
action sequences from other use cases.
An extension point consists of a unique name within a use case and a description
of the location within the behavior of the use case.
In a use case diagram, extension points are listed in the use case with the
heading "Extension Points" (appears as bold text in the Diagram View).
UML 1.5 Use Case Diagram Definition ( see page 1137) Use case diagrams are helpful in three areas:
An extension point consists of a unique name within a use case and a description of the location within the behavior of the use
case.
In a use case diagram, extension points are listed in the use case with the heading "Extension Points" (appears as bold text in
the Diagram View).
See Also
UML 1.5 Use case diagram ( see page 1137)
3
3.5.6.7.2 UML 1.5 Use Case Diagram Definition
Use case diagrams are helpful in three areas:
• Determining features (requirements): New use cases often generate new requirements as the system is analyzed and the
design takes shape.
• Communicating with clients: Notational simplicity makes use case diagrams a good way for developers to communicate with
clients.
1137
UML 1.5 Reference RAD Studio (Common) 3.5 Together Reference
• Generating test cases: The collection of scenarios for a use case may suggest a suite of test cases for those scenarios.
Definition
Use Case Diagrams describe what a system does from the viewpoint of an external observer. The emphasis is on what a system
does rather than how.
Use Case Diagrams are closely connected to scenarios. A scenario is an example of what happens when someone interacts
with the system.
Sample Diagram
Following is a scenario for a medical clinic:
A patient calls the clinic to make an appointment for a yearly checkup. The receptionist finds the nearest empty time slot in the
appointment book and schedules the appointment for that time slot.
A use case is a summary of scenarios for a single task or goal. An actor is who or what initiates the events involved in that task.
Actors are simply roles that people or objects play. The following diagram is the Make Appointment use case for the medical
clinic. The actor is a Patient. The connection between actor and use case is a communication association (or communication
for short).
Actors are stick figures. Use cases are ovals. Communications are lines that link actors to use cases.
A use case diagram is a collection of actors, use cases, and their communications. Following is an example of the use case
Make Appointment as part of a diagram with four actors and four use cases. Notice that a single use case can have multiple
actors.
1138
3.5 Together Reference RAD Studio (Common) Together Glossary
Name Type
Actor node
Use Case node
Communicates link
Extend link
Include link
Generalization link
System Boundary node
Node by Pattern opens Pattern Wizard ( see page 1162)
Link by Pattern opens Pattern Wizard ( see page 1162)
Note annotation
Note Link annotation link
Term Description
Cardinality The number of elements in a set.
See also multiplicity.
Classifier In general, a classifier is a classification of instances — it describes a set of instances that have
features in common.
In Together, classifiers are the basic nodes of Class diagrams: class, interface, structure, delegate,
enum, module. Some of them can include other classifiers, or inner classifiers (see Inner Classifiers
( see page 1124)).
Compartment Some of Together model elements (basically, classes) are represented by rectangles with several
compartments inside.
You can change appearance of the compartments (see Diagram Appearance options ( see page
1089)).
Design project One of the two basic project types supported by Together: design and implementation. A design
project is language-neutral. It does not contain source code.
Diagram A graphical presentation of a collection of model elements, most often rendered as a connected
graph of arcs (relationships) and vertices (other model elements).
The set of available diagram for a project depend on the project type.
Implementation project One of the two basic project types supported by Together: design and implementation. An 3
implementation project is language-specific. It includes diagrams and source code.
Invocation specification Invocation specification is an area within an execution specification on a UML 2.0 Sequence
Diagram. This element is not defined in the UML 2.0 specification, but introduced in Together. It is a
useful tool for modeling synchronous invocations with the reply messages. A message in UML 2.0
Sequence Diagrams has its origin in an invocation specification.
Model element Model element is any component of your model that you can put on a diagram.
Model elements include nodes and links between them.
1139
UML 2.0 Reference RAD Studio (Common) 3.5 Together Reference
Multiplicity A specification of the range of allowable cardinalities that a set may assume. Multiplicity
specifications may be given for association ends, parts within composites, repetitions, and other
purposes. A multiplicity is a subset of the non-negative integers.
See also cardinality.
N-ary association An association among three or more classes. Each instance of the association is an n-tuple of values
from the respective classes.
Shortcut A shortcut is a representation of an existing node element placed on the same or a different
diagram.
View filter A view filter is mechanism to show or hide a specific kind of model elements.
When dealing with large projects, the amount of information shown on a diagram can become
overwhelming. In Together, you can selectively show or hide information.
See Using view filters ( see page 233).
See Also
Help on Help ( see page 51)
Topics
Name Description
UML 2.0 Activity Diagrams ( see page 1140) This section describes the elements of UML 2.0 Activity Diagrams.
UML 2.0 Class Diagrams ( see page 1143) This section describes the elements of UML 2.0 Class diagrams.
UML 2.0 Component Diagrams ( see page 1145) This section describes the elements of UML 2.0 Component diagrams.
UML 2.0 Composite Structure Diagrams ( see page 1146) This section describes the elements of UML 2.0 Composite Structure Diagrams.
UML 2.0 Deployment Diagrams ( see page 1148) This section describes the elements of UML 2.0 Deployment diagrams.
UML 2.0 Interaction Diagrams ( see page 1149) This section describes the elements of UML 2.0 Communication and Sequence
diagrams.
UML 2.0 State Machine Diagrams ( see page 1155) This section describes the elements of UML 2.0 State Machine Diagrams.
UML 2.0 Use Case Diagrams ( see page 1157) This section describes the elements of UML 2.0 Use Case Diagrams.
Topics
Name Description
3 Pin ( see page 1141) Actions can consume some input values or produce some output values. Input,
Output and Value pins hold such values.
UML 2.0 Activity Diagram Definition ( see page 1141)
UML 2.0 Activity Diagram Elements ( see page 1142) The table below lists the elements of UML 2.0 Activity diagrams that are available
using the Tool PaletteToolbox.
UML 2.0 Activity diagram elements
1140
3.5 Together Reference RAD Studio (Common) UML 2.0 Reference
3.5.8.1.1 Pin
Actions can consume some input values or produce some output values. Input, Output and Value pins hold such values.
See Also
Creating Input Pins ( see page 217)
An Activity diagram enables you to group and ungroup actions. If an action can be broken into a sequence of other actions, you
can create an activity to represent them.
In UML 2.0, activities consist of actions. Actions are not states (compared to UML 1.x) and can have subactions. An action
represents a single step within an activity, that is, one that is not further decomposed within the activity. An activity represents a
behavior which is composed of individual elements that are actions. An action is an executable activity node that is the
fundamental unit of executable functionality in an activity, as opposed to control and data flow among actions. The execution of
an action represents some transformation or processing in the modeled system, be it a computer system or otherwise.
The semantics of activities is based on token flow. By flow, we mean that the execution of one node affects and is affected by
the execution of other nodes, and such dependencies are represented by edges in the activity diagram. Data and control flows
are different in UML 2.0.
A control flow may have multiple sources (it joins several concurrent actions) or it may have multiple targets (it forks into several
concurrent actions).
Each flow within an activity can have its own termination, which is denoted by a flow final node. The flow final node means that a
certain flow within an activity is complete. Note that the flow final may not have any outgoing links.
Using decisions and merges, you can manage multiple outgoing and incoming control flows.
• In the Properties, View, Description, and Custom tabs, configure standard properties of the element.
• In the Local Precondition and Local Postcondition tabs, select the language of the constraint expression from the Language
list box. The possible options are OCL and plain text. In the edit field below the list box, enter the constraint expression for this
action.
1141
UML 2.0 Reference RAD Studio (Common) 3.5 Together Reference
Sample Diagram
3 Name Type
Activity node
Activity parameter node component
Action node
Initial node
Activity final node
1142
3.5 Together Reference RAD Studio (Common) UML 2.0 Reference
Decision node
Merge node
Flow Final node
Control Flow link
Input pin pin
Output pin pin
Value pin pin
Object node node
Central Buffer node
Data Store node
Object Flow link
Accept Event Action node
Accept Time Event Action node
Send Signal Action node
Node by Pattern opens Pattern Wizard ( see page 1162)
Link by Pattern opens Pattern Wizard ( see page 1162)
Note annotation
Note Link annotation link
Topics
Name Description
UML 2.0 Class Diagram Definition ( see page 1143) UML 2.0 Class diagrams feature the same capabilities as the UML 1.5 diagrams.
The UML 2.0 class diagrams offer new diagram elements such as ports, provided
and required interfaces, and slots.
According to the UML 2.0 specification, an instance specification can instantiate
one or more classifiers. You can use classes, interfaces, or components as a
classifier.
UML 2.0 Class Diagram Elements ( see page 1144) The table below lists the elements of UML 2.0 class diagrams that are available
using the Tool PaletteToolbox.
UML 2.0 class diagram elements
According to the UML 2.0 specification, an instance specification can instantiate one or more classifiers. You can use classes,
interfaces, or components as a classifier.
Interfaces
A class implements an interface via the same generalization/implementation link, as in UML 1.5 class diagram. In addition to the
implementation interfaces, there are provided and required interfaces. Interfaces can be represented in class diagrams as
1143
UML 2.0 Reference RAD Studio (Common) 3.5 Together Reference
rectangles or as circles. For the sake of clarity of your diagrams, you can show or conceal interfaces.
Tip: Applying a provided interface link between a class and an interface creates a regular generalization/implementation link. To
create provided interface, apply the provided interface link to a port on the client class.
UML 2.0 class diagram supports the ball-and socket notation for the provided and required interfaces. Choose Show as circle
command on the context menu of the interface to obtain a lollipop between the client class and the supplier interface.
Sample Diagram
The figure below shows a class diagram with some of the new elements.
Name Type
Package node
Class node
Interface node
Association Class node
Port node
Instance specification node
Generalization/Implementation link
Provided interface link
Required interface link
Association link
Association end link
Dependency link
1144
3.5 Together Reference RAD Studio (Common) UML 2.0 Reference
Topics
Name Description
UML 2.0 Component Diagram Definition ( see page 1145) This topic describes the UML 2.0 Component Diagram.
UML 2.0 Component Diagram Elements ( see page 1145) The table below lists the elements of UML 2.0 compoment diagrams that are
available using the Tool PaletteToolbox.
UML 2.0 component diagram elements
Definition
According to the UML 2.0 specification, a component diagram can contain instance specifications. An instance specification can
be defined by one or more classifiers. You can use classes, interfaces, or components as a classifiers. You can instantiate a
classifier using the Object InspectorProperties Window, or the in-place editor.
Sample Diagram
The following component diagram specifies a set of constructs that can be used to define software systems of arbitrary size and
complexity.
3
3.5.8.3.2 UML 2.0 Component Diagram Elements
The table below lists the elements of UML 2.0 compoment diagrams that are available using the Tool PaletteToolbox.
Name Type
Component node
1145
UML 2.0 Reference RAD Studio (Common) 3.5 Together Reference
Class node
Port node
Artifact node
Interface node
Instance specification node
Delegation connector link
Provided interface link
Required interface link
Association link
Aggregation link
Dependency link
Realization link
Node by Pattern opens Pattern Wizard ( see page 1162)
Link by Pattern opens Pattern Wizard ( see page 1162)
Note annotation
Note Link annotation link
Topics
Name Description
Delegation Connector ( see page 1146) An interface can delegate its obligations to another interface through the
delegation connector.
UML 2.0 Composite Structure Diagram Definition ( see page 1146) Diagram courtesy of the Unified Modeling Language: Superstructure version 2.0.
August 2003. p. 178.
UML 2.0 Composite Structure Diagram Elements ( see page 1147) The table below lists the elements of UML 2.0 composite structure diagrams that
are available using the Tool PaletteToolbox.
UML 2.0 composite structure diagram elements
See Also
UML 2.0 Composite Structure Diagram Reference ( see page 1146)
3
3.5.8.4.2 UML 2.0 Composite Structure Diagram Definition
Diagram courtesy of the Unified Modeling Language: Superstructure version 2.0. August 2003. p. 178.
Definition
Composite structure diagrams depict the internal structure of a classifier, including its interaction points to the other parts of the
system. It shows the configuration of parts that jointly perform the behavior of the containing classifier.
1146
3.5 Together Reference RAD Studio (Common) UML 2.0 Reference
A collaboration describes a structure of collaborating parts (roles). A collaboration is attached to an operation or a classifier
through a Collaboration Use.
Classes and collaborations in the Composite Structure diagram can have internal structure and ports. Internal structure is
represented by a set of interconnected parts (roles) within the containing class or collaboration. Participants of a collaboration or
a class are linked by the connectors.
A port can appear either on a contained part, or on the boundary of the class.
The contained parts can be included by reference. Referenced parts are represented by the dotted rectangles.
Composite Structure diagram supports the ball-and-socket notation for the provided and required interfaces. Interfaces can be
shown or hidden in the diagram as needed.
Sample Diagram
Name Type
Class node
Interface node
Collaboration node
Collaboration Occurrence node
Part node
Referenced part node
3
Port node
Provided interface link
Required interface link
Connector link
Collaboration role link
Role binding link
1147
UML 2.0 Reference RAD Studio (Common) 3.5 Together Reference
Topics
Name Description
UML 2.0 Deployment Diagram Definition ( see page 1148) This topic describes the UML 2.0 Deployment Diagram.
UML 2.0 Deployment Diagram Elements ( see page 1148) The table below lists the elements of UML 2.0 deployment diagrams that are
available using the Tool PaletteToolbox.
UML 2.0 deployment diagram elements
Definition
The deployment diagram specifies a set of constructs that can be used to define the execution architecture of systems that
represent the assignment of software artifacts to nodes. Nodes are connected through communication paths to create network
systems of arbitrary complexity. Nodes are typically defined in a nested manner, and represent either hardware devices or
software execution environments. Artifacts represent concrete elements in the physical world that are the result of a
development process.
Diagram courtesy of the Unified Modeling Language: Superstructure version 2.0. August 2003. pp. 207, 212.
Sample Diagram
1148
3.5 Together Reference RAD Studio (Common) UML 2.0 Reference
Name Type
Node node
Artifact node
Device node
Execution specification node
Deployment specification node
Instance specification node
Deployment link
Generalization link
Association link
Dependency link
Manifestation link
Communication path link
Node by Pattern opens Pattern Wizard ( see page 1162)
Link by Pattern opens Pattern Wizard ( see page 1162)
Note annotation
Note Link annotation link
An artifact represents a physical entity and is depicted in diagram as a rectangle with the <<artifact>> stereotype. An artifact
may have properties which define its features, and operations which can be performed on its instances. Physically the artifacts
can be model files, source files, scripts, binary executable files, a table in a database system, a development deliverable, a
word-processing document, or a mail message. A deployed artifact is one that has been deployed to a node used as a
deployment target. Deployed artifacts are connected with the target node by deployment links.
Topics
Name Description
Interaction ( see page 1150) By using Together, you can create interactions for the detailed description and
analysis of inter-process communications.
Interactions can be visually represented in your Together projects by means of
the two most common interaction diagrams: Sequence and Communication. On
the other hand, interactions can exist in projects without visual representation.
3
Execution Specification and Invocation Specification ( see page 1151) In sequence diagrams, Together automatically renders the execution
specification of a message that shows the period of time when the message is
active. When you draw a message link to the destination lifeline, the execution
specification bar is created automatically. You can extend or reduce the period of
time of a message by vertically dragging the top or bottom line of the execution
specification as required.
It is also possible to create an execution specification on a lifeline without
creating an incoming message link. In this case a found message is created, that
is a message that comes from an... more ( see page 1151)
Operator and Operand for a Combined Fragment ( see page 1151)
1149
UML 2.0 Reference RAD Studio (Common) 3.5 Together Reference
UML 2.0 Communication Diagram Definition ( see page 1152) Interactions can be visually represented in your Together projects by means of
the two most common interaction diagrams: Sequence and Communication.
Communication Diagrams focus on the interaction between lifelines where the
architecture of the internal structure and how this corresponds with the message
passing is central. The sequencing of messages is given through a sequence
numbering scheme.
UML 2.0 Communication Diagram Elements ( see page 1152) The table below lists the elements of UML 2.0 communication diagrams that are
available using the Tool PaletteToolbox.
UML 2.0 communication diagram elements
UML 2.0 Message ( see page 1153) Call messages are always visible in diagrams; reply messages normally are not
displayed. However, you can visualize the reply message.
UML 2.0 Sequence Diagram Definition ( see page 1154) Interactions can be visually represented in your Together projects by means of
the two most common interaction diagrams: Sequence and Communication.
The most common kind of Interaction Diagram is the Sequence Diagram, which
focuses on the message interchange between a number of lifelines. A Sequence
Diagram describes an interaction by focusing on the sequence of messages that
are exchanged.
UML 2.0 Sequence Diagram Elements ( see page 1154) The table below lists the elements of UML 2.0 sequence diagrams that are
available using the Tool PaletteToolbox.
UML 2.0 sequence diagram elements
3.5.8.6.1 Interaction
By using Together, you can create interactions for the detailed description and analysis of inter-process communications.
Interactions can be visually represented in your Together projects by means of the two most common interaction diagrams:
Sequence and Communication. On the other hand, interactions can exist in projects without visual representation.
Interaction use
Within an interaction, you can refer to the other interactions described in your project. So called “Interaction use” elements serve
this purpose. Note that referenced interaction can be explicitly defined from the model, or just specified as a text string.
Each interaction use is attached to its lifeline with a black dot. This dot is an individual diagram element. If an interaction use is
expanded over several lifelines, you can delete the attachment dots from all lifelines but one. An interaction use should be
connected with at least one lifeline.
Tie frame
Together makes it possible to spread combined fragments and interaction uses across several lifelines. This is done with the Tie
Frame button of the diagram Tool PaletteToolbox.
A frame can be attached to different points on the target lifeline. You choose the desired location on the target lifeline between
the other elements and frames that belong to it. The frame shifts accordingly along the source lifeline.
It is important to understand that only those lifelines marked with dots are attached to the referenced interaction or combined
fragment; lifelines that are only crossed by the frame are not attached. Attachment dots are separate diagram elements that can
be selected and deleted.
Lifeline
A lifeline defines an individual participant of the interaction. A lifeline is shown in a sequence diagram as a rectangle followed by
a vertical-dashed line.
3
Lifelines of an interaction can represent the parts defined in the class or composite structure diagrams. If the referenced element
is multivalued, then the lifeline should have a selector that specifies which particular part is represented by this lifeline.
If a lifeline represents a connectable element, has type specified, or refers to another interaction, the Select menu becomes
enabled on the context menu of this lifeline. Using this menu, you can navigate to the part, type or decomposition associated
with the lifeline. These properties are defined by using the Object InspectorProperties Window. If the represents property is set,
the type and part properties are disabled.
You can define these properties manually by typing the values in the corresponding fields of the Object InspectorProperties
1150
3.5 Together Reference RAD Studio (Common) UML 2.0 Reference
Window. If the specified values are not found in the model, they are displayed in single quotes. Such references are not related
to any actual elements and the Select menu is not available for them. If the specified values can be resolved in the model, they
are shown without quotes, and the Select menu is available for them.
State invariant
A state invariant is a constraint placed on a lifeline. This constraint is evaluated at runtime prior to execution of the next
execution specification. State invariants are represented in the interaction diagrams in two ways: as OCL expressions or as
references to the state diagrams. You can use the state invariants to provide comments to your interaction diagrams and to
connect interactions with states.
It is important to note that Together provides validation of the state invariants represented as OCL expressions. If the syntax is
wrong, or there is no valid context, the constraint is displayed red. For example, a lifeline should have type and represents
properties defined to be a valid context.
See Also
OCL support overview ( see page 95)
It is also possible to create an execution specification on a lifeline without creating an incoming message link. In this case a
found message is created, that is a message that comes from an object that is not shown in diagram. Use the Object
InspectorProperties Window to hide or show the found messages.
Messages in sequence diagrams have their origin in an invocation specification. This is an area within an execution specification.
The notion of an invocation specification is introduced in Together's implementation of UML 2.0 sequence diagrams. Though this
element is not defined in the UML 2.0 specification, it is a useful tool for modeling synchronous invocations with the reply
messages. In particular, invocation specification marks a place where the reply messages (even if they are invisible) enter the
execution context of a lifeline, and where sub-messages may reenter the lifeline.
Active and passive areas of the execution specification are rendered in different colors. The white execution specification bars
denote active areas where you can create message links. The gray bars are passive and are not a valid source or target for the
message links.
See Also
UML 2.0 Message ( see page 1153)
Use the Tool PaletteToolbox, or context menus to create these elements. The operator type shows up in the descriptor in the
upper-left corner of the design element. Note that you can define multiple operators in a combined fragment. In this case, the
descriptor contains the list of all operators, which is a shorthand for nested operators.
When an operator is created, add the allowed operands, using the combined fragment's context menu.
1151
UML 2.0 Reference RAD Studio (Common) 3.5 Together Reference
A combined fragment can be expanded over several lifelines, detached from and reattached to lifelines. In the Object
InspectorProperties Window, use the Operators field to manage operators within the combined fragment.
Each combined fragment is attached to its lifeline with a black dot. This dot is an individual diagram element, which can be
selected or deleted. Deleting a dot means detaching a combined fragment from the lifeline. Note that a combined fragment
cannot be detached from all lifelines and should have at least one attachment dot.
You can reattach a combined fragment later, using the Tie Frame tool.
Operator
When a combined fragment is created, the operator is shown in a descriptor pentagon in the upper left corner of the frame. You
can change the operator type, using the Operators field of the Object InspectorProperties Window, which is immediately
reflected in the descriptor.
The descriptor may contain several operators. UML 2.0 specification provides this notation for the nested combined fragments.
In Together you can use this notation, or create nested combined fragment nodes.
Operand
Operands are represented as rectangular areas within a combined fragment, separated by the dashed lines. When a combined
fragment is initially created, the number of operands is defined by the pattern defaults. Further, you can create additional
operands, or remove the existing ones.
Note that the uppermost area of the operator is empty and does not contain any operands. It is reserved for the descriptor.
Clicking on this area selects the entire operator; clicking on one of the dotted rectangles selects the corresponding operand. If a
combined fragment contains only one operand, the entire combined fragment and the single existing operand are still separately
selectable.
See Also
OCL support overview ( see page 95)
Communication Diagrams focus on the interaction between lifelines where the architecture of the internal structure and how this
corresponds with the message passing is central. The sequencing of messages is given through a sequence numbering scheme.
See Also
UML 2.0 Interaction Diagram Reference ( see page 1149)
Name Type
Lifeline node
Message link
1152
3.5 Together Reference RAD Studio (Common) UML 2.0 Reference
Interaction diagrams, represented in the Model View, display a number of auxiliary elements that are not visible in the Diagram
View. These elements play supplementary role for representation of the diagram structure. Actually, these elements are editable,
but it is strongly advised to leave them untouched, to preserve integrity of the interaction diagrams.
Messages in sequence diagrams: Messages in sequence diagrams have the same properties as those in communication
diagrams but allow you to perform more actions. The further discussion refers mainly to the sequence diagram messages.
Properties of the messages for both types of interaction diagrams can be edited in the Object InspectorProperties Window.
Property Description
Sequence Use this field to view and edit the sequential number of a message. When the message number changes, the
number message call changes respectively.
Name Displays the link name. This field can be edited.
Qualified A read-only field that displays the fully-qualified name of the message.
name
Stereotype Use this field to define the message stereotype. The stereotype name displays above the link.
Signature Use this field to specify the name of an operation or signal associated with the message. Note that changing the
signature of a message call results in changing the signature of the corresponding reply.
Arguments Displays actual arguments of an operation associated with a message call. This field can be edited.
Sort Use this field to select the type of synchronization from the drop-down list. The possible values are:asynchCall,
synchCall, asynchSignal. The message link changes its appearance accordingly.
There are certain limitations related to the asynchronous calls:
Sometimes it is impossible to create or paste an asynchronous call because of the frame limitations.
Execution specification for an asynchronous call must always be located on a lifeline.
3
Show reply Use this Boolean option to define whether to draw a dashed return arrow.
message
Commentary Use this textual field to enter comments for a message link.
1153
UML 2.0 Reference RAD Studio (Common) 3.5 Together Reference
Property Description
Stereotype Use this field to define the message stereotype.
Attribute Use this field to define an attribute to which the return value of the message will be assigned. This field can be
edited.
Signature Use this field to specify the name of an operation or signal associated with the message. Note that changing the
signature of a message reply results in changing the signature of the corresponding call.
Arguments Displays arguments of an operation associated with a message call. This field can be edited. Note that changing
the list of arguments of a reply message results in changing the corresponding call.
Return value Displays the return value of an operation associated with a message link. This field can be edited.
Sort Use this field to select the type of synchronization from the drop-down list. The possible values are:asynchCall,
synchCall, asynchSignal. The message link changes its appearance accordingly.
Commentary Use this text field to comment the link.
Note: Such properties of the call and reply messages as arguments, attribute, qualified name, return value, signature, and sort
pertain to the invocation specification. You can edit these properties in the invocation specification itself, in the call or in the reply
messages. As a result, the corresponding properties of the counterpart message and the invocation specification will change
accordingly. Stereotype and commentary properties are unique for the call and reply messages.
See Also
Working with UML 1.5 Messages ( see page 215)
The most common kind of Interaction Diagram is the Sequence Diagram, which focuses on the message interchange between a
number of lifelines. A Sequence Diagram describes an interaction by focusing on the sequence of messages that are exchanged.
See Also
UML 2.0 Interaction Diagram Reference ( see page 1149)
Name Type
Lifeline node
Execution specification node
Combined fragment node
State invariant node
1154
3.5 Together Reference RAD Studio (Common) UML 2.0 Reference
Message link
Interaction use node
Node by Pattern opens Pattern Wizard ( see page 1162)
Link by Pattern opens Pattern Wizard ( see page 1162)
Note annotation
Note Link annotation link
Sequence diagram can contain shortcuts to the other diagram elements. However, shortcuts to the elements that reside in the
other interaction diagrams are not supported.
Interaction diagrams, represented in the Model View, display a number of auxiliary elements that are not visible in the Diagram
View. These elements play supplementary role for representation of the diagram structure. Actually, these elements are editable,
but it is strongly advised to leave them untouched, to preserve integrity of the interaction diagrams.
Topics
Name Description
History Element (State Machine Diagrams) ( see page 1155) The Shallow History and Deep History elements are placed on regions of the
states.
There may be none or one Deep History, and none or one Shallow History
elements in each region. If there is only one history element in a region, it may be
switched from the Deep to Shallow type by changing its kind property.
Please refer to UML 2.0 Specification for more information about these elements.
UML 2.0 State Machine Diagram Definition ( see page 1155) States are the basic units of the state machines. In UML 2.0 states can have
substates.
Execution of the diagram begins with the Initial node and finishes with Final or
Terminate node or nodes. Please refer to UML 2.0 Specification for more
information about these elements.
UML 2.0 State Machine Diagram Elements ( see page 1156) The table below lists the elements of UML 2.0 State Machine diagrams that are
available using the Tool PaletteToolbox.
UML 2.0 State Machine diagram elements
There may be none or one Deep History, and none or one Shallow History elements in each region. If there is only one history
element in a region, it may be switched from the Deep to Shallow type by changing its kind property.
Please refer to UML 2.0 Specification for more information about these elements.
See Also
Creating a history ( see page 230)
3
State machine diagram ( see page 1155)
Execution of the diagram begins with the Initial node and finishes with Final or Terminate node or nodes. Please refer to UML 2.0
1155
UML 2.0 Reference RAD Studio (Common) 3.5 Together Reference
Definition
State Machine diagrams describe the logic behavior of the system, a part of the system, or the usage protocol of it.
On these diagrams you show the possible states of the objects and the transitions that cause a change in state.
State Machine diagrams in UML 2.0 are different in many aspects compared to Statechart diagrams in UML 1.5.
Sample Diagram
1156
3.5 Together Reference RAD Studio (Common) UML 2.0 Reference
Region node Use regions inside the states to group the substates. The regions may have different
visibility settings and history elements. Each state has one region immediately after
creation (though it can be deleted.)
In the regions, you can create all the elements that are available for the State
Machine diagram.
only available on the state context menu
Fork node
Join node
Choice node
Junction node
Transition link Draw a link from the exit point of source state (or the state without exit points) to the
entry point of the destination (or the state without points).
Internal transition link Internal transition elements are only available on the state context menu.
Node by Pattern opens Pattern
Wizard ( see
page 1162)
Link by Pattern opens Pattern
Wizard ( see
page 1162)
Note annotation
Note Link annotation link
Topics
Name Description
UML 2.0 Use Case Diagram Definition ( see page 1157) Diagram courtesy of the Unified Modeling Language: Superstructure version 2.0.
August 2003. p. 536.
UML 2.0 Use Case Diagram Elements ( see page 1158) The table below lists the elements of UML 2.0 Use Case diagrams that are
available using the Tool PaletteToolbox.
UML 2.0 Use Case diagram elements
Definition
Use case diagrams describe required usages of a system, or what a system is supposed to do. The key concepts that take part
in a use case diagram are actors, use cases, and subjects. A subject represents a system under consideration with which the 3
actors and other subjects interact. The required behavior of the subject is described by the use cases.
Sample Diagram
The following diagram shows an example of actors and use cases for an ATM system.
1157
Together Wizards RAD Studio (Common) 3.5 Together Reference
1158
3.5 Together Reference RAD Studio (Common) Together Wizards
Topics
Name Description
Create Pattern Wizard ( see page 1159) The Create Pattern Wizard enables you to save an existing fragment of your
model as a pattern for future use. You can open the Create Pattern Wizard by
selecting one or more nodes and links on a Class diagram and choosing the
Save as Pattern command on a context menu.
New Together Project Wizards ( see page 1159) This section describes Wizards used to create new Together modeling projects.
Pattern Wizard ( see page 1162) The Pattern Wizard enables you to explicitly apply a pattern. You can open the
Pattern Wizard by:
Item Description
File This field specifies the target XML file name.
Name This field specifies the name of the new pattern.
Create Pattern Object Check this check box to use your pattern as a First Class Citizen. This means that an oval pattern
element will display on your diagrams when applying the pattern.
See Also
Patterns overview ( see page 96)
Topics
Name Description
Convert MDL Wizard ( see page 1160) Use this wizard to create a design project around an existing IBM Rational Rose
(MDL) model. The wizard is invoked by the Design Projects Convert from
MDL template of the New Project dialog box.
IMPORTANT: For the MDL Import function to work, the Java Runtime
Environment and the Java Development Kit must be installed, and the paths in
the jdk.config file must correctly point to your JDK/JRE directory. For
example,
3
Supported C# Project Wizards ( see page 1161) Together supports all C# project types available in RAD Studio.
Such projects can be supplied with a UML 1.5 model.
Please consult the general documentation for RAD Studio for further information
about creating C# projects.
Supported Delphi Project Wizards ( see page 1161) Together supports all Delphi project types available in RAD Studio.
Such projects can be supplied with a UML 1.5 model.
Please consult the general documentation for RAD Studio for further information
about creating Delphi projects.
1159
Together Wizards RAD Studio (Common) 3.5 Together Reference
UML 1.5 Together Design Project Wizard ( see page 1161) File New Other Design Projects UML 1.5 Design Project
This project is provided by Together for creation of a UML 1.5 design project.
To start this wizard, choose File New Other on the main menu. The New
Items dialog box opens. Choose the Design Projects UML 1.5 Design
Project category. Click OK.
The New Application dialog box opens. Specify the name and location of your
model project. Click OK.
The new UML 1.5 design project is created. Use the Model View to see its
structure.
UML 2.0 Together Design Project Wizard ( see page 1161) File New Other Design Projects UML 2.0 Design Project
This project is provided by Together for creation of a UML 2.0 design project.
To start this wizard, choose File New Other on the main menu. The New
Items dialog box opens. Choose the Design Projects UML 2.0 Design
Project category. Click OK.
The New Application dialog box opens. Specify the name and location of your
model project. Click OK.
The new UML 2.0 design project is created. Use the Model View to see its
structure.
IMPORTANT: For the MDL Import function to work, the Java Runtime Environment and the Java Development Kit must be
installed, and the paths in the jdk.config file must correctly point to your JDK/JRE directory. For example,
javahome ../../../../../../../jdk1.4.2/jre
addpath ../../../../../../../jdk1.4.2/lib/tools.jar
Note that the path to the JDK/JRE should be without quotation marks.
Paths section
Button Description
Add Adds one model file to the Paths section. Press this button to open Select Model File dialog box,
navigate to the desired model file and click Open.
Add Folder Adds all model files in the selected folder. Press this button to open Browse for Folder dialog box,
navigate to the desired folder that contains the model files, and click OK.
Remove Press this button to delete the selected entry from the Paths section.
Remove all Press this button to delete all model files from the Paths section.
Options section
Option Description
Scale factor Specify the element dimensions coefficient. By default, the scale factor is 0.3.
3
Convert Rose default If this option is checked, the default Rational Rose will be replaced with the default Together colors.
colors
Preserve diagram if this option is checked, user-defined bounds are preserved in the resulting diagrams. Otherwise the
nodes bounds default values are applied.
Convert Rose actors This options enables you to choose mapping for the Rose classes with actor-like stereotypes (Actor,
Business Actor, Business Worker, Physical Worker.) If the option is checked, the Rose actors are
mapped to Together actors. If the option is not checked, the Rose actors are mapped to the classes
with the Actor stereotype.
1160
3.5 Together Reference RAD Studio (Common) Together Wizards
See Also
Importing a Project in IBM Rational Rose (MDL) Format ( see page 265)
Project Types and Formats with Support for Modeling ( see page 1116)
Please consult the general documentation for RAD Studio for further information about creating C# projects.
See Also
Creating a Project ( see page 264)
Please consult the general documentation for RAD Studio for further information about creating Delphi projects.
See Also
Creating a Project ( see page 264)
This project is provided by Together for creation of a UML 1.5 design project.
To start this wizard, choose File New Other on the main menu. The New Items dialog box opens. Choose the Design
Projects UML 1.5 Design Project category. Click OK.
The New Application dialog box opens. Specify the name and location of your model project. Click OK.
The new UML 1.5 design project is created. Use the Model View to see its structure.
See Also
Creating a project ( see page 264)
This project is provided by Together for creation of a UML 2.0 design project.
To start this wizard, choose File New Other on the main menu. The New Items dialog box opens. Choose the Design
1161
Together Wizards RAD Studio (Common) 3.5 Together Reference
The New Application dialog box opens. Specify the name and location of your model project. Click OK.
The new UML 2.0 design project is created. Use the Model View to see its structure.
See Also
Creating a project ( see page 264)
• Using the Node by Pattern or Link by Pattern button in the Tool PaletteToolbox
• Using the Create by Pattern command from the Diagram View or class context menus
The Node by Pattern element opens the Pattern Wizard. You can also open the Pattern Wizard using the Create by Pattern
command on the diagram context menu.
Item Description
Pattern tree: This field determines the content displayed in the Patterns pane. Use the drop-down arrow to select a
pattern tree. Pattern trees are defined in the Pattern Organizer.
Panes The following Selector/Editor panes occupy the top portion of the dialog:
Patterns: The Patterns pane presents a tree view of the available patterns. Use the Pattern tree field to
determine the available content shown in the Patterns pane.
Pattern properties: Edit the generated class names for pattern elements, or use the information button to open the Select
Element dialog for choosing elements.
Description The Description pane lies at the bottom of the Pattern Wizard and displays context-sensitive help
text. Help descriptions for the more complex patterns appear directly in the Pattern Wizard rather
than in Together online help. To view a description of a pattern, click on the individual pattern in the
Patterns pane.
Error If an error occurs while applying a pattern, the Pattern Wizard remains open, and the error text
displays here.
Buttons
OK Applies the specified pattern.
Cancel Closes the Pattern Wizard without applying a pattern.
3
See Also
Creating model elements by pattern ( see page 255)
1162
4 RAD Studio (Common)
$ $IF
compiler directives, Delphi 292
$ALIGN
$IFDEF
compiler directives, Delphi 283
compiler directives, Delphi 292
$APPTYPE
$IFEND
compiler directives, Delphi 283
compiler directives, Delphi 293
$ASSERTIONS
$IFNDEF
compiler directives, Delphi 284
compiler directives, Delphi 294
$AUTOBOX
$IFOPT
compiler directives, Delphi 284
compiler directives, Delphi 294
$BOOLEVAL
$IMAGEBASE
compiler directives (Delphi) 285
compiler directives, Delphi 294
$DEBUGINFO
$IMPLICITBUILD
compiler directives, Delphi 287
compiler directives, Delphi 295
$DEFINE
$IMPORTEDDATA
compiler directives, Delphi 287
compiler directives, Delphi 295
$DENYPACKAGEUNIT
$INCLUDE
compiler directives, Delphi 287
compiler directives, Delphi 295
$DESCRIPTION
$IOCHECKS
compiler directives, Delphi 288
compiler directives, Delphi 296
$DESIGNONLY
$LIB
compiler directives, Delphi 288
compiler directives, Delphi 296
$ELSE
$LINK
compiler directives, Delphi 288
compiler directives, Delphi 297
$ELSEIF
$LOCALSYMBOLS
compiler directives, Delphi 289
compiler directives, Delphi 297
$ENDIF
$LONGSTRINGS
compiler directives, Delphi 289
compiler directives, Delphi 298
$EXTENDEDSYNTAX
$MESSAGE
compiler directives, Delphi 290
compiler directives, Delphi 299
$EXTENSION
$METHODINFO
compiler directives, Delphi 289
compiler directives, Delphi 299
$EXTERNALSYM
a
RAD Studio (Common) 4
b
4 RAD Studio (Common)
c
RAD Studio (Common) 4
d
4 RAD Studio (Common)
e
RAD Studio (Common) 4
f
4 RAD Studio (Common)
g
RAD Studio (Common) 4
Creating Named Build Configurations for C++ 107 Debugger Symbol Tables 845
Creating Named Build Configurations for Delphi 108 debugging
Creating Template Libraries 138 adding a watch 116
creating templates attaching to a process 117
live templates 138 breakpoints 118
Creation Order 756 inspecting data elements 122
custom attributes 593 modifying expressions 124
Customize New Menu 777 overview 10
Customize Toolbars 1033 preparation 121, 124
Customizing Code Editor 141 remote applications 125
Customizing the Form 155 Debugging Applications 10
Customizing the Tool Palette 156 Debugging Procedures 114
Customizing Toolbars 156 Debugging VCL for .NET Source Code 121
Cut 758 Declaration of class <ClassName> is missing or incorrect 764
declarations 705
h
4 RAD Studio (Common)
i
RAD Studio (Common) 4
E1038: Unit identifier '%s' does not match file name 495 E2038: Illegal character in input file: '%s' (%s) 408
E2001: Ordinal type required 466 E2045: Bad object file format: '%s' 346
E2002: File type not allowed here 394 E2049: Label declaration not allowed in interface part 430
E2003: Undeclared identifier: '%s' 407 E2050: Statements not allowed in interface part 350
E2005: '%s' is not a type identifier 491 E2053: Syntax error in real number 348
E2006: PACKED not allowed here 471 E2054: Illegal type in Write/Writeln statement 350
E2007: Constant or type identifier expected 368 E2055: Illegal type in Read/Readln statement 348
E2008: Incompatible types 363 E2056: String literals may have at most 255 elements 488
E2009: Incompatible types: '%s' 364 E2057: Unexpected end of file in comment started on line %ld
498
E2010: Incompatible types: '%s' and '%s' 365
E2058: Class, interface and object types only allowed in type
E2011: Low bound exceeds high bound 434 section 464
E2012: Type of expression must be BOOLEAN 441 E2059: Local class, interface or object types not allowed 465
E2013: Type of expression must be INTEGER 444 E2060: Class and interface types only allowed in type section
360
E2014: Statement expected, but expression of type '%s' found
452 E2061: Local class or interface types not allowed 360
E2015: Operator not applicable to this operand type 507 E2062: Virtual constructors are not allowed 465
E2016: Array type required 440 E2064: Left side cannot be assigned to 462
E2017: Pointer type required 447 E2065: Unsatisfied forward or external declaration: '%s' 400
j
4 RAD Studio (Common)
E2066: Missing operator or semicolon 438 E2106: Inline assembler stack overflow 345
E2067: Missing parameter type 439 E2107: Operand size mismatch 343
E2068: Illegal reference to symbol '%s' in object file '%s' 412 E2108: Memory reference expected 342
E2070: Unknown directive: '%s' 495 E2109: Constant expected 341
E2071: This type cannot be initialized 354 E2110: Type expected 346
E2072: Number of elements (%d) differs from declaration (%d) E2111: Cannot add or subtract relocatable symbols 344
420
E2112: Invalid register combination 344
E2073: Label already defined: '%s' 431
E2113: Numeric overflow 343
E2074: Label declared and referenced, but not set: '%s' 431
E2114: String constant too long 345
E2075: This form of method call only allowed in methods of
E2115: Error in numeric constant 342
derived types 445
E2116: Invalid combination of opcode and operands 340
E2076: This form of method call only allowed for class methods
441 E2117: 486/487 instructions not enabled 340
E2078: Procedure FAIL only allowed in constructor 391 E2118: Division by zero 341
E2079: Procedure NEW needs constructor 452 E2119: Structure field identifier expected 341
E2080: Procedure DISPOSE needs destructor 380 E2120: LOOP/JCXZ distance out of range 430
E2081: Assignment to FOR-Loop variable '%s' 340 E2121: Procedure or function name expected 448
E2082: TYPEOF can only be applied to object types with a VMT E2122: PROCEDURE or FUNCTION expected 473
451
E2123: PROCEDURE, FUNCTION, PROPERTY, or VAR
E2083: Order of fields in record constant differs from expected 360
declaration 482
E2124: Instance member '%s' inaccessible here 392
E2085: Unit name mismatch: '%s' '%s' 440
E2125: EXCEPT or FINALLY expected 389
E2086: Type '%s' is not yet completely defined 418
E2126: Cannot BREAK, CONTINUE or EXIT out of a FINALLY
E2088: Variable name expected 504 clause 356
E2089: Invalid typecast 425 E2127: 'GOTO %s' leads into or out of TRY statement 401
E2090: User break - compilation aborted 502 E2128: %s clause expected, but %s found 361
E2091: Segment/Offset pairs not supported in CodeGear 32-bit E2129: Cannot assign to a read-only property 478
Pascal 485
E2130: Cannot read a write-only property 479
E2093: Label '%s' is not declared in current procedure 458
E2131: Class already has a default property 374
E2094: Local procedure/function '%s' assigned to procedure
variable 433 E2132: Default property must be an array property 373
E2095: Missing ENDIF directive 437 E2133: TYPEINFO standard function expects a type identifier
493
E2096: Method identifier expected 436
E2134: Type '%s' has no type info 457
E2097: BREAK or CONTINUE outside of loop 351
E2136: No definition for abstract method '%s' allowed 337
E2098: Division by zero 381
E2137: Method '%s' not found in base class 468
E2099: Overflow in conversion or arithmetic operation 339
E2138: Invalid message parameter list 427
E2100: Data type too large: exceeds 2 GB 492
E2139: Illegal message method index 412
E2101: Size of data type is zero 492
E2140: Duplicate message method index 385
E2102: Integer constant too large 422
E2142: Inaccessible value 502
E2103: 16-Bit fixup encountered in object file '%s' 396
E2143: Expression has no value 390
E2104: Bad relocation encountered in object file '%s' 348
E2144: Destination is inaccessible 376
E2105: Inline assembler syntax error 345
k
RAD Studio (Common) 4
E2145: Re-raising an exception only allowed in exception E2180: Dispid '%d' already used by '%s' 383
handler 483
E2181: Redeclaration of property not allowed in OLE
E2146: Default values must be of ordinal, pointer or small set automation section 474
type 375
E2182: '%s' clause not allowed in OLE automation section 408
E2147: Property '%s' does not exist in base class 493
E2183: Dispid clause only allowed in OLE automation section
E2148: Dynamic method or message handler not allowed here 378
476
E2184: %s section valid only in class types 412
E2149: Class does not have a default property 442
E2185: Overriding automated virtual method '%s' cannot specify
E2150: Bad argument type in variable type array constructor 349 a dispid 411
E2151: Could not load RLINK32.DLL 440 E2186: Published Real property '%s' must be Single, Real,
Double or Extended 480
E2152: Wrong or corrupted version of RLINK32.DLL 507
E2187: Size of published set '%s' is >4 bytes 481
E2153: ';' not allowed before 'ELSE' 485
E2188: Published property '%s' cannot be of type %s 347
E2154: Type '%s' needs finalization - not allowed in variant
record 395 E2189: Thread local variables cannot be local to a function 434
E2155: Type '%s' needs finalization - not allowed in file type 395 E2190: Thread local variables cannot be ABSOLUTE 336
E2156: Expression too complicated 489 E2191: EXPORTS allowed only at global scope 390
E2157: Element 0 inaccessible - use 'Length' or 'SetLength' 501 E2192: Constants cannot be used as open array arguments 367
E2158: %s unit out of date or corrupted: missing '%s' 349 E2193: Slice standard function only allowed as open array
argument 487
E2159: %s unit out of date or corrupted: missing '%s.%s' 349
E2194: Cannot initialize thread local variables 419
E2160: Type not allowed in OLE Automation call 346
E2195: Cannot initialize local variables 418
E2163: Too many conditional symbols 490
E2196: Cannot initialize multiple variables 419
E2165: Compile terminated by user 502
E2197: Constant object cannot be passed as var parameter 368
E2166: Unnamed arguments must precede named arguments
in OLE Automation call 496 E2198: %s cannot be applied to a long string 404
E2167: Abstract methods must be virtual or dynamic 337 E2199: Packages '%s' and '%s' both contain unit '%s' 470
E2168: Field or method identifier expected 443 E2200: Package '%s' already contains unit '%s' 470
E2169: Field definition not allowed after methods or properties E2201: Need imported data reference ($G) to access '%s' from
391 unit '%s' 470
E2170: Cannot override a non-virtual method 469 E2202: Required package '%s' not found 439
E2171: Variable '%s' inaccessible here due to optimization 504 E2203: $WEAKPACKAGEUNIT '%s' contains global data 507
E2172: Necessary library helper function was eliminated by E2204: Improper GUID syntax 435
linker (%s) 402
E2205: Interface type required 444
E2173: Missing or invalid conditional symbol in '$%s' directive
E2206: Property overrides not allowed in interface type 475
426
E2207: '%s' clause not allowed in interface type 409
E2174: '%s' not previously declared as a PROPERTY 429
E2208: Interface '%s' already implemented by '%s' 425
E2175: Field definition not allowed in OLE automation section
391 E2209: Field declarations not allowed in interface type 392
E2176: Illegal type in OLE automation section: '%s' 410 E2210: '%s' directive not allowed in in interface type 376
E2177: Constructors and destructors not allowed in OLE E2211: Declaration of '%s' differs from declaration in interface
automation section 368 '%s' 423
E2178: Dynamic methods and message handlers not allowed in E2212: Package unit '%s' cannot appear in contains or uses
OLE automation section 388 clauses 502
E2179: Only register calling convention allowed in OLE E2213: Bad packaged unit format: %s.%s 471
automation section 461
l
4 RAD Studio (Common)
E2214: Package '%s' is recursively required 483 E2248: Cannot use old style object types when compiling to
byte code 464
E2215: 16-Bit segment encountered in object file '%s' 485
E2249: Cannot use absolute variables when compiling to byte
E2216: Can't handle section '%s' in object file '%s' 496
code 336
E2217: Published field '%s' not a class or interface type 354
E2250: There is no overloaded version of '%s' that can be
E2218: Published method '%s' contains an unpublishable type called with these arguments 454
355
E2251: Ambiguous overloaded call to '%s' 338
E2220: Never-build package '%s' requires always-build
E2252: Method '%s' with identical parameters already exists 386
package '%s' 458
E2253: Ancestor type '%s' does not have an accessible default
E2221: $WEAKPACKAGEUNIT '%s' cannot have initialization
constructor 438
or finalization code 506
E2254: Overloaded procedure '%s' must be marked with the
E2222: $WEAKPACKAGEUNIT & $DENYPACKAGEUNIT both
'overload' directive 447
specified 354
E2255: New not supported for dynamic arrays - use SetLength
E2223: $DENYPACKAGEUNIT '%s' cannot be put into a
502
package 354
E2256: Dispose not supported (nor necessary) for dynamic
E2224: $DESIGNONLY and $RUNONLY only allowed in
arrays 453
package unit 412
E2257: Duplicate implements clause for interface '%s' 384
E2225: Never-build package '%s' must be recompiled 470
E2258: Implements clause only allowed within class types 415
E2226: Compilation terminated; too many errors 490
E2259: Implements clause only allowed for properties of class
E2227: Imagebase is too high - program exceeds 2 GB limit 413
or interface type 415
E2228: A dispinterface type cannot have an ancestor interface
E2260: Implements clause not allowed together with index
377
clause 413
E2229: A dispinterface type requires an interface identification
E2261: Implements clause only allowed for readable property
378
416
E2230: Methods of dispinterface types cannot specify directives
E2262: Implements getter must be %s calling convention 415
377
E2263: Implements getter cannot be dynamic or message
E2231: '%s' directive not allowed in dispinterface type 409
method 413
E2232: Interface '%s' has no interface identification 423
E2264: Cannot have method resolutions for interface '%s' 414
E2233: Property '%s' inaccessible here 477
E2265: Interface '%s' not mentioned in interface list 416
E2234: Getter or setter for property '%s' cannot be found 437
E2266: Only one of a set of overloaded methods can be
E2236: Constructors and destructors must have %s calling published 386
convention 460
E2267: Previous declaration of '%s' was not marked with the
E2237: Parameter '%s' not allowed here due to default value 'overload' directive 448
372
E2268: Parameters of this type cannot have default values 373
E2238: Default value required for '%s' 371
E2270: Published property getters and setters must have %s
E2239: Default parameter '%s' must be by-value or const 374 calling convention 462
E2240: $EXTERNALSYM and $NODEFINE not allowed for E2271: Property getters and setters cannot be overloaded 467
'%s'; only global symbols 487
E2272: Cannot use reserved unit name '%s' 489
E2241: C++ obj files must be generated (-jp) 370
E2273: No overloaded version of '%s' with this parameter list
E2242: '%s' is not the name of a unit 462 exists 455
E2245: Recursive include file %s 482 E2274: property attribute 'label' cannot be used in dispinterface
379
E2246: Need to specify at least one dimension for SetLength of
dynamic array 339 E2275: property attribute 'label' cannot be an empty string 477
E2247: Cannot take the address when compiling to byte code E2276: Identifier '%s' cannot be exported 354
338
E2277: Only external cdecl functions may use varargs 505
m
RAD Studio (Common) 4
E2278: Cannot take address of local symbol %s 355 E2309: Attribute - Known attribute named argument cannot be
an array 352
E2279: Too many nested conditional directives 452
E2310: Attribute - A custom marshaler requires the custom
E2280: Unterminated conditional directive 498
marshaler type 352
E2281: Type not allowed in Variant Dispatch call 350
E2311: Attribute - MarshalAs fixed string requires a size 352
E2282: Property setters cannot take var parameters 486
E2312: Attribute - Invalid argument to a known attribute 352
E2283: Too many local constants. Use shorter procedures 489
E2313: Attribute - Known attribute cannot specify properties 352
E2284: Duplicate resource name: type %d '%s' 388
E2314: Attribute - The MarshalAs attribute has fields set that
E2285: Duplicate resource id: type %d id %d 388 are not valid for the specified unmanaged type 352
E2286: Coverage library name is too long: %s 371 E2315: Attribute - Known custom attribute on invalid target 352
E2287: Cannot export '%s' multiple times 440 E2316: Attribute - The format of the GUID was invalid 353
E2288: File name too long (exceeds %d characters) 393 E2317: Attribute - Known custom attribute had invalid value 353
E2289: Unresolved custom attribute: %s 497 E2318: Attribute - The MarshalAs constant size cannot be
negative 353
E2290: Cannot mix destructors with IDisposable 376
E2319: Attribute - The MarshalAs parameter index cannot be
E2291: Missing implementation of interface method %s.%s 423 negative 353
E2292: '%s' must reference a property or field of class '%s' 478 E2320: Attribute - The specified unmanaged type is only valid
E2293: Cannot have both a DLLImport attribute and an external on fields 353
or calling convention directive 381 E2321: Attribute - Known custom attribute has repeated named
E2294: A class helper that descends from '%s' can only help argument 353
classes that are descendents '%s' 428 E2322: Attribute - Unexpected type in known attribute 353
E2295: A class helper cannot introduce a destructor 402 E2323: Attribute - Unrecognized argument to a known custom
E2296: A constructor introduced in a class helper must call the attribute 353
parameterless constructor of the helped class as the first E2324: Attribute - Known attribute named argument doesn't
statement 428 support variant 353
E2297: Procedure definition must be ILCODE calling E2325: Attribute '%s' is not valid on this target 357
convention 350
E2326: Attribute '%s' can only be used once per target 357
E2298: read/write not allowed for CLR events. Use
Include/Exclude procedure 427 E2327: Linker error while emitting attribute '%s' for '%s' 352
E2299: Property required 449 E2328: Linker error while emitting metadata 496
E2300: Cannot generate property accessor '%s' because '%s' E2329: Metadata - Error occured during a read 358
already exists 474
E2330: Metadata - Error occured during a write 358
E2301: Method '%s' with identical parameters and result type
E2331: Metadata - File is read only 358
already exists 384
E2332: Metadata - An ill-formed name was given 358
E2302: 'Self' is uninitialized. An inherited constructor must be
called before accessing ancestor field '%s' 371 E2333: Metadata - Data value was truncated 359
E2303: 'Self' is uninitialized. An inherited constructor must be E2334: Metadata - Old version error 358
called before calling ancestor method '%s' 371
E2335: Metadata - A shared mem open failed to open at the
E2304: 'Self' is uninitialized. An inherited constructor must be originally 359
called 370
E2336: Metadata - Create of shared memory failed. A memory
E2305: 'Self' might not have been initialized 371 mapping of the same name already exists 359
E2306: 'Self' is initialized more than once 370 E2337: Metadata - There isn't .CLB data in the memory or
stream 359
E2307: NEW standard function expects a dynamic array type
identifier 339 E2338: Metadata - Database is read only 359
E2308: Need to specify at least one dimension for NEW of E2339: Metadata - The importing scope is not compatible with
dynamic array 339 the emitting scope 358
n
4 RAD Studio (Common)
E2340: Metadata - Data too large 358 E2376: STATIC can only be used on non-virtual class methods
430
E2341: Metadata - Column cannot be changed 358
E2377: Unable to locate Borland.Delphi.Compiler.ResCvt.dll 484
E2342: Metadata - Too many RID or primary key columns, 1 is
max 358 E2378: Error while converting resource %s 389
E2343: Metadata - Primary key column may not allow the null E2379: Virtual methods not allowed in record types 506
value 358
E2380: Instance or class static method expected 444
E2344: Metadata - Data too large 359
E2381: Resource string length exceeds Windows limit of 4096
E2345: Metadata - Attempt to define an object that already characters 484
exists 436
E2382: Cannot call constructors using instance variables 422
E2346: Metadata - A guid was not provided where one was
E2383: ABSTRACT and SEALED cannot be used together 338
required 436
E2385: Error while signing assembly 389
E2347: Metadata - Bad binary signature 436
E2386: Invalid version string '%s' specified in %s 430
E2348: Metadata - Bad input parameters 435
E2387: The key container name '%s' does not exist 428
E2349: Metadata - Cannot resolve typeref 436
E2388: Unrecognized strong name key file '%s' 428
E2350: Metadata - No logical space left to create more user
strings 436 E2389: Protected member '%s' is inaccessible here 480
E2351: Final methods must be virtual or dynamic 395 E2390: Class must be sealed to call a private constructor
without a type qualifier 481
E2352: Cannot override a final method 469
E2391: Potentially polymorphic constructor calls must be virtual
E2353: Cannot extend sealed class '%s' 391
462
E2354: String element cannot be passed to var parameter 488
E2392: Can't generate required accessor method(s) for
E2355: Class property accessor must be a class field or class property %s.%s due to name conflict with existing symbol %s in
static method 361 the same scope 355
E2356: Property accessor must be an instance field or method E2393: Invalid operator declaration 429
476
E2394: Parameterless constructors not allowed on record types
E2357: PROCEDURE, FUNCTION, or CONSTRUCTOR 472
expected 473
E2395: Unsafe procedure only allowed if compiling with
E2358: Class constructors not allowed in class helpers 357 {$UNSAFECODE ON} 498
E2359: Multiple class constructors in class %s: %s and %s 440 E2396: Unsafe code only allowed in unsafe procedure 497
E2360: Class constructors cannot have parameters 358 E2397: Unsafe pointer only allowed if compiling with
{$UNSAFECODE ON} 498
E2361: Cannot access private symbol %s.%s 481
E2398: Class methods in record types must be static 482
E2362: Cannot access protected symbol %s.%s 480
E2399: Namespace conflicts with unit name '%s' 381
E2363: Only methods of descendent types may access
protected symbol [%s]%s.%s across assembly boundaries 472 E2400: Unknown Resource Format '%s' 496
E2364: Cross-assembly protected reference to [%s]%s.%s in E2401: Failure loading .NET Framework %s: %08X 361
%s.%s 432
E2402: Constructing instance of abstract class '%s' 370
E2366: Global procedure or class static method expected 450
E2403: Add or remove accessor for event '%s' cannot be found
E2370: Cannot use inherited methods for interface property 438
accessors 474
E2404: Cannot mix READ/WRITE property accessors with
E2371: ABSTRACT and FINAL cannot be used together 337 ADD/REMOVE accessors 440
E2372: Identifier expected 406 E2405: Unknown element type found importing signature of
%s.%s 496
E2373: Call to abstract method %s.%s 336
E2406: EXPORTS section allowed only if compiling with
E2374: Cannot make unique type from %s 354
{$UNSAFECODE ON} 497
E2375: PRIVATE or PROTECTED expected 472
E2407: Duplicate resource identifier %s found in unit %s(%s)
o
RAD Studio (Common) 4
and %s(%s) 388 E2435: Class member declarations not allowed in anonymous
record or local record type 360
E2408: Can't extract strong name key from assembly %s 489
E2436: Type declarations not allowed in anonymous record or
E2409: Fully qualified nested type name %s exceeds 1024 byte
local record type 491
limit 452
E2437: Constant declarations not allowed in anonymous record
E2410: Unsafe pointer variables, parameters or consts only
or local record type 370
allowed in unsafe procedure 498
E2439: Inline function must not have open array argument 466
E2411: Unit %s in package %s refers to unit %s which is not
found in any package. Packaged units must refer only to E2441: Inline function declared in interface section must not use
packaged units 460 local symbol '%s' 422
E2412: CREATE expected 370 E2442: Inline directive not allowed in constructor or destructor
421
E2413: Dynamic array type needed 388
E2447: Duplicate symbol '%s' defined in namespace '%s' by
E2414: Disposed_ cannot be declared in classes with
'%s' and '%s' 385
destructors 381
E2448: An attribute argument must be a constant expression,
E2415: Could not import assembly '%s' because it contains
typeof expression or array constructor 346
namespace '%s' 430
E2449: Inlined nested routine '%s' cannot access outer scope
E2416: Could not import package '%s' because it contains
variable '%s' 421
system unit '%s' 430
E2450: There is no overloaded version of array property '%s'
E2417: Field offset cannot be determined for variant record
that can be used with these arguments 454
because previous field type is unknown size record type 496
E2452: Unicode characters not allowed in published symbols
E2418: Type '%s' needs initialization - not allowed in variant
494
record 420
E2453: Destination cannot be assigned to 376
E2419: Record type too large: exceeds 1 MB 482
E2454: Slice standard function not allowed for VAR nor OUT
E2420: Interface '%s' used in '%s' is not yet completely defined
argument 487
417
Edit 754
E2422: Imported identifier '%s' conflicts with '%s' in namespace
'%s' 361 Edit Hyperlinks for Diagram dialog box 963
E2423: Void type not usable in this context 506 Edit Object Info 1008
E2424: Codepage '%s' is not installed on this machine 426 Edit Page dialog box 923
E2425: Inline methods must not be virtual nor dynamic 421 Edit Tab Order 756
E2426: Inline function must not have asm block 421 Edit Tools 1008
E2427: Only one of IID or GuidAttribute can be specified 407 Editing an OCL Expression 249
E2428: Field '%s' needs initialization - not allowed in CLS editing code
compliant value types 420
class completion 145
E2429: Duplicate implementation for 'set of %s' in this scope
code insight 146
388
code snippets 148
E2430: for-in statement cannot operate on collection type '%s'
463 collapsing code 137
E2431: for-in statement cannot operate on collection type '%s' Editing Code Procedures 136
because '%s' does not contain a member for '%s', or it is
inaccessible 362 Editing Properties 260
E2432: %s cannot be applied to a rectangular dynamic array Editing Resource Files in the Translation Manager 170
429 Editor Options 993
E2433: Method declarations not allowed in anonymous record ELSE (Delphi) 288
or local record type 437
ELSEIF (Delphi) 289
E2434: Property declarations not allowed in anonymous record
or local record type 476 ENDIF directive 289
p
4 RAD Studio (Common)
q
RAD Studio (Common) 4
F2446: Unit '%s' is compiled with unit '%s' in '%s' but different Finding References 141
version '%s' found 376
Finding Units and Using Namespaces (Delphi, C#) 142
fatal errors 511
Flip Children 758
Fatal errors 511
Floating Point Exception Checking (Delphi) 291
Field <Field Name> does not have a corresponding component.
Flush function
Remove the declaration? 764
device drivers 692
Field <Field Name> should be of type <Type1> but is declared
as <Type2>. Correct the declaration? 764 Folder or Directory View 867
Field Link Designer 746 Font 1004
fields Font editor 919
classes and objects 519 for loops 705
Fields 519 for...in statements 705
Fields Editor 746 Foreign Key Constraint 747
File 768 Form Designer 46, 1004
File Browser 1036 Forms 840
File Extensions of Files Generated by RAD Studio 1084 forward and interface declarations
file input and output procedures and functions 662
standard routines 692 foward declarations
file types (Win32) 566 classes and objects 514
Filter editor 918 FPU 1026
Filter To-Do List 1050 FTP Connection Options 778
finalization section 683 function calls
Finalize expressions 720
Delphi for .NET 653 function declarations
Find 952 procedures and functions 662
Find Class 955 Fundamental Syntactic Elements 700, 701
Find in Files 953
Find Local References 956 G
Find Option 878
General Concepts 14
Find Original Symbol 956
Generate Dataset 748
Find Package Import 944
Generate Documentation dialog box 966
Find Reference Results 1060
Generate Sequence Diagram dialog box 966
find references
Generating an Incremental Sequence Diagram 245
find declaration symbol 65
Generating Project Documentation 248
find local references 141
Generics
Find References 954, 956
constraints 603
Find References Overview (Delphi, C#, C++) 65
overview 596
find references sample 65
parameterized methods 598
Find Unit 66
Parameterized types 596
Finding Items on the Tool Palette 158
platform requirements 596
r
4 RAD Studio (Common)
GUI Components for Modeling 1105 History Element (State Machine Diagrams) 1155
History Manager 149, 1009
HPP emit (Delphi) 292
H
HR HTML Element 804
H2077: Value assigned to '%s' never used 503
HTML Elements 801
H2135: FOR or WHILE loop executes zero times - deleted 463
HTML Formatting 998
H2164: Variable '%s' is declared but never used in '%s' 499
HTML Tidy Options 999
H2219: Private symbol '%s' declared but never used 472
HTML/ASP.NET Options 998
H2235: Package '%s' does not use or export '%s.%s' 470
Hyperlinking Diagrams 201
s
RAD Studio (Common) 4
t
4 RAD Studio (Common)
u
RAD Studio (Common) 4
associating 226
Link object file (Delphi) 297
M
Linker 840, 880
macro
Linker error: %s 484
recording 142
Linker error: %s: %s 485
Managing Memory 175
Linker Linking 878
Managing the Development Cycle Overview 14
Linker Output Options 881
Masked Text editor 932
Linker Warnings 884
MDA 93
Linking Another Interaction from an Interaction Diagram 227
Members 1125
Linking Delphi Units Into an Application 111
Memory 1032
linking to object files
Memory allocation sizes (Delphi) 298
procedures and functions 662
memory management
List Editor 885
Delphi for .NET 653
ListView Items Editor 926
Delphi for Win32 644
Live Templates 42
Memory Management 644
LiveSource Overview 93
Memory Management Issues on the .NET Platform 653
LiveSource Rules 1125
Memory Management on the Win32 Platform 644
Load Picture dialog box 931
Menus 1110
Load Process 949
message
Load Process Environment Block 945
operation call 227
Load Process Local 946
self 227
Load Process Remote 946
MESSAGE directive (Delphi) 299
Load Process Symbol Tables 947
message methods
Load String List dialog box 932
methods 521
Loading an image at design time 931
message pane
local declarations
refactoring 111
procedures and functions 662
Message View 1038
Local symbol information (Delphi) 297
method extract
Local Variables Window 1028
code fragments 143
Localization Procedures 169
method rename 59
Localizing Applications 18
METHODINFO directive (Delphi) 299
Lock Controls 758
methods
logical (bitwise) operators 720
classes and objects 521
long strings
Methods 521
string types 561
metric 98
Long strings (Delphi) 298
viewing description 276
loops 705
Metric Results Pane 1112
metrics
filtering results 276
v
4 RAD Studio (Common)
w
RAD Studio (Common) 4
New Standard Action Classes dialog box 927 open array parameters
New Tags 1000 parameters 672
New Thread Object 783 open arrays 669
New Together Project Wizards 1159 Open dialog box 933
New VCL Component Wizard 736 Open function
New Web Server Application 793 device drivers 692
New WebSnap Application 795 Open String Parameters (Delphi) 300
New WebSnap Data Module 796 Opening an Existing Project for Modeling 267
No code was generated for the current line 766 Opening the Pattern Organizer 260
node Opening the UML 2.0 Sample Project 190
optimizing size 204 operand 1151
optimizing size (global) 204 operating system errors 512
NODEFINE 302 Operating system errors 512
NOINCLUDE (Delphi) 302 operation
Notebook editor 933 defining parameters 223
null-terminated string functions operator 1151
strings 692 Operator and Operand for a Combined Fragment 1151
null-terminated strings operator overloading
strings 692 classes and objects 548
numerals (Delphi) Operator Overloading 548
character set (Delphi) 701 operator precedence 720
NUnit Overview 76 operators
classes and objects 539
O expressions 720
x
4 RAD Studio (Common)
pointer types Project Types and Formats with Support for Modeling 1116
y
RAD Studio (Common) 4
Quality Assurance Facilities Overview 98 Refactoring: “Pull Members Up" and “Push Members Down” 188
z
4 RAD Studio (Common)
aa
RAD Studio (Common) 4
bb
4 RAD Studio (Common)
cc
RAD Studio (Common) 4
dd
4 RAD Studio (Common)
UDDI Browser 902 UML 2.0 Composite Structure Diagram Elements 1147
UML 1.5 Activity Diagram Definition 1119 UML 2.0 Deployment Diagram Definition 1148
UML 1.5 Activity Diagram Elements 1120 UML 2.0 Deployment Diagram Elements 1148
UML 1.5 Activity Diagrams 1117 UML 2.0 Deployment Diagrams 1148
UML 1.5 Class Diagram Definition 1126 UML 2.0 Interaction Diagrams 1149
UML 1.5 Class Diagram Elements 1127 UML 2.0 Message 1153
UML 1.5 Collaboration Diagram Definition 1133 UML 2.0 Sample Project 84
UML 1.5 Component Diagram Definition 1128 UML 2.0 Sample Project, Behavior Package 85
UML 1.5 Component Diagram Elements 1129 UML 2.0 Sample Project, Structure Package 86
UML 1.5 Component Diagrams 1128 UML 2.0 Sequence Diagram Definition 1154
UML 1.5 Deployment Diagram Definition 1130 UML 2.0 Sequence Diagram Elements 1154
UML 1.5 Deployment Diagram Elements 1131 UML 2.0 State Machine Diagram Definition 1155
UML 1.5 Deployment Diagrams 1129 UML 2.0 State Machine Diagram Elements 1156
UML 1.5 Interaction Diagram Elements 1134 UML 2.0 State Machine Diagrams 1155
UML 1.5 Interaction Diagrams 1131 UML 2.0 Together Design Project Wizard 1161
UML 1.5 Message 1133 UML 2.0 Use Case Diagram Definition 1157
UML 1.5 Reference 1116 UML 2.0 Use Case Diagram Elements 1158
UML 1.5 Sequence Diagram Definition 1134 UML 2.0 Use Case Diagrams 1157
UML 1.5 Together Design Project Wizard 1161 Unavailable Options 893
UML 1.5 Use Case Diagram Definition 1137 UNDEF directive (Delphi) 306
UML 1.5 Use Case Diagram Elements 1138 Understanding Assembler Syntax (Win32 Only) 610
ee
RAD Studio (Common) 4
ff
4 RAD Studio (Common)
W1035: Return value of function '%s' might be undefined 456 Warning messages (Delphi) 307
W1036: Variable '%s' might not have been initialized 499 Warnings (Delphi) 308
W1037: FOR-Loop variable '%s' may be undefined after loop Watch List Window 1031
396 Watch Properties 948
gg
RAD Studio (Common) 4
Working with a Relationship 241 x2421: Imported identifier '%s' conflicts with '%s' in '%s' 361
Working with a Set of Audits 274 XMI Export dialog box 978
Working with a Set of Metrics 277 XMI Import dialog box 979
Working with a Tie Frame 229 XML Data Binding Wizard Options 797
Working with a UML 1.5 Message 215 XML Data Binding Wizard, page 1 797
Working with a UML 2.0 Message 227 XML Data Binding Wizard, page 2 798
Working with an Instance Specification 237 XML Data Binding Wizard, page 3 799
hh