Importing Visual FoxPro Classes


Help Builder allows for importing of Visual FoxPro classes directly from the source code by looking at the basic layout of a VCX, SCX or PRG file based class. The import screen looks like this:

Note that you get an option to import class info incrementally by using the Add/Modify only empty topics option. So, if you add custom information on your imported classes the changes you made are preserved while bringing in any new methods and topic fields as they are added. If you plan to totally regenerate your classes every time it's suggested that you first delete the entire topic tree and then reimport the class from scratch.

VCX Imports

VCX imports read information stored in the visual class's metadata contained in the VCX file. The information retrieved includes the description (help body), class and method names, parameters and the scope of the class. In addition the Syntax information is automatically generated. Properties retrieve simlper information, only retrieving the name and the description as well as the initial value.

A straight import can give you a great jump start on creating help topics with skeleton outlines in place. The import process can also be run incrementally, so that only topics for topics that don't exist already are created, so that you can make changes and then re-run the import Wizard to pick up any additional interface methods and properties.

In addition to a straight import you can also use information embedded directly into VCX methods to allow you to keep your documentation where it belongs: with the code. To do so you can use a special Help Builder Documentation block that is parsed from the VCX when the class is imported.

See, theEmbedding Topic information in code topic for more details.

Sometimes it's useful to import an entire class library of classes rather than one class at a time. You can do this from the import screen simlpy by checking the class library option.

Importing a PRG based class

Help Builder also allows for importing of PRG based classes given that the classes follow some basic formatting rules. The PRG based class is scanned for each individual method and property which are added as topics. Properties are retrieved only with their initial valiue and any comments that follow on the same line or on the preceeding line. Methods read any comment blocks that immediately preceed or follow the method declaration. A comment block is a continuous block of lines that start with a comment character. Parameters are retrieved from any LPARAM or PARAM line that immediately follows the method declaration or comment block.

A fully parsable method header looks like this:

************************************************************************
* wwHTML :: ExpandScript
*********************************
***  Function: Handles WCS Template Page Expansion (ASP Syntax only)
***      Pass: tcPageName    -  Full path to the script page to expand
***            tnMode        -  1 - CodeBlock  2 - Compiled  3 - VFP Interactive
***            tvContenttype -  Content Type or HTTP Header object
***            tlNoOutput 
***    Return: nothing or expanded HTML if tlNoOutput .t.
************************************************************************
FUNCTION ExpandScript
LPARAMETERS tcPageName, tnMode, tvContentType, tlTemplateString

which will grab the entire method head above the function declaration as the topic body and the list of parameters from the LAPARAMETERS line.


© West Wind Techologies, 2018 • Updated: 08/13/15
Comment or report problem with topic