Athena

Undocumented Settings For Delphi, Kylix and C++Builder

If you find useful information here please consider making a donation. It will be appreciated however big or small it might be and will encourage Brian to continue looking for undocumented features in future Borland products.


Modifying registry entries

To modify Delphi registry entries, launch a copy of RegEdit.Exe and navigate down through this path off the HKEY_CURRENT_USER root key: Software\Borland\Delphi\5.0, substituting the appropriate version number. In the various keys below the main Delphi root, you may need to add new keys, if the specified key does not exist. You may also have to create new values. Menu items off the Edit menu allow you to do both of these things.

As an alternative to using the Registry Editor application, you could compile and run the helper application shown in Listing 1 which uses an .INI file (with the same name as the application, in the same directory) containing information about registry entries to change.

Listing 1: A program to set registry settings with

program RegTweak;

uses
  Registry,
  IniFiles,
  SysUtils,
  Forms,
  Dialogs,
  Controls,
  Classes;

type
  TDataType = (dtString, dtInteger, dtBool);

var
  Reg: TRegistry;
  Ini: TIniFile;
  IniName, DataTypeStr, Entry: String;
  DataType: TDataType;
  Sections, Entries: TStrings;
  Loop1, Loop2: Integer;

begin
  IniName := Application.ExeName;
  IniName := Copy(IniName, 1, Length(IniName) - 3) + 'INI';
  Ini := TIniFile.Create(IniName);
  Sections := TStringList.Create;
  Entries := TStringList.Create;
  Reg := TRegIniFile.Create;
  try
    if MessageDlg('Update registry with INI file settings?',
      mtConfirmation, [mbOK, mbCancel], 0) = mrOk then
    begin
      Ini.ReadSections(Sections);
      for Loop1 := 0 to Sections.Count - 1 do
      begin
        Entries.Clear;
        Ini.ReadSectionValues(Sections[Loop1], Entries);
        //Identify target registry entry type
        DataTypeStr := Entries.Values['Type'];
        DataType := dtString;
        if DataTypeStr <> '' then
          case UpCase(DataTypeStr[1]) of
            'I': DataType := dtInteger;
            'B': DataType := dtBool;
            'S': DataType := dtString;
          end;
        //Open the key
        Reg.OpenKey(Sections[Loop1], True);
        try
          //Set each entry
          for Loop2 := 0 to Entries.Count - 1 do
          begin
            Entry := Entries.Names[Loop2];
            //Skip the data type entry
            if UpperCase(Entry) <> 'TYPE' then
              case DataType of
                dtString: Reg.WriteString(Entry, Entries.Values[Entry]);
                dtInteger: Reg.WriteInteger(Entry,
                  StrToInt(Entries.Values[Entry]));
                dtBool: Reg.WriteBool(Entry,
                  UpperCase(Entries.Values[Entry]) = 'TRUE');
              end
          end
        finally
          Reg.CloseKey
        end
      end
    end
  finally
    Sections.Free;
    Entries.Free;
    Reg.Free;
    Ini.Free
  end
end.

Automatic Component Palette Operations

There are a couple of undocumented registry entries that affect the Component Palette in Delphi 4 and later.

One allows a page of the Component Palette to be selected by simply moving the mouse over the tab (you do not have to click it). The other one allows hidden components on a Component Palette page to be easily scrolled into view by moving the mouse over either the left or right palette scroller. Note that this is not to do with the scrollers that scroll the tabs into view, but the ones that appear on the Component Palette itself when there are more components than can be displayed.

In the Extras key off your Delphi version's root key you need to create two string values with Edit | New | String Value. These should be called AutoPaletteSelect and AutoPaletteScroll respectively, and should both be set to a value of 1. The next time you start your copy of Delphi, the features will be enabled. To disable them, change the values to 0.

A suitable RegTweak.Ini file for the RegTweak application can be seen in Listing 2. The registry path below HKEY_CURRENT_USER is specified as a section heading. The type of all the entries in the section is indicated by the Type entry (this can be S for string, B for Boolean or I for Integer). The rest of the section contains the entries that should be added to the registry.

This idea of showing a section from this .INI file will also be used for all the other undocumented registry entries. Of course registry entries can already be ably described with .REG files, however their layout is more difficult to read than this .INI file.

Listing 2: An .INI file that will work with Listing 1

[Software\Borland\Delphi\5.0\Extras]
;Delphi 4.0 and later
Type=S
AutoPaletteSelect=1
AutoPaletteScroll=1

