Copy, Inherit, Use

From Appmethod Topics
Jump to: navigation, search

Go Up to New Items


For specific Object Repository items, the following three options are available:

  • Copy the item
  • Inherit from the item
  • Use the item directly

When you use an item from the Object Repository (specifically, the Inheritable Items group in New Items) in a project, you have these three options on how to include the item. Keep in mind that items in the Object Repository are to be shared, and so you should use them in ways that help the reuse, rather than hinder reuse, of the object.

Copying items from the Object Repository

Select Copy to copy the selected item and add it to your project. Future changes made to the item in the Object Repository are not reflected in your copy, and alterations made to your copy do not affect the original Object Repository item.

Note: Copying is the only option available for using project templates.

Inheriting from Object Repository items

Select Inherit to derive a new class from the selected item in the Object Repository and add the new class to your project. The Inherit option creates a link to the ancestor item in the repository. When you recompile your project, any changes that have been made to the item in the Object Repository are reflected in your derived class. These changes apply in addition to any changes or additions you make to the item in your project. Changes made to your derived class do not affect the shared item in the Object Repository.

Note: Inheriting is available as an option for forms, dialog boxes, and data modules, but not for project templates. It is the only option available for reusing items from within the same project.

Using Object Repository items directly

Caution: The Use option is available for forms, dialog boxes, and data modules, but you should use it carefully. Make sure the changes you make to an item are thoroughly tested before letting others copy it into their applications from the repository.

Select Use when you want the selected item itself to become part of your project. In this case, you are not making a copy of the item; you are using the item itself "live." Using the item adds the item itself to your project, just as if you had created it as part of that project. Design-time changes made to the item therefore appear in all projects that directly use the item, as well as affecting any projects that inherit from the item. Changes to the item appear in all projects that have added the item with either the Inherit or Use options selected.

Note: Using items directly is an available option for forms, dialog boxes, and data modules. Items shared this way should generally be modified only at run time, to avoid making changes that affect other projects. The Use option is the only option available for wizards, either form wizards or project wizards, because a wizard does not actually add shared code, but rather generates its own code.

See Also