Chapter 1: Recent IDE Enhancements
Delphi is not just a language, nor just an Integrated Development Environment (IDE), nor just a toolset or programming environment, but all of that and more. Starting in the early 1980s with Turbo Pascal shipping on a single floppy disk, it has grown to be a powerful suite of libraries, tools, connected services, and integrated components that support virtually every computing platform. And as with most technological tools, Delphi is constantly growing, improving, and adding features.
This first chapter will give you a quick recap of all that the IDE encompasses and what new features you may have missed in the last few versions. Some of these are just for convenience, such as quickly locating a unit in Windows Explorer, or jumping to a method with the navigation toolbar. There are visual improvements with high DPI support, a new dark mode, and structural highlighting options. You'll be more efficient with faster loading times, greatly improved Code Insight features, and editor tricks such as bookmark stacks. Finally, you will understand your code better with add-ons, such as Project Statistics and Toxicity Metrics.
You will read about all of these and more in the following sections of this chapter:
- Understanding the Delphi IDE
- Delphi 10 Seattle
- Delphi 10.1 Berlin
- Delphi 10.2 Tokyo
- Delphi 10.3 Rio
- Delphi 10.4 Sydney
Understanding the Delphi IDE
The idea of combining the editing, compiling, and managing of project files within one integrated programming application started way back in the 1970s, but didn't really catch on in the PC arena for quite some time. Borland Pascal, the pre-cursor to Delphi, pioneered many facets of an IDE in the creation of Disk Operating System (DOS) applications and took many of its features and user interface constructs with it to the Windows desktop.
At its core, an IDE needs to assist the developer in managing a software project's many moving parts: editing source code, crafting user interfaces, managing project parameters, compiling the application and resources, testing and debugging, and preparing a deployable application. These vary from language to language, so an IDE needs to understand the tools that it supports very well—and the developers who use it.
Delphi's IDE, like many other modern tools, has a rich code editor with syntax checking and color schemes, resizable window panes, structure and object views, data and source repository connections, and the ability to save various configurations for different needs. Here are the various windows and views you'll find in Delphi:
- Code Editor: The main focal point for writing code.
- Project Manager: Combine files necessary for compiling a project.
- Object Inspector: Access properties and events of components.
- Structure Pane: View and organize components hierarchically.
- Tool Palette: Component list.
- Message Window: Compilation output, search results, and more.
- To-Do List: Parsed TODO comments from the code are neatly displayed here.
- Templates: Macros for expanding frequently typed patterns of code.
- LiveBindings Designer: Visually build data connections between components.
- Class Explorer: Tree view of the classes in the current unit.
- Data Explorer: View data and manage connections from dbExpress or FireDAC sources without leaving the IDE.
- Model View: Manage object models of your data.
- Other Debugger views: Call Stack, watches, local variables, breakpoints, Threads, events, Modules, and CPU windows.
Let's look at some of these in a little more detail.
Like most popular code editors that developers use these days, there is color syntax highlighting, hotkeys for moving code around, bookmarks, class completion, and template expansion. There is a lot of keyboard backward-compatibility in Delphi (even dating back to the old WordStar days) but also a lot of customization to set up the key combinations that work best for you. Classes and methods can be folded (or "collapsed"), and you can create your own foldable regions. Error insight can alert you to syntactical errors in your code as you type.
The Project Manager can contain a single project or a group of projects, and there are buttons to manage aspects of them with ease—as a group or individually. You can determine where compiled objects will be placed, establish host applications to debug modules, and manage multiple platform configurations here. More on this will be covered in Chapter 2, Delphi Project Management.
The Object Inspector allows you to initialize properties and hook up events of components at design time to save you the trouble of having to write all that out in code. If you build custom components, you can publish your own properties and events, which will also show up here. Plus, you can register your own property editors to provide even greater functionality.
The Structure pane is a handy view of elements that changes depending on the context. When you're in the code editor, it shows the list of classes, methods, and used units in the current unit. When you're in the form designer, it shows a tree view of the components on the form that can be rearranged by dragging them with the mouse to a different place on the hierarchy (with some obvious parent-container restrictions; for example, a panel can contain a label, whereas a label cannot contain a panel). Double-clicking one of these elements takes you to that element.
When you're designing a form or data module, you can place items on it from the Tool Palette. This is also context-sensitive, thereby only listing the elements that can be placed on the current form. For example, only FireMonkey components will be available for a FireMonkey form; but database connection components can be placed on a VCL form, a FireMonkey form, or a data module.
When building a project or running other processes, the output will be shown in the Message window. This is often collapsed but expands temporarily at appropriate times. Like most other windows, this pane can be pinned to keep it open and resized as desired. Search results and console application output will show up as tabs here.
The Delphi code editor watches for specific comments that start with
TODO: and builds a list from these found in all the units of your project and shows them in a To-Do List window with a clickable checkbox. This allows you to see all the places in your code where you've marked items you need to finish. By double-clicking on the to-do list item, it will take you to that line in the code. When you are finished with the task, click the checkbox in the to-do list and it will mark it as complete by changing the comment from TODO to DONE. (You can also uncheck an item marked DONE and it will turn the comment back to TODO.)
Live templates (shown in the window pane that is simply titled Templates) can speed up coding considerably. They are code macros that can insert text and allow you to fill in the blanks to complete larger constructs with very few keystrokes. They can be set to automatically expand after a certain sequence of letters are typed or manually activated by hitting Ctrl + J. You can create your own or edit the built-in ones.
Some of the first code templates in Delphi were implemented by the popular free IDE plugin, GExperts (sort of a mix of Code Librarian and Code Proofreader) but other products soon introduced their own version. Live templates were added in Delphi 2006.
We'll talk about the LiveBindings Designer in greater detail in Chapter 6, All About LiveBindings, but as a brief overview, this is a visual way to link data between various entities. For example, a form that displays an edit box to type in a name has to load the value from somewhere and also save it when the user is done. Typing code to load and save such elements can become quite tedious. This lets you do it visually.
The Class Explorer (not shown in the previous screenshot) is similar to the Structure pane when viewing code in that they both show a tree view of classes. But while the Structure pane shows more than just classes, it has few options for actually dealing with the classes. That's where the Class Explorer shines—it allows you to view and manage methods, fields, and properties of classes with the mouse. Think of it as a simplified version of ModelMaker Code Explorer if you've ever used that product.
The IDE allows you to save the arrangement of these panes as desktop profiles. You can have several desktop profiles and use different ones for different projects. You can select one to be the default for standard editing and another as the default for debugging—the IDE will automatically switch to the debug desktop when you start an application and switch back to the default one when it's finished.
Here's an example of what the IDE could look like while debugging:
As you can see, the Delphi IDE is center-stage in the development process of creating and managing Delphi projects. Since no two developers work the same way, its flexibility, customization, and the wide variety of built-in tools help make this environment a powerful tool.
Now that you've had a glimpse of what the IDE is, let's step back a few versions, highlighting some of the changes it has undergone.
Delphi 10 Seattle
The Delphi XE series broke ground in many ways, not least of which was the FireMonkey GUI to support mobile devices. Updates were fast and furious, and some complained it was hard to keep up with them. XE8 was the last of this line and introduced a new Welcome screen that has carried through to the current version. Delphi 10 Seattle started the "10" series in August 2015 and was named, at least in part, to coincide and align itself with Windows 10.
There weren't any ground-breaking IDE features introduced in the first of the Delphi 10 series, but several important improvements were made in project loading speed, support for large project groups, and high DPI support, especially notable when working with forms at different DPIs. Several menu items were moved for better organization and simplification, and an Editor submenu was added to contain the editor's context menu items. The nicest new feature of the IDE was a convenient Show in Explorer menu item, which will open File Explorer for a file or folder in the Project Manager, as shown:
If you ever purchased the Castalia for Delphi suite of IDE tools from TwoDesk Software, you may recall several nifty features that they added to Delphi. Embarcadero had just acquired Castalia and quickly incorporated many of those features into the editor. These include the following:
- MultiPaste: Pops up a window allowing you to add text before and after each line before pasting (really handy for copying SQL or HTML into your code).
- Project Statistics: Informs you of the time spent in various parts of the IDE, such as designing and editing.
- Navigation Toolbar: A nice way to view and jump to files in the project and sections within the file.
- Sync Prototypes: Make a change to the parameters in the declaration of a class method and it applies those same changes to the implementation.
- Structural Highlighting: Draws lines in the editor to visually depict blocks of code.
- Smart Keys: Adds editor shortcuts, including a fast way to surround code with braces and parentheses.
Other additions included are the following:
- Automatic recovery of files if the IDE crashes while editing
- Being able to change the font size quickly with Ctrl + Num+ and Ctrl + Num-
- The ability to enable High-DPI Awareness in your VCL application
- Several improvements to the Object Inspector, structure view, and the Select Directory dialog
- A new option to hide non-visual components
- Improved memory management allowing the IDE to use up to 4 GB of RAM (up from 2 GB previously)
- Better support for importing old projects even as far back as Delphi 1
Finally, there were several mobile enhancements, as well including a new Android Service project type, background execution on iOS, and an option to allow iOS 9 applications to access non-SSL URLs.
Delphi 10.1 Berlin
The IDE for Delphi 10.1 Berlin released in April 2016 had quite a few enhancements. In all previous versions of Delphi, units with forms shared the same IDE window—you had to switch between code and form design mode. Finally, in Delphi 10.1 Berlin, using an Embedded Designer is now an option in the Form Designer section of the Tools | Options dialog. Switching this option off allows you to move a floating window for both the VCL and FireMonkey form designers separately from the code editing window.
FireUI Live Preview is an amazing new tool that gives FireMonkey application designers the ability to preview and debug their user interfaces in real time on remote devices. The IDE acts as a "client" that communicates with a Platform Assistant Server you need to install on the target device, which connects over a local network or a connected USB cable. The server capability is built into the Windows IDE, and PAServer for Windows, Linux, and OS X is included with the Delphi installation. Details on setting this up will be explained in Chapter 4, Multiple Platforms, One Code Base.
GetIt Package Manager was introduced a few versions back and allows quick access to open source, trial, and commercial components, program templates, and styles. In Delphi 10.1 Berlin, the Project Options dialog window gained a new section called GetIt Dependencies. Here, you can check off one or more GetIt packages that are used in your project. Then, when you open a project where one or more of those marked GetIt packages are not installed, you'll get a message that the project has dependencies that are not installed.
If any of these dependencies are not installed when you try to build your application and you get an MSBuild error stating the GetItCmd task failed unexpectedly, you need to add an environment variable (Tools | Options | Environment Variables): New Variable: Name = "
BDSHost" and Value = "
If you ever purchased the Castalia for Delphi suite of IDE tools from TwoDesk Software, you may recall several nifty features they added to Delphi. Embarcadero acquired Castalia in 2015 and has incorporated many of those features into Delphi 10 Seattle, as previously noted. One of my favorites is bookmark stacks. This allows you to drop a temporary bookmark in your code, go to another section of code, or even another file, then recall the temporary bookmark to jump right back to where you were coding, cleaning up the temporary bookmark. However, you may want to customize the default keys for this as it uses a difficult key sequence to drop (Ctrl + K and Ctrl + G) and pick up (Ctrl + Q and Ctrl + G) the bookmarks.
In the Delphi 10.3 Rio section, you'll learn about the Navigator plugin that has been added that provides nice keyboard shortcuts for this feature.
If you're most efficient when keeping your hands on the keyboard, you may really like Selection Expansion. This allows you to click Ctrl + W in the code, and with repeated clicks of Ctrl + W, expand the selected text to increasingly larger code blocks, starting with the current identifier and moving up to statement, line, block, method, and so on.
There's a new menu item under Projects called Method Toxicity Metrics that gives you statistics about the procedures and functions in the active project and that may indicate good candidates for refactoring. You can export these metrics and customize thresholds under Tools | Options | Toxicity Metrics.
Other improvements include more support for Android services, Android smart watches, iOS ad hoc applications, CPU view support for iOS and Android, a new File Associations page on the Options window, and the ability to show or hide the Navigation Toolbar. Finally, the IDE is now DPI-aware.
Delphi 10.2 Tokyo
The frequency of updates finally started slowing back to a reasonable pace with the release of Delphi 10.2 Tokyo in March 2017, and a long-anticipated feature request finally made it into the second release 9 months later: a dark theme! While you could change the colors of many of the IDE components in previous versions (and, in fact, there were "dark themes" already available in the popular Delphi Theme Editor), they mostly affected the code editor—the core of the IDE was still based on the typical Windows standard look with a white background. With the dark theme enabled, menus, dialogs, edit boxes, and more are themed around a dark set of colors, which many people find reduces eye strain when working at a computer for long hours or late at night when there's less light. If you want to switch themes for different hours of the day, it's a quick mouse click from the desktop toolbar:
The third release of Delphi 10.2 improved both the light and dark themes with cleaner lines and aligned controls. Several items in the Options box were moved for better categorization and the whole interface became more readable. The currently focused area was made more prominently displayed and some window panes were renamed:
The preceding screenshot shows how the IDE looks in dark mode.
Delphi 10.3 Rio
In November 2018, the first release of Delphi 10.3 Rio was made available. Besides improvements in themes, cleaner lines, aligned controls, better tab-readability, and clearer window focus changes, there were no major changes to the IDE in any of the three releases of Delphi 10.3 Rio. That's not to say this was not a significant version, as there were several language and library features added, which we will cover later.
One nice improvement can be seen in the New Items list (from the menu, go to File | New | Other). It changed to present a scrollable list of items with full descriptions and larger icons and titles giving more information about what you're about to create. Some items are now in multiple categories, such as the FireMonkey Metro UI application, which is in both the Multi-Device and the Windows categories. These are great aids in helping you find the item you want.
The categories in both the general and project options have been reworked, with some new ones introduced and others moved around. For general IDE options, this has shortened the list, but more importantly, the full list of categories is no longer fully expanded, making it much more manageable. One big change to the recategorization is that the Delphi section (with library paths and Type Library options) has been pulled out of Environment and is now under its own Language category (which actually makes much more sense).
Finally, some speed enhancements have been made, including loading forms with LiveBindings.
There were a couple of nice IDE plugins added to GetIt Package Manager that should be mentioned: Bookmarks and Navigator. Both of these were acquired by Embarcadero from Parnassus.
Bookmarks extends Delphi's bookmark stacks feature introduced in 10.1 Berlin with unlimited temporary bookmarks and much more convenient hotkeys (F2 to set, and Esc to pop back and remove), along with a dockable window to list them within context.
Navigator provides a hotkey (Ctrl + G) that pops up a list of quick places you might need to jump in your code, such as the interface Uses section or the declaration for a field. With a few keys of incremental search or a couple of down arrows, you can hit Enter to go there immediately, then after you're done and want to get back to where you were, simply hit Esc! It's a beautiful marriage with the Bookmarks feature. But wait, there's more! Additionally (and optionally), Navigator also provides a resizable mini-map of your code on the right-hand side of the code editor that not only gives you a glimpse of where you are in the current unit but also allows you to click and drag to view a different portion of the unit without changing your current cursor position.
One important note before we move on to the latest version of Delphi is that the Integrated Translation tools will no longer be improved and developers are warned to migrate to a different set of translation tools if they are being used.
Delphi 10.4 Sydney
After 2 years of updates to the previous version of Delphi, 10.4 Sydney was finally released in May 2020. One important change for this version is that it now requires a 64-bit version of Windows 10. Running the IDE is no longer supported on any prior version of Windows (what this means is that while it might be technically possible to install Delphi 10.4 on an earlier 64-bit version of Windows, it is not recommended and you may encounter problems in some aspects of working with it—you have been warned!). For most developers, this won't require a new computer but it is a big step for the IDE—even though at its core, it is still a 32-bit application!
You can still target 32-bit operating systems of Windows, but 32-bit macOS and iOS devices have been removed (although when using the iOS simulator, it's still 32-bit). Android 64-bit and 32-bit devices are supported for the Android API versions 6 through 10.
Delphi 10.4 is now only supported on 64-bit Windows 10:
Here's a list of target devices supported by Delphi 10.4:
One significantly improved feature is Code Insight. This is a set of useful typing helpers in the code editor and includes Code Completion, Code Parameter Hints, Code Hints, Block Completion, Help Insight, Class Completion, Error Insight, and Code Browsing. Often, parts of it are disabled because it can slow down coding, especially on large projects or slow machines as it precompiles and looks up identifiers in related units to help you type faster and catch errors on the fly.
In Delphi 10.4, these tools have been off-loaded from bogging down the editor to a separate server process that communicates with the IDE asynchronously using a Language Server Protocol (LSP). The Code Insight settings are now defined per language in the Options windows. What's more is that Code Insight now also works while debugging!
Reporting bugs must be done manually now. If you get an IDE exception, you can save the error report to a file, then go to https://quality.embarcadero.com and submit a problem discussion, along with the saved error report.
If you have ever gotten tired waiting for the Options screen to open, you will be happy to know that it opens faster now. There's a constructor for each page, which is now delayed until the page is shown.
Scrolling in GetIt Package Manager has been greatly improved with a single tweak. The list position now stays on the item just installed, so you can immediately go to the next one in the list instead of scrolling back down from the top as in previous versions. This was a great annoyance when installing a long list of styles.
There are three new convenience features in Delphi 10.4's code editor status bar:
- Syntax Highlighter: If you work in multiple languages, the syntax checker for the current language is displayed and you can click it and switch to a different language. This supports more than just Delphi and C++. The IDE might become your default editor to work on SQL, PHP, INI, CSS, HTML, and other supporting files, centralizing your editing tasks:
- File Encoding: Your current file's encoding is now displayed and can be changed. This could be quite handy when working with XML files—another aid to keep all your files in the IDE:
- Font size: There's now a trackbar in the status bar with increase/decrease buttons to allow you to adjust the font size. Clicking Ctrl + Num+ and Ctrl + Num- still do the same thing:
Another notable change is that the clipboard history (added in Delphi 10 Seattle as part of the Castalia integration) has been removed, partially for security reasons and partially because if you copy very large amounts of data to the clipboard, it could potentially crash the IDE.
- Creating new projects, opening existing ones, and links to Platforms and Extensions Manager and GetIt Package Manager
- Favorite and recent project listings
- YouTube Video Channel
Here is what it looks like:
If this is still too much, you can modify the web page and take out what you feel is unnecessary. The Welcome page is simply a local web page in your Delphi installation's
Welcomepage folder. Choose the subfolder for your language (for example,
en for English) and make sure you run your editor as Administrator if Delphi is installed under the standard
There are several other minor improvements in speed and control-painting and placement, in addition to several bugs fixed. The IDE now uses native VCL controls, which resolves a few display issues.
In this chapter, we reviewed everything Delphi's IDE has to offer, then, after touching on the XE series, highlighted the improvements in Delphi versions 10 Seattle, 10.1 Berlin, 10.2 Tokyo, and 10.3 Rio, and finally covered the major enhancements to the newest version of Delphi, 10.4 Sydney.
The Delphi IDE is a powerful developer tool and grows in capability with every version. As technology continues to evolve, the feature set changes accordingly to embrace the software build processes for today's complex needs and the plethora of devices to support.
With a thorough knowledge of the IDE comes increased productivity through efficient use of the keyboard, proper window placement, customized colors and fonts, handy tools, and useful add-ons. Those who take the time to develop proficiency in this toolset will be valuable assets to their employers and clients as they build great products.
Now we're ready to use this tool as we create projects of all kinds. Keep reading to learn about the possibilities!
- What is the difference between the Structure pane and the Class Explorer?
- How can the IDE help locate a project file in Windows Explorer?
- Where are auto-recovery files saved?
- How do you hide non-visual components?
- When should you add GetIt dependencies?
- Can you quickly switch between light and dark modes?
- What is LSP?
- What's new in Delphi 10 Seattle: http://docwiki.embarcadero.com/RADStudio/Seattle/en/What's_New#IDE
- What's new in Delphi 10.1 Berlin – IDE: http://docwiki.embarcadero.com/RADStudio/Berlin/en/What%27s_New#IDE
- What's new in Delphi 10.2 Tokyo – IDE: http://docwiki.embarcadero.com/RADStudio/Tokyo/en/What%27s_New#IDE
- What's new in Delphi 10.3 Rio – IDE: http://docwiki.embarcadero.com/RADStudio/Rio/en/What%27s_New#IDE
- New Delphi features: http://docwiki.embarcadero.com/RADStudio/Sydney/en/What's_New#IDE
- FireUI live preview http://docwiki.embarcadero.com/RADStudio/Rio/en/FireUI_Live_Preview
- Delphi 10.4 Sydney – key IDE enhancements: http://docwiki.embarcadero.com/RADStudio/Sydney/en/What%27s_New#Key_IDE_Enhancements
- Code Insight and LSP: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Code_Insight_Reference
- Embarcadero acquires Castalia: https://www.embarcadero.com/press-releases/embarcadero-acquires-castalia-and-usertility-from-twodesk-software
- DPI-Awareness: https://docs.microsoft.com/en-us/windows/win32/win7appqual/user-interface---high-dpi-awareness
- Dark theme arrives in Delphi 10.2.2: https://community.idera.com/developer-tools/b/blog/posts/new-in-10-2-2-dark-ide-theme
- Delphi Theme Editor: https://github.com/RRUZ/delphi-ide-theme-editor/
- IDE Fix Pack: https://www.idefixpack.de/
- Bookmarks and Navigator: https://parnassus.co/bookmarks-and-navigator-acquired-by-embarcadero/