What's New in Delphi and C++Builder 2009

From RAD Studio XE3
Jump to: navigation, search

Go Up to What Was New in Past Releases

Note: This document describes a past release.

This release provides key new features for developing applications using both Delphi and C++Builder.

Please note that this release is a breaking change in both Delphi and C++Builder. The main focus and feature of this release is the change from using ANSI-based strings to using a Unicode-based string type, appropriately named UnicodeString. This means that to use Delphi or C++Builder 2009 to work on pre-existing applications, you need to make some modifications in your code, largely related to string handling, and you need to successfully recompile your code.

About Unicode: The Unicode Standard has been adopted by many computer industry leaders, now including CodeGear. Unicode provides a unique number for every glyph, regardless of the platform, program, or language in use. According to the Unicode Consortium (http://www.unicode.org), Unicode is required by modern standards such as XML, Java, ECMAScript (JavaScript), LDAP, CORBA 3.0, WML, and so forth, and is the official way to implement ISO/IEC 10646. Unicode is supported in many operating systems, all modern browsers, and many other products. The emergence of the Unicode Standard, and the availability of tools supporting it, are among the most significant recent global software technology trends.

Incorporating Unicode into client-server or multi-tiered applications and websites offers significant cost savings compared to legacy character sets. Unicode enables a single software product or a single website to be targeted across multiple platforms, languages and countries without re-engineering. It allows data to be transported through different systems without corruption.

Unicode Throughout the Product

The IDE is fully Unicode-enabled, from top to bottom, left to right, and front to back. The entire IDE itself is now a Unicode-based application, requiring that all components and design-time code be based on the UnicodeString type as well. Unicode characters are fully supported in identifiers and strings. See Unicode in RAD Studio for more details.

There are some exceptions: You cannot use Unicode characters in DLL names. A few command line utilities such as MAKE, IMPDEF and IMPLIB cannot handle Unicode file names.

The change in the default string type affects other data types and many functions as well. For example, SizeOf(Char) is now 2 bytes, not 1 byte. Calls to Length(MyString) return the number of characters, not the number of bytes in the string.

You can also use Using Unicode in the Command Console by setting the font and code page properties.

Converting Your Projects

First and most important, to use Delphi or C++Builder 2009, you need to make some changes in your existing code and then recompile your application to handle Unicode, as described in the help topic Enabling Applications for Unicode (Delphi) and Enabling C++ Applications for Unicode.

Backing Up Your Projects: You cannot migrate a project from the 2009 version to any earlier version. Before you open your existing projects in Delphi or C++Builder 2009, you might want to make a backup copy of the project so that you can restore the project in its entirety if unexpected problems occur.

Format of Project File Has Changed: For both Delphi and C++Builder, the format of the project file has changed in order to accommodate new features of this release. Project files have a file extension of .dproj, .cbproj, or for older projects, .bdsproj. When you open any previously existing Delphi or C++ project, the compiler first saves a backup copy of your project file with the extension .2007.

The following message is displayed for a Delphi project (a similar message appears for a C++ project):

Project <project_name> is about to be upgraded. The project will no longer be usable with previous versions of the product. A backup of the project will be created.

Backup project name:  <editable_field>

A check box allows you to prevent the message from recurring and to always create backup files. The project file is opened and saved in MSBuild format, and then reopened in the IDE. Note that the compilers in Delphi and C++Builder 2009 are version 12.

Delphi Compiler Changes

The following changes have been made in the Delphi compiler:

IDE Changes

The following changes have been made in the Integrated Development Environment:

  • Extensive Improvements to Project > Options Dialog Box. The compiler-related pages of Project Options have been redesigned to place all the options in one column, with their associated values in a second column. This arrangement makes it easier to scan the contents of a page and to find specific options. Some value fields have a pop-up button (Ellipsis or Down Arrow) to invoke a secondary dialog, either the <ordered_list> dialog box or a standard Browse for Folder dialog.
  • Build configurations and option sets now work similarly for Delphi and C++Builder. Build configurations are now inheritable from the Base configuration for both Delphi and C++. Both Delphi and C++Builder now support named option sets (previously supported only by C++Builder 2007). You can attach option sets to build configurations by reference or by value (previously supported only by value). For example, there are separate base options for search paths, compiler warnings, and optimizations. To control the priority in which these separate options are applied, use the Apply Option Set dialog box. For more information, see Build Configurations Overview and Option Sets Overview.
  • Project Manager view changes. Use the drop-down menu at the top of the Project Manager to select any of three file views:
    • Directory (Nested). This is the current method, where each directory is a separate, expandable node.
    • Directory (Flat). Files reside directly under a directory node containing the entire path where they reside.
    • List. No directory nodes are visible.
  • Redesign of Wizards for Import Component and New VCL Component. The Import Component Wizard and New VCL Component wizards have been expanded and redesigned to include type libraries, ActiveX controls, and assemblies. Both wizards have new options: Install into Existing Package and Install into New Package.
  • Code Editor changes. The Code Insight features have been updated to recognize and support the new language features of C++ and Delphi. Syntax highlighting, code completion, Help Insight (Delphi), and Error Insight (Delphi) should work correctly with Delphi's anonymous methods and generics as well as the new C++0x language features.
  • Resource Compiler Alternative: The Project > Options > Resource Compiler dialog box gives you a choice of resource compilers. You can choose to use either BRCC32.exe or RC.exe, the Microsoft SDK platform resource compiler. RC supports Unicode characters in resource files and file names, as well as new Vista resource types such as icons with alpha channel. If you choose RC, you also need to explicitly #include <winresrc.h> for both C++ and Delphi.
  • The new Resources Editor is a dialog that allows you to add resource files (various types of graphics such as bitmaps, icons, and fonts) to your project. You can review all your project's resource files in the Resources Editor.
  • The new Class Explorer for Delphi enables you to view the inheritance hierarchy of classes and interfaces in your project. The Class View and Member List are the principal panes of the Class Explorer. The four Go to commands enable you to locate the declaration of a selected class, field, property or method; to locate the definition of a selected method; and to locate the getter or setter definition of a method. You can also add fields, properties, and methods to a class. For more information, see Class Explorer.

C++Builder 2009

The following key features are new or significantly changed:

  • C++0x features: Eleven features selected from the new C++0x standard have been implemented in C++Builder 2009:
  • The new UnicodeString class is based on AnsiString. See the help for System.UnicodeString.
  • The new _TCHAR Maps to option controls the floating definition of _TCHAR. The choices are wchar_t and char. Selecting wchar_t sets the UNICODE and _UNICODE defines. Before you can set this option to wchar_t, your project must have an entry point called "_tmain" or "_tWinMain". New projects (created with C++Builder 2009) have these entry points by default, but imported projects typically need to have these entry points added by hand. For more information, see the help for Project > Options > Directories and Conditionals . Also see _TCHAR Mapping.
  • Emulating Delphi Class Methods: Previously, Delphi class methods were emulated in C++ by static functions by using an explicit metaclass parameter. The new language extension keyword __classmethod can now be used to emulate Delphi class methods. A class method is callable on the type as well as on objects of that type. See Class Methods.
  • Exception handling improvements: You can now turn on optimization with confidence because exception handling has been enhanced in C++Builder 2009.
  • Boost libraries available: Boost is a library for C++ that significantly expands the language using template metaprogramming. A subset of Boost 1.35 has been included that has been fully tested and preconfigured specifically for C++Builder 2009. Binaries have already been built for functions that require them. Include paths have been set for the Boost libraries, and any necessary libraries should be automatically linked because of #pragma link lines in the Boost code. For example, to use the Boost minmax library, your code should specify:
#include <boost/algorithm/minmax.hpp>

To view the help for the Boost libraries, go to http://www.boost.org/doc/libs/1_35_0/libs/libraries.htm.

  • Name mangling updated: The name mangling and hashing scheme has been revised so that names now succeed that previously might have collided (and thus caused a failure). You might occasionally see a mangled name ending in an ellipsis (...). This happens when a mangled name is too long to be represented in the 255-character OMF limit and thus gets truncated. In addition, very long unmangled names might get truncated when they are printed by the linker and other tools. This happens when an unmangled name is decoded from a mangled name that was truncated.
  • Handling New Delphi Features: Delphi anonymous methods, generics, and AnsiString specified with Code Page can cause potential programming issues that you might encounter in C++. See Handling Delphi Anonymous Methods in C++, Handling Delphi Generics in C++, and Handling Delphi Ansistring Code Page Specification in C++, respectively.
  • Disabling Library Search Path for Added Files: By default, the linker finds libraries and object files that you add to your C++ project by using the Library Search Path to locate library or object files. (Library Search Path is set on the Project > Options > Directories and Conditionals dialog box.) To link a library or object file explicitly by path, right-click the file in the Project Manager and uncheck Link by Name Only. The linker then receives the fully qualified path name of the library or object file and ignores the Library Search Path.
  • HPP generation by the Delphi compiler has changed. Delphi sealed classes and Delphi final overrides are both now mapped to the final (C++) attribute in C++.
  • Support for New Keywords: Several types of new keywords have been added to C++Builder 2009:
    • Six new keywords are supported in default mode: alignof, char16_t, char32_t, decltype, static_assert, and __classmethod.
    • Nine new Reserved Words are supported with the -Ax switch set: alignas, constrexpr, nullptr, concept, concept_map, axiom, late_check, requires, thread_local.
    • Eleven alternative representations of operators and punctuators are supported: and, and_eq, bitand, bit_or, compl, not, not_eq, or, or_eq ,xor, xor_eq.
    • Four new C99 reserved words are supported with the -An switch set: _Bool, _Complex, _Imaginary, restrict.

Modeling Changes for C++

C++Builder previously included code visualization in a one-way UML Class diagram viewer. C++Builder now has live code and two-way UML modeling in the Class diagram. This means you can work in the source code, work in the UML model, and move back and forth with full, live synchronization - "the code is the model, the model is the code."

C++Builder includes support for the Class, Use Case, Sequence, Collaboration, Component, Deployment, Statechart, and Activity diagrams.

The C++Builder modeling support also includes design pattern support including "create by pattern" and harvesting objects in your models with the "save as pattern." C++Builder supports Gang of Four design patterns including the Behavioral, Creational, and Structural groups of patterns.

When you want to generate HTML documentation for your project, you can right-click on any diagram, select the Generate Documentation pop-up menu item, and choose to generate diagrams, JavaScript navigation tree, and interfaces for the current namespace, current namespace with descendent namespaces, current diagram, or all diagrams.

COM Changes

The COM wizards have been revamped and enhanced for Delphi and C++Builder 2009, and one new COM wizard has been added (ActiveX Control). The wizards are available in the ActiveX and Multitier folders in the New Items dialog box. The COM wizards are: COM Object, Automation Object, Active Form, Active Server Object, Remote Data Module, Com + Event, COM + Subscription, Property Page, ActiveX Control, Transactional Object, Transactional Object, Transactional Data Module, Type Library, ActiveX Library. Both the ActiveX Library wizard and the Type Library wizard are project level wizards, and thus they are only available from the gallery if there is no active project. All other COM wizards are only available if there is a valid project open to contain them. See Using COM Wizards.

A new file type has been added to the COM architecture--the text-based RIDL file (Restricted Interface Definition Language). The RIDL file is the storage mechanism that the project uses to persist the type library data to disk. The binary .tlb file is now an intermediate file (like a .res, .dcu, .obj, and so forth). This means that you can rebuild the .tlb file from the command line (outside the IDE), that you can edit .tlb files using a text editor, and the history is stored by the IDE. See Saving and Registering Type Library Information.

The Type Library Editor Window now works on top of a .text file (the .RIDL file) instead of the binary .tlb. The .text file is compiled using the new type library generator, GenTLB.exe, to generate the binary .TLB file. This change means that:

  • You no longer have to check in the binary .tlb file, because the build system can generate it from the latest .ridl file.
  • Multiple programmers can work on the type library at the same time and then simply merge their changes to the text RIDL file. (Binary files cannot be merged, requiring that the last person always overwrites previous changes.)
  • The RIDL format offers more flexibility for certain constructs than the Type Library Editor. For example, with a RIDL file you can add and edit custom data on any type, function, or member. You can describe complex types such as safe arrays of safe arrays.
  • You can easily perform a diff of RIDL files and gain insight into the evolution of the model exposed by a server over time.

The Type Library Editor window now has three new tabs located on the lower edge of the window:

  • The Code page displays the RIDL code.
  • The Design page is the Type Library Editor, displaying the fields in the RIDL file.
  • The History page is the History Manager.

Refresh works differently for the Type Library Editor now. You can click the Refresh button on the Design page to have your Delphi or C++ sources updated after you change your type library. The IDE will also 'Auto-Refresh' on the following events:

  • When you switch from the Code and Design tabs.
  • When you build the project.

Use the Type Library Explorer for read-only viewing of binary-format .tlb files. Choose File > Open and select a .tlb file.


The following key features are new or significantly changed:

  • Threads View and Wait Chain Traversal (Windows Vista only): A Wait Chain Traversal feature has been added to help you resolve thread contention or deadlock issues. The feature relies on a facility added to the Windows Vista operating system that provides information to the debugger about the wait status of your application's threads in the form of a wait chain. A wait chain is an alternating sequence of threads and synchronization objects. Each thread waits for the object that follows it, and that object is owned by the subsequent thread in the chain. In the Threads view, a new column ("Wait Chain") lists the contents of the wait chain. Though not all synchronization objects are supported, this information helps you determine the object that a blocked thread is waiting on. Furthermore, the view reports when a deadlock is detected, a situation in which a cycle of dependencies prevents all of the application's threads from becoming runnable.
  • Break on Abort Exception. The C/C++ runtime library has changed so that when an application running under the Debugger calls abort(), an exception is raised (with exception code 0x40000015). In conjunction with this, a new Native OS Exception type "C/C++ Abort Exception" appears in the list of exceptions specified on Tools > Options > Debugger Options > Native OS Exceptions . By default, the Debugger notifies you when this exception occurs. As with any exception notification from the Debugger, you have the option either to break into the debugger when this happens or to continue running the program. You can tell the Debugger to not give the notification by changing the Handled by setting for this exception from Debugger to User program.
  • You need to re-enable data breakpoints for each debug session. Data breakpoints are automatically disabled when a debugging session ends, because the address of a variable can change from one debug session to the next. To re-use a data breakpoint during a subsequent debugging session, you need to re-enable the data breakpoint after your debugging session begins.


Many changes have been made to improve support for database application development.


Unicode support has been added to the Oracle, Interbase, and MySQL dbExpress drivers.

The dbExpress driver framework has these changes:

  • The extension classes added by the previous version of the product have been removed and their contents moved to the base class. For instance, the TDBXConnectionEx class was removed and its methods and properties were moved to the TDBXConnection class.
  • Many methods' parameter types changed from WideString to the new type UnicodeString.
  • TDBXValue and TDBXWritableValue now have GetAs... and SetAs... methods added to coerce the data type, which can be used by classes inheriting from them. TDBXValue and TDBXWritableValue also have new As... properties for type coercion, such as AsBcd.
  • If parameter metadata is supported in a database, executing the TDBXCommand. Prepare method causes the TDBXCommand parameter list to be automatically populated with parameters for the command.


DataSnap is a multi-tier architecture for database applications. DataSnap provides a middle-tier application server that contains and manages remote data modules. DataSnap has been enhanced to provide a very general connection mechanism between components in different tiers.

The new class TDSServer manages the creation and lifetime of transports and server method classes. You can use TDSServer to create your own middle tier server. The new component TDSServerClass can be used to specify an application server-side class with published methods that can be called from a remote client using dynamic method invocation. Methods in this class can be called from remote clients, such as the DBX Client Provider or the ADO.NET provider.

Once you have connected to a DataSnap server, you can call methods in an application server similarly to stored procedures. For instance, you can use the new class TSqlServerMethod to call server methods by specifying a text class and method name for command text and parameters for the method. Server methods can use a TDBXReader to receive and return datasets to and from the client.

The new smart tables are an abstraction of the different datasets Datasnap supports, so they can be passed transparently between client and server.

You can still write application server side classes that extend TRemoteDataModule, so that the providers they contain can be accessed by the new client-side TDSProviderConnection client component. TDSProviderConnection provides connectivity to a DataSnap server using dbExpress and is provided to keep existing applications compatible and take advantage of new DataSnap features. New applications do not need to use TRemoteDataModule or TDSProviderConnection with DataSnap.

Application servers need not be connected to databases at all. A server methods class has only two requirements:

  • The class must be a descendant of TPersistent.
  • The MethodInfo directive must be enabled.

For more information about DataSnap, see http://blogs.codegear.com/steveshaughnessy/2008/07/20/38912.

Getting BlackfishSQL Licenses: The way you get deployment licenses for Blackfish SQL has changed. You no longer use the .slip file that was previously included with the product. Now you can generate a deployment license file online at http://reg.codegear.com. For more information about installation, deployment, and licensing, see the Install, Deploy, and License files located, by default, at C:\Program Files\CodeGear\RAD Studio\7.0.


For an overview of VCL enhancements, see (PDF) Building User Interfaces with Delphi 2009, by Marco Cantu.

Protected API Now in the Help: Protected methods (procedures and functions) and protected properties are now included among the API help topics.

See a Preview of VCL Components in CDN: For an illustrated summary of new and enhanced components for this release, see this article by Anders Ohlsson:http://dn.codegear.com/article/38349.

See Some of the New VCL/RTL Features to Support Unicode: This CDN article is Part II of Nick Hodges' series about Delphi in a Unicode World. He describes highlights of API for Unicode, such as Character and TEncoding: http://dn.codegear.com/article/38498.

Microsoft Windows Compatibility: Some components, classes, methods, and properties are compatible with the look and feel of the Windows Vista operating system. For a list of controls that are available on Vista, see Components Available Only on Specific Windows OS.

VCLJPG to VCLIMG: The vcljpg package was removed and its contents are now in vclimg. Update projects using vcljpg to use the vclimg package instead.

TDataSet Changes in Bookmark Handling: DB.TDataSet has some significant changes in its handling of Bookmarks:

  • The TBookmarkStr type is being deprecated.
  • The TBookmark type definition has changed from Pointer to TBytes, which means that it is now reference-counted and lifetime-managed.
  • TDataSet.Bookmark property now returns a TBookmark instead of a TBookmarkStr.
  • Any use of either TBookmarkStr or Pointer in user code should change to TBookmark.
  • The following code results in invalid access to freed memory on the GotoBookmark line, because no valid TBookmark reference is made:
 Bookmark: Pointer;
 Bookmark := MyDataSet.GetBookmark;

New VCL and RTL Components/Classes

  • TButtonedEdit and TCategoryPanel (TPanel with a header to collapse and expand the panel) added to the ExtCtrls namespace
  • TCategoryPanelGroup, a container control that contains one or more collapsible panels
  • TCharacter class added to new Character namespace
  • TLinkLabel to add HTML links to a text label
  • TTListGroup, TListGroups to support groups on a list view
  • TEncoding and TStringBuilder added to SysUtils namespace (see A. Lanusse's Blog about TStringBuilder)
  • TCustomHint added to Controls namespace; added TBalloonHint inheriting from TCustomHint
  • TStringReader and TStringWriter added to Classes namespace to read and write strings using TTextReader/Writer interface
  • TStreamReader and TStreamWriter added to Classes namespace to read and write streams using TTextReader/Writer interface

VCL/RTL Component/Class Changes

For handling strings in the new Unicode mode, you might need to use the SysUtils.TEncoding class as described in Using TEncoding for Unicode Files.

See (PDF) Building User Interfaces with Delphi 2009, by Marco Cantu.

The following classes have enhancements:

  • TActionManager
  • TApplication
  • TBitmap
  • TButton
  • TComboBox
  • TControl
  • TCustomListView
  • TDBImage
  • TEdit/TLabeledEdit
  • TGraphic
  • TImageList
  • TLabel
  • TListView
  • TCustomHeaderControl
  • THeaderSection
  • TMaskEdit
  • TMemo
  • TObject
  • TPanel
  • TPopupActionBar
  • TProgressBar
  • TRadioGroup
  • TScreen
  • TTrayIcon
  • TTreeView
  • TWinControl

Additional Enhancements:

  • Added PNG image support, including support for transparency.
  • Published DoubleBuffered property for most components.
  • Added ParentDoubledBuffered property.
  • Themed display style for action menus/toolbars (requires Windows Vista or later).
  • Added "Platform Default" ActionManager style, matching action menus/toolbars look and feel to the runtime OS (introduces themed Windows Vista look and feel).

Ribbon Controls

One of the new features is support for the 2007 Microsoft(®) Office Fluent(TM) User Interface. This is commonly known as the ribbon. The ribbon is managed by TActionManager. TActionManager allows you to develop more usable applications by deploying the IDE to create ribbons for your Delphi application. Using TActionManager enables you to create commands, buttons, and graphics linked to these ribbons.

Support for ribbon controls includes the following core components:

  • TRibbon: Provides the main functionality of the ribbon with tabs and groups of commands.
  • TRibbonApplicationMenuBar: Provides functionality for the applications main menu.
  • TRibbonQuickAccessToolbar: Allows development of the Quick Access Toolbar along with your ribbon.

To create an application using ribbons, you start by creating a new Delphi Win32 VCL application. For applications that already use TActionManager, you can simply change the Style to be one of the three included ribbon styles or convert your existing user interface to use the ribbon.

Ribbon Controls Demos: Three demos for ribbon controls are installed with the product. Go to My Documents | RAD Studio | 7.0 | Demos | DelphiWin32 | VCLWin32 | RibbonControls.

Related topics about ribbon controls:

Integrated Translation Environment/External Translation Manager

ITE and ETM are now available for both Delphi and C++Builder.

The Integrated Translation Environment (ITE) is a part of the IDE that simplifies localizing your projects. ITE can create a new localized project from an existing project. ITE does not automatically translate text, but provides a dialog listing all text that needs to be localized and fields in which to enter the corresponding translated text. Once you have entered the translated text and built the localized project, you can set another language active and display a form in the localized text; you don't have to switch locales and reboot your system. This allows you to perform localization without requiring a localized system.

The External Translation Manager (ETM) is a stand-alone application that works with DFM files and text strings in the source code. Although ETM does not allow you to create a new localized project, it does provide a dialog listing localized text and the translated text, similarly to ITE.

Online Help Changes

Command Help: Help is now available for the commands on the various drop-down menus in the IDE, such as the File menu and Component menu.

  • To display command help, highlight a command in a menu in the IDE, and press F1.
  • To see the help for a command that is not currently enabled or visible, go to the Contents page of the help viewer, and locate Common | Reference | RAD Studio Dialogs and Commands | <menuname> | <commandname>.

Optimizing Your Access to the Online Help: Do you sometimes have frustrating problems when you try to use the online help? See the following article in CodeGear Developer Network for valuable tips about using and customizing the help viewer, setting the filters and other options to control the Index and Search capabilities: Getting the Best Results with RAD Studio Online Help.

Protected API Now in the Help: Protected methods (procedures and functions) and protected properties are now included among the API help topics.

The F1 context-sensitive help dialog now displays RAD Studio results at the top of the list.

See Also