Managing Classes with the Class Browser
You can create subclasses, copy classes from one class library to another, remove classes and library files, rename a class, or redefine the relationship of a class.
**Caution **If you remove, rename, or redefine a class, the forms that are not currently displayed in a Class Browser window and that rely on the class might not run properly.
To add a subclass
- In the Class Browser, open a class library.
- Select the class you want to subclass, and then choose the New Class button.
- In the New Class dialog box, enter the name for the new subclass.
- In the Class Designer, define and save the subclass.
- The Class Browser displays the new subclass.
To copy a class from one class library to another
- In the Class Browser, open the source class library.
- From the Tools menu, open a second instance of the Class Browser and select the destination library file.
- In the source class library, select the class you want to copy, and then while pressing the Ctrl key, drag the Class Move icon picture located above the class list to the class icon picture in the destination library. The cursor appears with a plus sign when you are over the destination class icon.
To copy multiple classes from one class library file to another
- Open the source class library in the Class Browser.
- If you want to filter the class list, type a filter in the Type box to limit the classes you want to copy from the file.
- From the Tools menu, open a second instance of the Class Browser and select the destination library file.
- In the source class library, select the class library file you want to copy, and then while pressing the Ctrl key, drag the class icon picture located above the class list to the class icon picture in the destination library. The cursor appears with a plus sign when you are over the destination class icon picture.
To remove a class, class library, or form
- Open the class library or form in the Class Browser.
- In the Class list, select the class, class library, or form you want to remove or delete, and then choose the Remove button. For classes, the record in the library is marked for deletion the next time you choose Clean Up Library. For class libraries and forms, the file is deleted from the disk.
To rename a class in a class library
Open the class library in the Class Browser.
In the Class list, select the class you want to rename, and then choose the Rename button.
**Caution **If you rename a class that has associated subclasses that are not currently contained in an open Class Browser window, the subclasses will not be able to reference properties that are inherited from the renamed class.
In the Rename Class dialog box, type the new name, and then choose Rename.
The Class Browser displays the new name and the new name is automatically referenced in all the affected forms and classes currently displayed in Class Browser windows.
To change the parent class of a class
- Open the class library in the Class Browser.
- In the Class list, select the class you want to redefine, and then choose the Redefine button.
- In the As box of the Redefine dialog box, select the name of the new parent class using the drop down list. You can redefine some base classes
You can also use drag and drop functionality to manage classes in the Class Browser. Managing files in the Class Browser is the recommended way to update project files as well as class libraries and forms. Changes made in the Class Browser are cascaded through every open .vcx and .scx file. Common Drag and drop moves an object from one location to another. Modifier keys with drag and drop provide the following behaviors:
Drag and drop with | To |
---|---|
CTRL | Copy a class between Class Browser windows |
Right-click | Instantiates object in a container:
to Command window – generates instantiation code |
SHIFT | Creates instance of the class but doesn't display it. Drag to Command window functions as a simple drag and drop. |
See Also
Browsing Classes with the Class Browser | Class Browser Buttons | Class Browser Methods | Class Browser Properties | Class Browser Window | Customizing the Class Browser | Filtering the Class Browser Class List | Modifying Class Icons and Descriptions | Running the Class Browser | Viewing Class Hierarchies | Viewing Type Library Information