Top 14 (and counting) things to remember about BCB 6
- Borland (now named Embarcadero ) has a developer forum for the product that I have found helpful.
- Files don’t save automatically by default, even when building. Under the Tools menu, correct this by using the Environment Options... and check the indicated checkbox. The IDE does automatically create a backup of every file you edit so if you rely on this feature (you should really be using a source code control system instead) you may not want to auto save. The backup feature can be turned off. It’s under the Tools->Editor Options, under the Display tab. The Eclipse IDE has done the best job I’ve seen with local backups. They keep a user configure number of backups and manage them with a mini SCCS. That way if you don’t check in to to your repository frequently you still can do code compares and rollbacks to this local repository. With the BCB6 feature you can only get back to your last saved file and as far as I can tell there are no automated tools to let you switch back to it or to do comparisons.
- There are several add on tools that can make life easier while using the IDE. Torsten Reindorf (on the aforementioned forum) supplied this list of essential tools for tricking out the IDE
- Essential keyboard/mouse shortcuts
- F12 – Toggle between Form and Code
- Ctrl-j –Bring up the popup for pasting in template code (type a shortcut first like switch(ctrl-j)
- Ctrl-space – force auto complete – this is one of the worst features in BCB6 –it is slow and often doesn’t work, any compile error (like writing a method without putting in the .h file first) tends to completely break it. If you’re used to Visual Studio you just have to suck it up. It’s good for improving your appreciation of everything Zen.
- Ctrl-F6 – or Right-click in text editor and the first option toggles between the source and include file. It appears you can’t have both open at once.
- Ctrl-F7 (Make) does a compile of only the required files. Build (F7) appears to do a full clean build.
- Ctrl-F – the find dialog – The find in all files is particularly useful
- Alt-Up arrow - Find declaration for item under cursor. Alt-down doesn’t take me back to the implementation and I haven’t been able to find a keyboard shortcut that does.
- Form shortcuts – When you have layered items in the form using the down arrow will take you to items behind the first item. Using the Esc key will move you up through the hierarchy of items. Ctrl-arrow keys moves items and Shift-Arrow keys resize them.
- Ctrl-Shift I and U to indent and un-indent blocks of code (no tool for auto reformatting whole module that I could find)
- I could not find a keyboard shortcut for compiling the current unit so I added a button to the toolbar for doing it.
- Getting a quick message box use what appears to be a global method ShowMessage(“put message here”). Good when used for fast debugging. More elaborate dialogs can be done with the MessageBox or MessageDlg class.
- The Project-Options (Alt-F7) (or right click on the project in the Project Manager) will be your friend. When you go to debug make sure to visit the compiler Tab and hit the Full Debug button. On the Directories/Conditionals tab there is a Final Output entry (the .DLL I used inherited this and I got errors when building because the directory didn’t exist). The CodeGuard panel looked interesting and I vaguely remember it could find problems, but when I tried it everything broke. A better thing to enable and explore on a new project.
- Testing the .DLL requires a host application. That is set using the Run->Parameters menu. (Thanks to Remy Lebeau of TeamB for reminding me about this dialog.)
- The IDE doesn’t really integrate well with Lint as far as I can tell. You can add Lint to the tool menu and have it launch in a DOS window. The image shows the settings I used.
// Standard lint options for Borland C++ Builder 6
+fpa // pause before closing the message window
lnt\co-cb.lnt //Tell lint it is the Borland compiler
//You'll usually have your own file here too so that you don't have to litter
//you're source with //lint comments
options.lnt -d_FLAT_ -u_SMALL_ -si4 -sp4
+e900 // always produce at least one line of output
-t4 // Presume that tabs are every 4 stops
//This is an example of how you specify your own folders that contain headers
-wlib(0) //turn off lint for libraries+
- The Borland compiler is very forgiving about a common cut and paste error. If you define a method first and then cut and past the method signature into the header, the compiler won’t complain if you leave the ClassName:: prefix on. However, other compilers do so it’s a good idea to get in the habit of deleting that.
- There doesn’t seem to be any built-in support for using source code control inside the IDE. I use Tortoise-SVN with project locker so I’m just trying to get used to going to Explorer and checking code in from there. I find it easy to forget and I check in much less frequently than I should. It’s also more of a pain when doing code compares. (I know I’m spoiled)
- If you accidentally create an event handler from the form, just ignore it. Return to the form and continue editing. Do not delete the empty handler by hand. If you do you have to also delete the declaration. If you leave it alone (and empty) the next time you compile the IDE will remove the method for you. This is the one feature I wish VS had.
- Debugging – I’ve had some strange problems with Debugging. Sometimes the application just ignores the breakpoints. When you look at the source code the little dots that indicate a line on which a break point can be set are all missing. When that happens I delete all the .obj files and all the files the build process creates. In the case of the current dll that includes the following extensions dll, tds, ilc, ild, ilf, and ils. I then quit the IDE (may not be necessary) and restart it, then do a Build of the application and it seems to cure itself. [Update] You also have to make sure you have debugging enabled. To do this use the Project-Options menu (Alt-F7). In the dialog that appears click on the Compiler tab. Then click on the Full Debug button. Then click OK to dismiss the dialog and do a full rebuild of your project.
- Quick and Dirty Output – In visual studio cout<<”some data” just shows up in the IDE’s console window. I haven’t found the equivalent yet in BCB6 but you can do OutputDebugString(“some data”) and it will show up in the Event Log which you can view via the View->Debug Windows->Event Log (Ctrl-Alt-V)