Saving and Sharing Classes

An important part of reuse is making the classes easily available to other developers. Builder Xcessory enables you to store and share classes with other Builder Xcessory users.

Note: Individual reuse is useful only when entire groups and organizations reuse the same objects.

Saving Classes

When you make a class, the class is added automatically to the Project Classes group at the bottom of the Palette. Classes in the Project Classes group are saved with your project, allowing other developers to access those classes. To use the class in other projects, or move it to the Private or Public Classes group, you must save it to a separate file.

Saving a class

To save a class, follow these steps:

1. Confirm the Browser is in Classes view.

2. Select the desired class.

3. Select Save Class from the Browser File menu to display a file selection dialog:


File Selection Dialog

4. Enter the file name and directory path, and click OK to save the class.

Sharing Classes

Before you can share a class, you must save the class UIL file separately from the rest of the project. This separates the class definition from any given interface.

Conditions for sharing classes

You can share classes under the following conditions:

· By manually placing classes into locations accessible to all developers, and then importing the classes manually

· By using the Builder Xcessory Palette.

Sharing Class Libraries

You can also share a library of classes among a group of users.

Building a class library

To build a class library:

1. Generate code for your classes and build your library.

2. After generating the class files, deselect the Generate Class toggle (Resource Editor:Component) for each class in your library and save the classes into separate files using Save Class (Browser:File:Class).

3. Move the classes to the Public Classes group.

4. Move the header files and library to the desired location. Save the source files to preserve any user code blocks for future modifications.

Preparing a library for sharing

Now, when you use the class in an application, Generate Code is deselected by default. You still need to do a couple of things:

1. If you are generating C++ and included the BX-generated UIComponent in your library, deselect the Class Tree Root toggle button in the File Names tab (Browser:Options:Code Generation Settings).

Note: If you always want to include the UIComponent in your library, click the Save As Default button on the File Names tab. The UIComponent will not be generated in the future by default.

2. Add the include path for the class header files and library containing the class to the application Makefile and select the Don't Include Ungenerated Class Files toggle button on the Makefile tab (Browser:Options:Code Generation Settings).

Note: If you always want to include the library and its header file path in the Makefile, click the Save As Default button on the Makefile tab.

Moving Classes Between Groups

Dragging classes

Once you save the class, you can drag the class from the Project Classes group to either the Private or Public Class section on the Palette.

Note: You must be in Outline view to drag classes from one group to another.

· If you leave the class in the Project Class group, the class appears on the Palette when the project file is loaded.

· If you move the class into the Private Class group, the class is saved into the .builderXcessory directory in your home directory and appears on the Palette each time you start Builder Xcessory.

· If moved into the Public Class group, the class is saved into the {BX}/xcessory/classes system directory and appears on the Palette of all Builder Xcessory users in your organization.

Note: Classes moved into either the Private or Public groups are locked by default. You cannot edit these classes, regardless of directory permissions. Unlock classes by selecting Unlock Class from the Class menu of the Browser File menu.

Reading Classes

Reading a class

You can read classes that you or other developers saved. To read a class, follow these steps:

1. Select Read Class from the Class menu of the Browser File menu. A file selection dialog is displayed ( File Selection Dialog ).

2. Enter the file and directory of the class, and click OK.

Specifying Include Files

Each class can have its own set of include files, which can be specified from the Resource Editor when Builder Xcessory is in Classes view. When the class is selected, the Resource Editor includes a section labeled Class File Include Information that in turn includes two subsections: Base Class Includes and Derived Class Includes (see Class Includes Sections ).

Note: Derived Classes are available only when you choose C++ as your default language.

Resource Editor:

Class Includes Sections

The two sections are scrollable text regions. The contents of the text regions are included verbatim into the base and derived class .h files. This allows you to specify different include file information for each class that you create.

Note: Derived Classes are supported for backward compatibility only. We do not recommend using Derived Classes.