WYSIWYG font name in the Object Inspector

Delphi 5 updated the Object Inspector so that it can give visual feedback on certain properties (such as Color, Cursor and ImageIndex).

One visual property that does not give immediate feedback, however is the Font property’s Name sub-property (each font name is shown in a fixed font). This is because Windows installations have a tendency to include many, many fonts. As a consequence, any WYSIWYG view of all the available fonts will mean that all fonts would be loaded into, potentially taking quite some time (and resources).

But, if you want to see how it looks, you can enable WYSIWYG font name display by adding the section in Listing 3 to the INI file from Listing 2. Alternatively, you could just add the key entry line from Listing 3 into the section in Listing 2 if you prefer.

Listing 3: Making WYSIWYG Font properties

[Software\Borland\Delphi\5.0\Extras]
;Delphi 5.0
Type=S
FontNamePropertyDisplayFontNames=1

This entry only seems to work in Delphi 5. Kylix and Delphi 6 ignore it.

WYSIWYG font names

Object Inspector property value colour

This one works in all versions of the IDE up to Delphi 5. The Object Inspector shows property names in black and values in blue by default. If you want the property values to be displayed in another colour, you can do so.

In Delphi 1 you must edit the Delphi.Ini file in the Windows directory. The setting goes in the Globals section, which many not exist. The entry is called PropValueColor and its value is a colour value. This can be any constant that would work as a value in a Delphi program, so both $0000FF and clRed would be acceptable (see Listing 4).

Delphi 6 supports customising all the colours used in the Object Inspector in the environment options dialog on the Object Inspector page, so this setting is redundant from Delphi 6 onwards.

Listing 4: Changing the property value colour in Delphi 1

[Globals]
PropValueColor=clRed

In 32-bit versions of the IDE, you need to add this entry to the Globals registry key. The RegTweak program (Listing 1) can do this with a new section in its .INI file as shown in Listing 5.

Listing 5: Changing the property value colour in 32-bit Delphi

[Software\Borland\Delphi\5.0\Globals]
;Delphi 2.0 and later
Type=S
PropValueColor=clRed

A custom property value colour for the Object Inspector

IDE tooltip colour

Delphi 1, 2 and 3 and C++Builder 1 all allow you to change the colour of the IDE tooltip. Whilst it defaults to that dull yellow colour ($80FFFF in Delphi 1 or clInfoBk in 32-bit Delphi) you can change it with another entry in the Globals section. Listing 6 shows the change to make to the Delphi.Ini file and Listing 7 shows what to add to RegTweak.Ini.

Listing 6: Changing the IDE tooltip colour in Delphi 1

[Globals]
HintColor=clAqua

Listing 7: Changing the IDE tooltip colour in Delphi 2 and 3 and C++Builder 1

[Software\Borland\Delphi\3.0\Globals]
;Delphi 2.0 and 3.0
Type=S
HintColor=clAqua

A custom tooltip colour

Code Insight errors

The message view (where compiler errors are displayed) normally shows errors only when you ask for an explicit compilation. However, every time the Code Parameters or Code Completion parts of Code Insight (from Delphi 3 onwards) kick in, they do background compilation to get the information they require to display.

If you have an error further up the source file you are in, or maybe in another source file, Code Insight will not do anything, as it will not have compiled enough information. To be made aware when these things happen, set the registry entry as described in the RegTweak.Ini file section in Listing 8.

Listing 8: Enabling the display of Code Insight compilation errors

[Software\Borland\Delphi\5.0\Compiling]
;Delphi 3.0 and later
Type=S
ShowCodeInsiteErrors=1

No Debug Window Shortcuts

In Delphi 4 and later, the debug window options available under the View | Debug Windows all have shortcuts involving Ctrl+Alt, e.g. Ctrl+Alt+W for View | Debug Windows | Watches.

Many Windows users have desktop shortcuts set up, which will default to also using Ctrl+Alt shortcuts. You can therefore easily get ambiguity. For example, you may set up Microsoft Word to launch through Ctrl+Alt+W. In Delphi, you might press Ctrl+Alt+W for the watch window, but you would instead get Word popping up onscreen.

Additionally certain international characters are inserted using Ctrl+Alt shortcuts, e.g. Ctrl+Alt+E, Ctrl+Alt+I and Ctrl+Alt+O give é, í and ó respectively. Removing these shortcuts from the offset will avoid you getting erroneous applications launched instead of debug windows displayed.

