Wiki Home

Visual Class Library

Namespace: WIN_COM_API
A visual class library is .VCX file containing classes that can be edited with the Visual Class Designer or, since a .VCX file is just a table, it can also be manipulated programmatically with standard VFP data manipulation commands, or interactively with a BROWSE or EDIT window.
See also PRGvs VCX, and Class Library, which includes a discussion of librarying non-visual classes.
I have some questions regarding Visual Class Library Management.

As you progress with an application, you build your class library and eventually, it becomes less than manageable because of the number of components (both sub-classes and derivations of same).

1. Is there an easy way to break apart the original class library into more specific libraries. I thought of making as many copies of the original .vcx as required and then one by one, deleting the classes that aren't relevant to the new class library name, and,

2. This would lead to sub-classes potentially being orphaned from their parents, and, therefore will they reference the parent library if they are all in the same project? -- Peter Easson

The Class Browser does all this automatically and smartly:
1. Open your project .PJX in the Class Browser
2. In a second instance of the class browser, open a target .VCX
3. Using the class icon, Drag and Drop the class from the Project to the target .VCX. The Class Browser will repointer all the dependent classes, regardless of their .VCX. -- Steven Black
Thanks Steven..
I new there would be a simple answer without re-inventing the wheel! I love the Wiki!
Next one if you please..
What is the simplest way to distribute a .vcx without releasing the code (like the old days of distributing a .lib library? -- Peter Easson
You can simply replace all the method code memo fields of the VCX with blanks and then give it away (or use it in projects) all you want... no one will get the source code; BUT the problem is the ON ERROR mechanism will no longer report what line an error occurs on. This also has the benefit of making the VCX a whole lot smaller for distribution (particularly when it's part of a large project with many VCX's).
HOWEVER, I just found this suggestion on the microsoft.public.vfp.helpwanted newsgroup: If you compile the VCX (COMPILE CLASSLIB whatever ... just to make sure the stored compiled code is current with the stored source code), then open it as a table and replace all the method code memo fields with a single asterisk ( * ) in each, you can still use the VCX and even build it into an .APP .EXE or .DLL and give it away. Since there (technically) still is code in the methods, VFP will still report the error lines! You just have to be sure not to let VFP recompile the VCX or you'll lose a whole lot!
To protect someone else from accidently recompiling the VCX you gave them, you can just package it up in an .APP or .EXE project and then they can use it via: SET CLASSLIB TO whatever.vcx IN -- wgcs
Category Class Design Category Exam 70-155 Hot Topic
( Topic last updated: 2000.12.21 12:31:50 PM )