Installing Component Packages

From RAD Studio
Jump to: navigation, search

Go Up to Design-time Packages

All components are installed in the IDE as packages. If you have written your own components, create and compile a package that contains them (see Creating and Editing Packages). Your component source code must follow the model described in Overview of Component Creation.

To install or uninstall your own components, or components from a third-party vendor

  1. If you are installing a new package, copy or move the package files to a local directory. If the package is shipped with .bpl, .dcp, and .dcu files, be sure to copy all of them (see Packages and Standard DLLs). The directory where you store the .dcp file -- and the .dcu files, if they are included with the distribution -- must be in the Delphi Library Path.
  2. Choose Component > Install Packages from the IDE menu, or choose Project > Options and click the Packages tab. A list of available packages appears in the Design packages list box.
    • To install a package in the IDE, select the check box next to it.
    • To uninstall a package, clear its check box.
    • To see a list of components included in an installed package, select the package and click Components.
    • To remove a package from the list, select the package and click Remove.
    • To add a package to the list:
    1. Click Add and browse in the Add Design Package dialog for the directory where the .bpl file resides (see step 1).
    2. Select the .bpl file and click Open.
  3. Click OK.

See Registering Components for the steps that must be performed to install the newly created component.

The components in the package are installed on the Tool palette pages specified in the RegisterComponents procedures, with the names they were assigned in these procedures.

A new project, depending on the type of the project, is created with some subsets of all installed packages. To check which packages are available in your project open the Packages tab of the Project Options dialog box.

To remove components from the Tool Palette without uninstalling a package, right-click the component to invoke the context menu and choose Hide "<ComponentName>" Button.

Explicitly disabling smart loading of components in a design-time package

By default, the IDE uses smart (lazy) loading of design-time packages installed in the IDE. When the IDE starts, the IDE does not immediately load all installed packages. Initially, only the installed packages components which are explicitly used in the project group are loaded by the IDE. Packages that are not loaded, can be automatically loaded on demand. For example, when the programmer drags a component from the Tool Palette into the Form Designer, then the package in which this component is registered is loaded into the IDE. Smart loading is used to decrease the IDE opening time and used memory.

In some situations you need to disable smart loading of installed components. For example, in FireMonkey framework a custom component can define a new style. You can install in the IDE the design-time package registering this custom component. When you run the IDE loading a project that does not use any registered component from this package, the IDE, by default, uses smart loading of components. Therefore, the custom components from this package are not loaded into the memory. As result, the IDE does not know the styles defined by these components. Styles are referenced in style books explicitly using the StyleName strings. Therefore, usage of some StyleName defined for the custom component does not enforce the IDE to load this custom component if it is not used in a loaded project. Opening such a project generates then an error like this one:

Error reading <StyleBook1.ResourcesBin>: Class <ComponentClass> not found. 
Ignore the error and continue?
NOTE: Ignoring the error may cause components to be deleted or property
values to be lost.   

If you ignore this error message, the referenced style is not known to the project. If you build such a project and run the obtained application, the application can generate a run-time error if it tries to access this style.

For such custom components you need to explicitly disable smart loading of a package in which these components are registered.

To disable smart loading of components registered in a package call

ForceDemandLoadState(dlDisable)

during the implementation of the Register procedure of a package if the loading state of that package needs to be set explicitly.

See Also