Rename Components

Previous pageReturn to chapter overviewNext page

 

The Rename Components tool allows you to define custom rename rules for various component classes and have those rules executed when components are added to a form at design time.  The renaming can be completely automatic, or you can be prompted for each component to customize the suggested name.

 

Rename Components

 

In the configuration screen, you can click Add to add a new rule, Remove to remove the selected rule, or Defaults to add some basic default rules to the list.

 

The rename rule consists of a default name for the component, and (optionally) any of the following patterns:

%d

Causes the automatic renaming to insert the smallest positive integer possible to create a unique component name on the form

|

Defines the default position of the caret in the interactive rename dialog

|foo|

Causes the interactive rename dialog to select the text 'foo' by default

 

The "Other Properties" button's dialog allows you to enter any extra properties you want to be able to edit when the interactive rename dialog pops up.  Those properties will be shown below the name property entry area in the rename dialog.  For example, you might use this to set the Caption of a Button while you are renaming or, or to set the checked status of a checkbox.  You need to enter the other properties one per line in the resulting dialog.  If you want any of the properties to have a default value different from the component's default, add an equals sign and then the default value after the property name.  If you have chosen not to show the interactive rename dialog, you can still specify "Other Properties" with defaults and those defaults will apply to any new component you place on the form.  For example, for TButton, you could define this set of properties in the other properties list to set some defaults and also be able to edit the default Hint property in the rename dialog:

 

Caption=OK

Hint

Enabled=False

 

Options:

Show rename dialog for new components: Show the interactive rename dialog for all newly added components.  Without this checked, the renaming is done automatically without user interaction.
Auto-add rules for new components: Each time a component is added to a form, a default rename rule will be added to the list so you can customize it.  Note that you need to create one rename rule manually to active this expert first before it will begin creating rules for you.

 

Rename Components Config

 

Note: This tool will only work for VCL and VCL.NET projects.