Latest Articles related to all categories. Microsoft, Twitter, Xbox, Autos and much more

Full width home advertisement

Post Page Advertisement [Top]

There are several ways to explore the FoxPro Foundation Classes, including the Class Browser,
the Solution Samples, the Component Gallery, and the Visual FoxPro Help File. Before you begin
exploring, it helps to know about the FFC base classes and the FFC class and class library naming
conventions.

FFC base classes and naming conventions


Most of the FFC visual class libraries have names that begin with an underscore. Among them is a
class library named _base.vcx. This library contains a set of classes derived directly from the
Visual FoxPro base classes. The name of each individual class in _base.vcx is the same as the
name of the VFP base class from which it is derived, preceded with an underscore. For example,
the FFC base class _form is a subclass of the VFP form base class, _grid is a subclass of the VFP
grid base class, and so on.
Most of the Foundation Classes are derived from the foundation base classes in _base.vcx. The
name of each FFC class library indicates the parentage of the classes it contains. If the name of
the class library begins with an underscore, the classes in that library are typically derived from the
foundation base classes in _base.vcx. Conversely, if the name of the class library does not begin
with an underscore, the library contains classes not derived from the foundation base classes.
There are a few exceptions to this naming convention, but it applies most of the time.


VFP help file


As with anything else in Visual FoxPro, one of the best places to begin exploring is the VFP Help
File. The topic Guidelines For Using Visual FoxPro Foundation Classes is a good place to start.
This topic runs about five pages and provides a good introduction to what the Foundation Classes
are all about and ways you can work with them.
The Visual FoxPro Foundation Classes A-Z topic is an alphabetical listing of all one hundred
twelve foundation classes. This topic is just a list of the class names—there are no descriptions
here—but you can skim the list quickly to get a feeling for the variety of classes available and
maybe spot a few that are of particular interest to you. Each foundation class has its own
individual Help File topic, which is linked from this list.
The Component Gallery Object Members topic is also a good one to add to your Help File
favorites. It provides a brief description of each foundation classes and tells you which class
library the class belongs to and which Component Gallery catalog it can be found it. More
information on exploring the FFC from the Component Gallery follows shortly.

Many of the foundation classes come with samples. These samples are referenced in the
Foundation Class Samples topic in the VFP Help File. Each entry in this topic offers a brief
description of the sample along with a link to the individual Help File topic for that sample.

Class browser


If you like to explore new things by simply jumping in and digging around, you may want to
explore the Foundation Classes with the Class Browser. This enables you to open the FFC class
libraries and examine the properties and methods of the classes they contain.
Remember that the foundation class libraries are installed in the FFC subfolder under the VFP
home folder. If you launch the Class Browser from the VFP Tools menu, click the Open icon on
the Class Browser toolbar, navigate to the FFC subfolder, and select a class library. If you already
know the name of the class library you want to explore, you can launch the Class Browser from
the Command window and tell it to open a specific class library all in one step. For example, to
open the Registry foundation class in the class browser, use:
DO ( _browser) with HOME(1) + “FFC\registry.vcx”
The class libraries and individual classes have fairly descriptive names, so you’ll have a pretty
good idea of what you’re looking at just by the name. For example, the class library named
registry.vcx contains classes for working with the registry.

Component gallery


The Component Gallery is a tool for working with catalogs of objects, including class libraries. If
you’re not familiar with the Component Gallery, you can get a quick introduction by reading
Using the Component Gallery in the VFP Help File. Like the Foundation Classes themselves, the
Component Gallery was introduced in VFP 6.0.
The Component Gallery is a great way to explore and access the Foundation Classes. You can
launch the Component Gallery from the Tools menu, or by clicking the Component Gallery icon
on the Class Browser toolbar. The Component Gallery’s default catalog is the Visual FoxPro
Catalog, which contains the Foundation Classes. You can also launch the Component Gallery
from the Command window and tell it to open the Visual FoxPro catalog with the following
command:
DO ( _gallery) WITH "vfp catalog.dbf"
Expand the Foundation Classes node of the Component Gallery treeview to see the individual
catalogs.

image

Figure 1: The Foundation Classes are found in the Visual FoxPro Catalog in the Component Gallery.
In the Component Gallery, the Foundation Classes are grouped into catalogs according to the
type of functionality they provide. This catalog grouping is not the same as grouping by class
library; any given catalog may very well contain classes from more than one FFC class library.
The grouping of classes into catalogs in the Component Gallery can help you find groups of
classes that serve similar functions. However, it may not be as helpful if you’re hunting for a
specific class, because you may have to do a bit of guessing to figure out which catalog Microsoft
decided the class belongs in. (It’s kind of like wandering around an unfamiliar grocery store
looking for a specific item: are the croutons in the same aisle as the crackers, or are they five
aisles over with the salad dressings?)
Some Foundation Classes come with a sample demonstrating how they work. For those that do,
the Component Gallery gives you direct access to that sample by right-clicking on the class (not
the class library) and choosing View Sample from the popup menu. From there you can select
Run to run the sample and see the Foundation Class in operation, or you can select Open to open
the sample in the designer so you can inspect the code and see how the sample is put together.

image

Figure 2: You can open or run the sample for a foundation class directly from the Component Gallery.
The popup menu also enables you to easily incorporate the selected foundation class into your
solution. If the selected foundation class is a form, such as the About Dialog, you can create a
new form based on that class by choosing Create Form from the popup menu. If the selected
foundation class is one that can be used on a form, such as a button, and if you have a form open
in design mode, you can add the class to the form by clicking Add to Form on the popup menu.

image

Figure 3: With myform.scx open in design mode, you can add a foundation class to it directly from the
Component Gallery.

Solution samples


As noted earlier, many of the Foundation Classes come with samples that illustrate their use.
Another way to explore the FFC is from the Solution Samples page in the Task Pane Manager.

image

Figure 4: You can explore the Foundation Classes from the Solution Samples in the Task Pane Manager.
Expanding the node for the Foundation Classes reveals several samples you can explore. Rather
than having to work from only the name of a class and its class library, the Solution Samples
provide descriptions of the foundation classes to help you identify the ones you are interested in.

image

Figure 5: Expand the Foundation Classes node to reveal the samples for several Foundation Classes.
As with all Solution Samples, you can both run the sample and explore its source code. The
headings in the list of samples are hyperlinks: click on a link to run the sample. Click on the icon
to the right of a sample’s description to view the source code.

image

Figure 6: The headings are hyperlinks. Click the link to run the sample, or click the icon to the far right to
view the source code.

No comments:

Post a Comment

Bottom Ad [Post Page]