At GDK Software we have been working with Delphi for years. We have collected quite a few tricks and tips, which I would like to share with you. I have organized Delphi’s tips and tricks into the following topics:
As a Delphi developer, you are working with the Delphi IDE on a daily basis. And although the Delphi editor works fine by itself, with the following plugins you can make your work even easier:
GExperts adds some very useful features to Delphi, such as Grep Search
Alt + Shift + S, Procedure List
Ctrl + G, Rename Componenten and other very handy shortcuts (see the shortcut section for more).
We love DDevExtensions for the Find Unit/Use Unit replacement dialog (
Alt + F11). The default Delphi Use-Unit dialog only shows the files from the project group. DDevExtensions replaces the dialog with one that not only shows the project group files but also all files that the compiler can see. Never again navigate to the uses section and insert a unit by hand, just hit Alt-F11.
DDevExtensions also prevents the IDE from storing the ExplicitWidth and ExplicitHeight properties to the DFM.
Delphi IDE Fix pack
The IDE Fix pack optimizations let the IDE start faster, open projects faster, optimizes the compiler’s file search algorithm, makes CodeInsight, the actual compilation and the debugger faster.
Parnassus Bookmarks replaces the IDE’s inbuilt functionality with new, improved navigation. Bookmarks are saved so that after a restart the bookmarks are still available. Installation can be done via the GetIt package manager.
IDE Shortcuts are the easiest way to speed up development. Most of us undoubtedly know the most important shortcuts in Delphi, but let’s share which ones we use regularly.
Ctrl + Shift + <Number>and use it with
Ctrl + <Number>.
Ctrl + Shift + Arrow upor
Ctrl + Shift + Arrow down.
Alt + Shift + S.
Ctrl + G
Alt + F11to add a unit to your code (use with DDevExtensions).
Alt + C. Despite this not being a specific Delphi suggestion, I still want to share this. If you only want to use one of these tips, let it be this one.
Other popular shortcuts are::
Ctrl + Sand save all:
Ctrl + Shift + S
Ctrl + F9and build:
Shift + F9
Ctrl + F2
Shift + F11
Ctrl + Shift + C(i.e. create the methods in the implementation section)
Ctrl + Shift + V
Ctrl + Shift + D(same as V, but instead of the local variable you’ll end up with a class variable)
Ctrl + Shift + E
Ctrl + Enter(when your cursor is on a unit name). Faster than
Ctrl + click, but only works if Delphi can locate the unit
Ctrl + Alt + Z(GExperts)
Ctrl + Shift + M
Ctrl + Alt + Shift + P
Live Templates (or Code templates, as they were formerly called) are a very useful feature of Delphi. Since Delphi 3 these templates are present in Delphi, but we still see that this handy feature is undervalued. Most developers are familiar with the code completing of
while, where the structure of the statement is created automatically.
But with Live Templates you can automate much more. If you want to see a list of the available Live Templates, you can use the shortcut Ctrl + J.
The more you can automate, the better it is. That’s why it is recommended to create your own live templates for frequently used code within your program. This can easily be done via File -> New -> Other -> Code Template. For more information about the structure of the templates, you can find more information on the wiki of Embarcadero.
Delphi has been around for more than 25 years now. It is therefore impossible to put all possible tips and websites on this page. Below I will list some links to frameworks, tools or code libraries that we at GDK Software regularly use.