The RegTweak.Ini section is shown in Listing 9. However, strictly speaking this setting is not undocumented, as it features in the README.TXT file of Delphi 4 and later.

Listing 9: Disabling the Ctrl+Alt+letter shortcuts for the debug menu items

[Software\Borland\Delphi\5.0\Editor\Options]
;Delphi 4.0 and later
Type=S
NoCtrlAltKeys=1

With this setting the debug menu changes from this:

The default setting with Ctrl+Alt shortcuts

to this:

The Ctrl+Alt shortcuts have been disabled

CPU window

A CPU window (with full machine disassembly and register views) was formally introduced in Delphi 4, but it existed in Delphi 2 and 3 as well. However, the CPU window in Delphi 2 was very primitive, consisting solely of a disassembly view.

To make the View | CPU Window visible in Delphi 2 or 3, use the RegTweak.Ini section shown in Listing 10.

Listing 10: Enabling the CPU window in Delphi 2 or 3

[Software\Borland\Delphi\3.0\Debugging]
;Delphi 2.0 and 3.0
Type=S
EnableCPU=1

Attach to Process Menu

Whilst C++Builder 4 and later and also Delphi 5 and later have a documented menu item for attaching to a running process (which frankly works best under Windows NT), Delphi 4 has the same menu item available, but only after setting an undocumented registry entry.

With the entry (as described in Listing 11) enabled, a Run | Attach to Process... menu item will be visible the next time you start Delphi 4.

Listing 11: Enabling the Attach to Process menu item in Delphi 4

[Software\Borland\Delphi\4.0\Debugging]
;Delphi 4.0 only
Type=S
Enable Attach Menu=1

Editor default height/width

When the IDE starts a new project, it chooses a default editor width and height (unless a default desktop has been saved). If you want to specify a different default height and width for the editor, you can do so either by setting up some kind of saved desktop (either a default project desktop, or a global desktop in Delphi 5 or later) or by setting up a pair of registry entries in products earlier than Delphi 4.

As usual, a suitable section from RegTweak.Ini can be found in Listing 13, but a section from Delphi 1’s Delphi.Ini is also shown in Listing 12.

Listing 12: Setting a new default editor height and width for Delphi 1

[Editor]
DefaultHeight=614
DefaultWidth=805

Listing 13: Setting a new default editor height and width for 32-bit Delphi

[Software\Borland\Delphi\3.0\Editor]
;Delphi 2.0 and 3.0
Type=S
DefaultHeight=614
DefaultWidth=805

Component Template directory

If you are a big user of Component Templates (those reusable collections of components with custom properties and event handlers that were introduced in Delphi 3), you can direct the IDE into locating the file where they are stored elsewhere.

Component Templates are all stored in one file, whose name depends on the product and version you are using. Delphi 3 and 4 use Delphi32.DCT, but Delphi 5 and later use Delphi.DCT. C++Builder 3 uses BCB.DCT, but C++Builder 4 and later use C++Builder.DCT. Kylix uses delphi.dct.

By default, these files are in the corresponding product’s BIN directory, apart from Kylix, which stores it in ~/.borland. If you wanted to share one of these files among several developers, you might want to locate the file on a network drive. Listing 14 shows a RegTweak.Ini section that will do it in Delphi 4 and later (Delphi 3 and C++Builder 3 endeavoured to support this feature but it was badly implemented and did not work).

Listing 14: Specifying a new location for component templates

[Software\Borland\Delphi\5.0\Component Templates]
;Delphi 4.0 and later
Type=S
CCLibDir=C:\Shared

Personal settings directory

The final setting in this section is the personal settings directory. This setting is intended for use when Delphi or C++Builder is installed on a network and there is more than one person using it, or on a single machine with several people logging in and using it.

Under normal circumstances, each person that used Delphi would update the single set of files in Delphi’s BIN directory. In order for each person’s preferences to be maintained, they can create a personal settings directory under the main Delphi directory.

Then the appropriate registry (or INI file) entry can be made to point towards this directory (see Listing 15 and Listing 16).

Listing 15: Specifying a personal settings directory in Delphi 1

[Globals]
PrivateDir=c:\Delphi\User1

Listing 16: Setting a personal settings directory in 32-bit Delphi

[Software\Borland\Delphi\5.0\Globals]
;Delphi 2.0 and later
Type=S
PrivateDir=C:\Delphi5.0\User1

