Sei sulla pagina 1di 12

Page 1 of 12

Undocumented Settings For


Delphi, Kylix and C++Builder
l Modifying registry entries
l Automatic Component Palette Operations
l WYSIWYG font name in the Object Inspector
l Object Inspector property value colour
l IDE tooltip colour
l Code Insight errors
l No Debug Window Shortcuts
l CPU window
l Attach to Process Menu
l Editor default height/width
l Component Template directory
l Personal settings directory
l IDE internal command lines
l Keystroke macro toolbar in the editor

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

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004
Page 2 of 12

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.

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004
Page 3 of 12

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.

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004
Page 4 of 12

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

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004
Page 5 of 12

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

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.

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004
Page 6 of 12

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:

to this:

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004
Page 7 of 12

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

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004
Page 8 of 12

[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]

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004
Page 9 of 12

;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

File Product Purpose

Default project options for


defproj.opt Delphi 1 only
the IDE

The file used to store menu


delphi.dmt Delphi 1 only
templates

The default project desktop


delphi.dsk Delphi 1 only
file

delphi.hdx Delphi 1 and 2 only The MultiHelp index file

Default project options for


defproj.dof Delphi 2 and later
the IDE

The file used to store menu


delphi32.dmt Delphi 2 and later
templates

The default project desktop


delphi32.dsk Delphi 2 and later
file

The text file used to store


delphi32.dci Delphi 3 and later
Code Templates

Default project options for


defproj.cfg Delphi 4 and later
the command-line compiler

Delphi/C++Builder 4 and
oh.exe The OpenHelp executable
later

Delphi/C++Builder 4 and
oh.ini The OpenHelp settings file
later

The file used to store menu


bcb.dmt C++Builder 1 and later
templates

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004
Page 10 of 12

The default project desktop


bcb.dsk C++Builder 1 and later
file

default.bpr C++Builder 1 and later Default project file

ilink32.dll C++Builder 1 and later Incremental linker

openhelp.exe C++Builder 3 only The OpenHelp executable

openhelp.ini C++Builder 3 only The OpenHelp settings file

The text file used to store


bcb.dci C++Builder 3 and later
Code Templates

Editor formatting
bcb.bcf C++Builder 5 and later
configuration file

XML converter
convrtrs.txt C++Builder 5 and later
configuration

Default application
default.bmk C++Builder 5 and later
makefile

deflib.bmk C++Builder 5 and later Default library makefile

ibm-
C++Builder 5 and later XML converter
1252.cnv

Default project options for


defproj.conf Kylix 1 and later
the command-line compiler

Default project options for


defproj.kof Kylix 1 and later
the IDE

The Component Templates


delphi.dct Kylix 1 and later
file

The default project desktop


delphi.desk Kylix 1 and later
file

The text file used to store


delphi60dci Kylix 1 and later
Code Templates

The file used to store menu


delphi60dmt Kylix 1 and later
templates

The Object Repository


delphi60dro Kylix 1 and later
settings

Delphi/C++Builder 5 and
*.dst Global desktop files
later, Kylix 1 and later

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004
Page 11 of 12

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

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 and later
Type=S
ShowRecordMacro=1

The toolbar can be seen here:

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004
Page 12 of 12

http://www.blong.com/Undocumented/RegistryEntries.htm 8/02/2004

Potrebbero piacerti anche