Home>>Programming>>C++Builder>> » How to Share Objects in Team Environments and Use Objects Repository Items in a Project in C Builder

How to Share Objects in Team Environments and Use Objects Repository Items in a Project in C Builder

Last Updated on September 10, 2018 By hcyaobin

Sharing objects in a team environment

You can share objects with your workgroup or development team by making a repository available over a network. To use a shared repository, all team members must select the same Shared Repository directory in the Environment Options dialog:

Choose Tools|Environment Options.
On the Preferences page, locate the Shared Repository panel. In the Directory edit box, enter the directory where you want to locate the shared repository. Be sure to specify a directory that’s accessible to all team members.
The first time an item is added to the repository, C++Builder creates a BCB.DRO file in the Shared Repository directory if one doesn’t exist already.

Using an Object Repository item in a project

To access items in the Object Repository, choose File|New|Other. The New Items dialog appears, showing all the items available. Depending on the type of item you want to use, you have up to three options for adding the item to your project:

  1. Copy
  2. Inherit
  3. Use

Copying an item

Choose Copy to make an exact copy of the selected item and add the copy to your project. Future changes made to the item in the Object Repository will not be reflected in your copy, and alterations made to your copy will not affect the original Object Repository item.
Copy is the only option available for project templates.

Inheriting an item

Choose Inherit to derive a new class from the selected item in the Object Repository and add the new class to your project. When you recompile your project, any changes that have been made to the item in the Object Repository will be reflected in your derived class, in addition to changes you make to the item in your project. Changes made to your derived class do not affect the shared item in the Object Repository.
Inherit is available for forms, dialog boxes, and data modules, but not for project templates. It is the only option available for reusing items within the same project.

Using an item

Choose Use when you want the selected item itself to become part of your project. Changes made to the item in your project will appear in all other projects that have added the item with the Inherit or Use option. Select this option with caution.
The Use option is available for forms, dialog boxes, and data modules.

Modifying shared items

If you modify an item in the Object Repository, your changes will affect all future projects that use the item as well as existing projects that have added the item with the Use or Inherit option. To avoid propagating changes to other projects, you have several alternatives:

  1. Copy the item and modify it in your current project only.
  2. Copy the item to the current project, modify it, then add it to the Repository under a different name.
  3. Create a component, DLL, component template, or frame from the item. If you create a component or DLL, you can share it with other developers.

Add a Comment

Your email address will not be published. Required fields are marked *