BDS 2006 IDE Tips and Tricks

By: John Kaster

Abstract: See this list of tips and tricks for the BDS (Delphi, C++Builder, C#Builder) IDE

This list of favorite IDE tips and tricks is gathered from the Delphi team's extended members. This is not intended to be an extensive list. The IDE does far more things than are included in this document. These tips are favorites, and sometimes undiscovered tips.

It was fun getting this list together. I sent out an email to the entire team, and asked that they reply directly to David I and myself. Instead, they started replying to everyone on the list, and that's when the fun really started! Even the people working on the team learned new tips and tricks from the email thread, and that prompted more suggestions in a flurry of emails.

I hope you find this list of tips and tricks helpful, and that you become even more productive in the IDE.

Please note: This is a draft version, so I could get it live for our broadcast today. (See The Two Weeks of Delphi/C++Builder for more information.) I'll clean it up and clarify things as soon as I can.

    Keystroke tips

First, we'll cover the many keystroke tips I received.

Keystroke

Description

Ctrl+Alt+P

Select the tool palette, which then allows you to start typing in the name of the component you're looking for, which is instantly filtered.

Ctrl+Click

Ctrl-Click on a breakpoint in the gutter to enable/disable it. I think that functionality is often overlooked.

Ctrl+Shift+I

CTRL+SHIFT+I and CTRL+SHIFT+U to indent and unindent blocks of code

Ctrl+F12

Ctrl+F12 for finding any file in your project or project group fast.

Alt+F7

Alt-F7 and Alt-F8 from the editor to navigate to the previous/next message in the message view (works for compiler errors and find in files results, among others)

Alt+F8

Alt-F7 and Alt-F8 from the editor to navigate to the previous/next message in the message view (works for compiler errors and find in files results, among others)

Ctrl+Alt+F12

Ctrl+Alt+F12 to drop down the list of open files

Ctrl+Shift+R

Ctrl+Shift+R to record and stop recording, Ctrl+Shift+P to play. I'd find life a lot harder without some macro support in the editor.

Ctrl+E

By far the most important function in the whole editor is Ctrl-E (incremental search). (Shortly followed by Ctrl-Shift-I and Ctrl-Shift-U.)

Ctrl+Shift+G

Shift+Ctrl+G to insert a GUID makes a lot of folks happy when they discover it.

Alt+Shift+Arrows

to do column block selection.

Cltr+Shift+K+O

Also if for some reason you don't want to see the code folding you can use Ctrl + Shift + K + O to turn it off.

Ctrl+C

I also really like Ctrl + C, V, X and Z

Ctrl+V

Paste

Cltr+X

Cut

Ctrl+Z

Undo

Ctrl+Shift+B

Buffer List

Ctrl+Shift+M

Select block before - Invoke extract method refactoring

Ctrl+Shift+J

Select block before - Invoke SyncEdit

Ctrl+Shift+W

Find Unit

Ctrl+Alt+P

Move Focus to Tool Palete

Ctrl+K+#

I use Ctrl-K <num> drop a bookmark (Note: Ctrl+Shift <num> also creates or reassigns a bookmark) and Ctrl-<num> to go back to it a lot.

Ctrl+F

Find

Ctrl+Shift+F

Find in Files

Ctrl+R

Invoke Replace Text

Ctrl+Shift+F9

Ctrl+Shift+F9 to run without debugger is kinda neat to if you know you don't want to debug your app this time. (Note: you can also put the "run without debugging" speed button on your IDE toolbar by right mouse clicking and customizing your palette.) Speeds up app launch a lot.

Ctrl+Shift+T

Create a todo entry. I think a lot of people don't use these, but I use them everywhere. Anytime I spot something and think "oh, must remember to change/do that" I put a todo in. my memory sucks, make the IDE remember for you. Additional comment: when making changes I write comments adding date and initials in code to provide a time and person "trail" like // *!*061109JV. This can be worked into the tip from Mal below on CTRL-Shift-T

Ctrl+Shift+Space

to show a parameter list

Ctrl+Shift+C

Invoke class completion, where your method stub is automatically created from your interface. Property getters and setters can automatically be generated. Very powerful keystroke.

Altr+F11

add a project unit to the implementation uses clause

Ctrl+Shift+A

from refactorings to find a unit

Ctrl+Shift+R

toggle the recording of a macro

Ctrl+Shift+P

play back a macro

Ctrl+Shift+Enter

find all occurrences of a variable / procedure etc (call graph) ROCKS

Ctrl+Shift+Up

Ctrl+Shift+Down

For navigating code from one procedure to another

Ctrl+/

This keystroke varies on international keyboards, but this will toggle comments for either the active code line or every line selected

    Mouse tricks

Mouse Click

Description

Middle mouse button

Middle click on a code editor tab closes the tab. Middle mouse click on the code editor lets you scroll by using the mouse a la Internet Explorer.

Drag and Drop

Drag and drop from the editor to the watch view (if you're not currently debugging, you need to use alt-drag from the editor).

Right click

Right click on editor tab and select "Close all other Pages"

Alt+Mouse

I use the column/block cut/paste a lot. Hold down the ALT key and use the mouse to select the text/code block that you want

    IDE tweaks

The configurability of the IDE itself is something that should not be taken for granted.

I have a desktop layout setting saved that I call "MAX CODE" (David has demonstrated this in our replay) so that I can easily swap to and from a screen full of editor so that I can really work through a section of code.

Gerard van der Pol uses an interesting setup where he has all the tabs setup so that you can very quickly swap between different inspectors/views etc.

Use the model view for understanding and discussing existing code and not just new...that is something that lots of people are finding really useful.

Use the audits/Metrics as part of the sign off/hand over process that you agree with your users.

Inplace editing of filenames in the project manager is a very quick and easy way to rename files. It handles file sets too (ie. Pas/dfm pairs)

Live templates in general - everyone should learn how to write these.

But not sure if people have considered the ability to define live templates for other file types, such as sql

The fact that code-insight works in uses clauses.

I love that Debug Inspectors are dockable. Have your object inspector at debug time to!

I always mistype certain words, eg tehn instead of then, etc. Create an auto-invoke live template that triggers off the misspelling, which replaces it with the correct spelling. Suddenly you have Auto-correct for Delphi

The extensibility of the IDE goes without saying. Personally, I could not live without my own "SpeedLoader". It allows me to search partial names of files in my specified paths. Just the eco source is currently almost 600 files/100dirs, and browsing around with the File|Open dialog takes far too much time. Just press Ctrl+Alt+Shift+S and type in a partial filename, press enter and open the file :-) don't forget to add some paths before you start playing... (You can download this from CodeCentral.)

 I love using colour in the IDE to help instantly show where I have done things like forgotten to terminate a string, or used one to many single quotes, also to determine if I am dealing with a number or a float literal.

Another thing that I habitually do with a new install is customize my tool bar, I can never remember where things are in the menu options, but I like to have the toolbar set up where I think things should go.  

And the bds.exe -r switch is often overlooked. To use, just create a new shortcut and modify the command line to pass e.g. -rMyAlternateBDSReg. Then after launching that once, the reg entry is created and they can configure that alternate registry all they want, deleting packages, etc, without worrying about messing up the default install.

There is a hidden feature called sync edit params, and a Visual Studio code template importer. Both of these are described on Adam Markowitz's blog.

    What are your favorites?

Feel free to share you own tips and tricks via the comments for this article. IDE configuration and customization tips are most welcome as well. I hope you've learned some new things from this article to increase your enjoyment of the IDE.

Server Response from: ETNASC03