Delphi IDE Secrets
In this section some secrets of Delphi IDE are listed, discovered by me and other developers. If you have similar ones certain to Delphi IDE (rather then programming tricks), send it to me.
1. To avoid a message Unit xxxxx was compiled with another version of yyyyy, appearing when some standard units are replaced by your own, try following trick: first Build All without such replacement, then do replacement again (e.g. changing paths in Project|Options) and Compile project again.

Advice by Thaddy de Koning.
2. It is possible scroll list view in report style (in KOL - lvsDetail or lvsDetailNoHeader)... using mouse wheel.
3. If you hold down Ctrl key while scrolling text in Delphi IDE with the mouse wheel, text is scrolling much faster - by pages. And if Shift is pressed, the caret is scrolled vertically over text (by one line for each wheel rotation).
4. Do you know, that to shift right or left several (or more) lines of the source in Delphi editor it is sufficient to select those lines and press Ctrl+Shift+I (shift right) or Ctrl+Shift+U (shift left)
(Advice by Kiryuchin E.).
     Shift is done always onto 2 characters (or another, if you changet tab size in the editor). If an odd number of positions required, it is possible to shift lines left onto one (or more) characters deleting a block of text of such width. To select block, just make a selection holding key Alt down (i.e. Alt+Shift+arrow keys). Besides, to leave this selection mode and select text as usual again just click left mouse button anywhere in the text.
     As well as about other useful key combinations, these ones could be found in Delphi help system. But if to know where to search it. At least for me, I could not find it, like about Ctrl+Shift+R (start/stop macros recording) and Ctrl+Shift+P (playing macros recorded).
5. Sometimes in Delphi6 while editing source with Code Completion a bug is occur, when space, caret return and other separators stop functioning in the editor. Usually this effect is appearing just after entering function or procedure name with Code Completion, when a cursor is positioned between automatically inserted parenthesis. To correct this situation, just press Ctrl+Space, and then Escape to abandon a list appeared. Then, normal functioning of the keys affected should restore.
6. Do you know that the Delphi has very useful tool to search place in the source where an error occur, like Access Violation. When a message appear with hexadecimal instruction address, where an error occur, use Delphi IDE menu command Search | Find error (type where $XXXXXX). Note: program should be in debug mode. If it is stopped now, run it (F8), otherwise this menu command is not available.
7. Couple more advices to those of you who makes sometimes mistakes.

7A. If from a start of the application or from some known call an error occur determinatively, but to find it the same line of code should be passed many times (e.g. in loop or in recursive call), it is possible to simplify such error searching (in Delphi5 or higher).
     Set a break point in the line which is executed many times before the error is occur, and change breakpoint properties and set a counter to some big value (e.g. 9999). To do so, press right mouse button on a red circle, marking breakpoint, select in pop-up menu item Breakpoint properties, then go to the field Pass count and enter a number there.

Run the application. When the error is occur, do not reset the application. Istead, find a breakpointed line and move mouse cursor over red dot indicating it. Delphi debugger will pop up a tooltip with counter value showing how much times this line were executed before the error was occur. Now, set this value as new value for break point counter, run the application again, and it is stopped just before an error occur (bot not yet occur). It is now possible to debug step by step and find the error. Certainly, this method can not be applied to undeterminated errors.

7B. If some variable after assigning a desired value, some time later become assigned to another (incorrect) value, and you can not detect which code did this undesireable change, do the following:
- set a break point at the place where a problem variable has correct value;
- add the variable to the Watch list (it is desirable to provide context-independant fully qualified variable name, e.g., Form1.MyArray[4,6], or at all to determine the variable address in the memory and write something like PInteger($123456)^);
- click a line with the value in the Watch list with right mouse button and select pop up menu item Break when changed (line will become red).
- continue execution (F9). At the place where the variable is changed, the debugger stops the execution and you can analyse a stack and understand which your code and in which surcumstances currupted it.

8. Starting from version 5, Delphi has new power debugger tools to stop on a wide range of conditions, which is very convenient sometimes. But this slow down application speed and from the ancient time there is exist more convenient and efficient way to do this. Just write:
  if <some_condition> then 
  asm 
    int 3 
  end;
When a condition is satisfied application is stopped (in the next line of source code) and can be debugged step by step.
9. Sometimes Delphi5 become broking, and though its text editor is visible and Object Inspector can be called (F11) the IDE window itself with toolbar, menu and Component Palette is vanished from screen at all. In this case, even reinstalling Delphi over existing is not useful.
     To solve this: find in the directory \bin a file Delphi32.dsk and delete it.
10. About installing Delpi. Do you know that there are no problems with installing all the Delphi versions on the same PC under all Windows verions at the same time, including all Delphi versions from 1 to 7 (excluding problems with purchasing licenses on all these Delphi versions, certainly).
     While installing Delphi (at least version 5) on localized Windows 2000 a problem could appear, if temporary files directory was located by default on a pth containing non-ASCII cahracter. This almost always were so in Russian Windows 2000, with localized account for Administrator. To solve this problem it is sufficient to set up a directory like C:\Temp as a temporary files directory.
      Also, Delphi5 could not be installed from non-root directory on HDD. To avoid copying all the files to the root of hard disk partition, it is possible to create pseudo-disk. E.g. to enter in command line:

>subst z: d:\path to Delphi distibutive

, and then Delphi can be installed from "disk" z:.
11. The Delphi has some secret options which could be turned on only editing the registry directly:
In the Delphi2 CPU window was not accessible. To correct this, it was necessary to add in the registry:
[HKEY_CURRENT_USER\Software\Borland\Delphi\2.0\Debugging]
"ENABLECPU" = "1"

If to add following lines in the registry:
[HKEY_CURRENT_USER\Software\Borland\Delphi\5.0\Extras]
"AutoPaletteSelect"="1" "AutoPaletteScroll"="1"

then the Component Palette is automatically scrolled when mouse is over it.

Advice by Dimaxx.
12. If you do not turn off XP themes, you can improve a lot the exterior of your Delphi7, Delphi6, Delphi4, Delphi3 and even Delphi2, adding manifest for it. To do so, get any external manifest file (from any application using such kind of manifest), put it into DelphiX\Bin directory and rename it to Delphi32.exe.manifest. Unfortunately, Delphi5 can not be improved such way (it even does not want to run). And for Delphi4, disadvantage is that the main menu becomes black and only current menu item is well viewable.

What the improvement is? In the Delphi IDE editor, its tabs become looking much better, the current tab distincts a lot from its neighbours, and working with many opened files become much easier.

13. When you press F12 while debugging the application, it is stopped with Delphi CPU window. It is possible to press F9 to continue execution.
By Jon: On a Windows NT system, F12 is the default key to break into the debugger. This can be changed in the registry:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug
To set it to the PAUSE key: "UserDebuggerHotKey"=dword:00000013
14. It is possible to increase Delphi IDE starting speed and working speed (at the same time decreasing its memory usage). In IDE menu, select Components | Install Packages, and clear check boxes for packages, which are not necessary for you. Do not remove Delphi Standard Components this way (there will be problems with changing list-like properties in the Object Inspector).

Do this change when there are no projects loaded to set default set of packages for all new projects, and repeat this also for all re-opened projects once (still Delphi stores packages list in project options).

15. When you are designing a package containing some components, it is always possible to rebuild it right clicking the uppermost level node in the small package window (words Conains and Requires. If any other node is selected, Build command is not available in a context menu.
 

Copyright (C) 1999-2006 by Vladimir Kladov