Each personal settings directory should have the appropriate files from Table 12 copied into it from the relevant product’s BIN directory, if they exist (many of them won’t). The files will then be used from your private directory. You can also get Component Templates stored in this directory with the previous registry entry described above.

Note that Kylix also supports this setting in its configuration file, much like Delphi 1. However, there is almost no point using it, since Kylix makes a personal directory for storing your settings in anyway (~/.borland).

Table 12: Files for the personal settings directory

FileProductPurpose
defproj.optDelphi 1 onlyDefault project options for the IDE
delphi.dmtDelphi 1 onlyThe file used to store menu templates
delphi.dskDelphi 1 onlyThe default project desktop file
delphi.hdxDelphi 1 and 2 onlyThe MultiHelp index file
defproj.dofDelphi 2 and laterDefault project options for the IDE
delphi32.dmtDelphi 2 and laterThe file used to store menu templates
delphi32.dskDelphi 2 and laterThe default project desktop file
delphi32.dciDelphi 3 and laterThe text file used to store Code Templates
defproj.cfgDelphi 4 and laterDefault project options for the command-line compiler
oh.exeDelphi/C++Builder 4 and laterThe OpenHelp executable
oh.iniDelphi/C++Builder 4 and laterThe OpenHelp settings file
bcb.dmtC++Builder 1 and laterThe file used to store menu templates
bcb.dskC++Builder 1 and laterThe default project desktop file
default.bprC++Builder 1 and laterDefault project file
ilink32.dllC++Builder 1 and laterIncremental linker
openhelp.exeC++Builder 3 onlyThe OpenHelp executable
openhelp.iniC++Builder 3 onlyThe OpenHelp settings file
bcb.dciC++Builder 3 and laterThe text file used to store Code Templates
bcb.bcfC++Builder 5 and laterEditor formatting configuration file
convrtrs.txtC++Builder 5 and laterXML converter configuration
default.bmkC++Builder 5 and laterDefault application makefile
deflib.bmkC++Builder 5 and laterDefault library makefile
ibm-1252.cnvC++Builder 5 and laterXML converter
defproj.confKylix 1 and laterDefault project options for the command-line compiler
defproj.kofKylix 1 and laterDefault project options for the IDE
delphi.dctKylix 1 and laterThe Component Templates file
delphi.deskKylix 1 and laterThe default project desktop file
delphi60dciKylix 1 and laterThe text file used to store Code Templates
delphi60dmtKylix 1 and laterThe file used to store menu templates
delphi60droKylix 1 and laterThe Object Repository settings
*.dstDelphi/C++Builder 5 and later, Kylix 1 and laterGlobal desktop files

Note that Code Templates were introduced in Delphi 3 and are invoked by Ctrl+J They are edited on the Code Insight page of the environment options dialog in Delphi 3 and 4, or of the editor options dialog in Delphi 5 and later. They allow you to insert common snippets of code straight into the editor from a popup list.

Also note that menu templates are available from the Menu Designer’s context menu. You can save common menu layouts and retrieve them when designing other menus.

This particular registry entry is not strictly undocumented, as it is mentioned in an Open Tools API source file. The comments preceding the TPropertyEditor class in the DsgnIntf.pas unit describe this registry entry when explaining the PrivateDirectory property. The online help for the PrivateDirectory property also describes the setting.

IDE internal command lines

You can ask C++Builder 5 and later to show you all the command-line options it uses when compiling each file and linking each project. Listing 17 shows a RegTweak.Ini section that does the job.

Listing 17: Asking C++Builder to show options used for compiling/linking

[Software\Borland\C++Builder\5.0\Compiling]
;C++Builder 5.0 and later
Type=S
ShowCommandLine=1

The command-lines of each compilation/link are shown

Keystroke macro toolbar in the editor

In Delphi 7 there is a "spare" status panel in the code editor's status bar (the leftmost one). In normal usage this remains blank at all times. However if you enable an undocumented registry value this status panel houses a toolbar that surfaces the keystroke macro recording/playback facility in the editor.

In the Extras key off your Delphi version's root key you need to create a string values with Edit | New | String Value. This should be called ShowRecordMacro, and be given a value of 1. The next time you start Delphi, the toolbar will be displayed. To disable it, change the value to 0. Listing 18 shows a RegTweak.Ini section that does the job.

Listing 18: Enabling the keystroke macro toolbar in the editor

[Software\Borland\Delphi\7.0\Extras]
;Delphi 7.0
Type=S
ShowRecordMacro=1

The toolbar can be seen here: